mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: cleanup
This commit is contained in:
@@ -7,23 +7,16 @@ import {
|
||||
|
||||
import { profile } from "../../profiling";
|
||||
|
||||
export * from "../core/view";
|
||||
|
||||
import {
|
||||
View,
|
||||
ViewBase,
|
||||
Property,
|
||||
unsetValue,
|
||||
booleanConverter,
|
||||
horizontalAlignmentProperty,
|
||||
verticalAlignmentProperty,
|
||||
CSSType,
|
||||
traceWrite,
|
||||
traceCategories,
|
||||
traceMessageType
|
||||
} from "../core/view";
|
||||
import { ShorthandProperty, CssProperty, Style } from "../core/properties/properties";
|
||||
import { Length } from "../core/view";
|
||||
import { ViewBase, booleanConverter } from "../core/view-base";
|
||||
import { Trace } from "../../trace";
|
||||
import { ShorthandProperty, CssProperty, Property, unsetValue } from "../core/properties";
|
||||
import { Length, horizontalAlignmentProperty,
|
||||
verticalAlignmentProperty } from "../styling/style-properties";
|
||||
import { Style } from '../styling/style';
|
||||
|
||||
export module knownCollections {
|
||||
export const actionItems = "actionItems";
|
||||
@@ -378,9 +371,9 @@ function onVisibilityChanged(item: ActionItemBase, oldValue: string, newValue: s
|
||||
}
|
||||
|
||||
export function traceMissingIcon(icon: string) {
|
||||
traceWrite("Could not load action bar icon: " + icon,
|
||||
traceCategories.Error,
|
||||
traceMessageType.error);
|
||||
Trace.write("Could not load action bar icon: " + icon,
|
||||
Trace.categories.Error,
|
||||
Trace.messageType.error);
|
||||
}
|
||||
|
||||
function convertToContentInset(this: void, value: string | Length): [CssProperty<any, any>, any][] {
|
||||
@@ -436,7 +429,7 @@ export const androidContentInsetLeftProperty = new CssProperty<Style, Length>({
|
||||
if (view) {
|
||||
view.effectiveContentInsetLeft = Length.toDevicePixels(newValue);
|
||||
} else {
|
||||
traceWrite(`${newValue} not set to view's property because ".viewRef" is cleared`, traceCategories.Style, traceMessageType.warn);
|
||||
Trace.write(`${newValue} not set to view's property because ".viewRef" is cleared`, Trace.categories.Style, Trace.messageType.warn);
|
||||
}
|
||||
}, valueConverter: Length.parse
|
||||
});
|
||||
@@ -450,7 +443,7 @@ export const androidContentInsetRightProperty = new CssProperty<Style, Length>({
|
||||
if (view) {
|
||||
view.effectiveContentInsetRight = Length.toDevicePixels(newValue);
|
||||
} else {
|
||||
traceWrite(`${newValue} not set to view's property because ".viewRef" is cleared`, traceCategories.Style, traceMessageType.warn);
|
||||
Trace.write(`${newValue} not set to view's property because ".viewRef" is cleared`, Trace.categories.Style, Trace.messageType.warn);
|
||||
}
|
||||
}, valueConverter: Length.parse
|
||||
});
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
import { AndroidActionItemSettings, AndroidActionBarSettings as AndroidActionBarSettingsDefinition, ActionItem as ActionItemDefinition } from ".";
|
||||
import {
|
||||
ActionItemBase, ActionBarBase, isVisible,
|
||||
View, layout, colorProperty, flatProperty, Color,
|
||||
flatProperty,
|
||||
traceMissingIcon, androidContentInsetLeftProperty, androidContentInsetRightProperty
|
||||
} from "./action-bar-common";
|
||||
import { View} from '../core/view';
|
||||
import { Color} from '../../color';
|
||||
import { layout} from '../../utils/utils';
|
||||
import { colorProperty} from '../core/bindable';
|
||||
import { RESOURCE_PREFIX, isFontIconURI } from "../../utils/utils";
|
||||
import { ImageSource } from "../../image-source";
|
||||
import * as application from "../../application";
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
/**
|
||||
* Contains the action bar related classes.
|
||||
* @module "ui/action-bar"
|
||||
*/ /** */
|
||||
|
||||
import { EventData, ViewBase, View } from "../core/view";
|
||||
import { View } from "../core/view";
|
||||
import { ViewBase } from "../core/view-base";
|
||||
import { EventData } from "../../data/observable";
|
||||
|
||||
/**
|
||||
* Provides an abstraction over the ActionBar (android) and NavigationBar (iOS).
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import { ActivityIndicator as ActivityIndicatorDefinition } from ".";
|
||||
import { View, Property, booleanConverter, CSSType } from "../core/view";
|
||||
|
||||
export * from "../core/view";
|
||||
|
||||
@CSSType("ActivityIndicator")
|
||||
export class ActivityIndicatorBase extends View implements ActivityIndicatorDefinition {
|
||||
public busy: boolean;
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
/**
|
||||
* Contains the ActivityIndicator class, which represents a widget for showing that something is currently busy.
|
||||
* @module "ui/activity-indicator"
|
||||
*/ /** */
|
||||
|
||||
import { View } from "../core/view";
|
||||
import { View } from "../core/view";
|
||||
|
||||
/**
|
||||
* Represents a UI widget which displays a progress indicator hinting the user for some background operation running.
|
||||
|
||||
@@ -12,12 +12,10 @@ import {
|
||||
// Requires.
|
||||
import { Color } from "../../color";
|
||||
import {
|
||||
isEnabled as traceEnabled, write as traceWrite,
|
||||
categories as traceCategories, messageType as traceType
|
||||
Trace
|
||||
} from "../../trace";
|
||||
import { PercentLength } from "../styling/style-properties";
|
||||
|
||||
export { Color, traceEnabled, traceWrite, traceCategories, traceType };
|
||||
export * from "./animation-interfaces";
|
||||
|
||||
export module Properties {
|
||||
@@ -57,8 +55,8 @@ export abstract class AnimationBase implements AnimationBaseDefinition {
|
||||
throw new Error("No animation definitions specified");
|
||||
}
|
||||
|
||||
if (traceEnabled()) {
|
||||
traceWrite("Analyzing " + animationDefinitions.length + " animation definitions...", traceCategories.Animation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("Analyzing " + animationDefinitions.length + " animation definitions...", Trace.categories.Animation);
|
||||
}
|
||||
|
||||
this._propertyAnimations = new Array<PropertyAnimation>();
|
||||
@@ -72,8 +70,8 @@ export abstract class AnimationBase implements AnimationBaseDefinition {
|
||||
if (this._propertyAnimations.length === 0) {
|
||||
throw new Error("Nothing to animate.");
|
||||
}
|
||||
if (traceEnabled()) {
|
||||
traceWrite("Created " + this._propertyAnimations.length + " individual property animations.", traceCategories.Animation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("Created " + this._propertyAnimations.length + " individual property animations.", Trace.categories.Animation);
|
||||
}
|
||||
|
||||
this._playSequentially = playSequentially;
|
||||
@@ -83,7 +81,7 @@ export abstract class AnimationBase implements AnimationBaseDefinition {
|
||||
|
||||
protected _rejectAlreadyPlaying(): AnimationPromiseDefinition {
|
||||
const reason = "Animation is already playing.";
|
||||
traceWrite(reason, traceCategories.Animation, traceType.warn);
|
||||
Trace.write(reason, Trace.categories.Animation, Trace.messageType.warn);
|
||||
|
||||
return <AnimationPromiseDefinition>new Promise<void>((resolve, reject) => {
|
||||
reject(reason);
|
||||
|
||||
@@ -4,9 +4,10 @@ import { View } from "../core/view";
|
||||
|
||||
// Requires
|
||||
import {
|
||||
AnimationBase, Properties, CubicBezierAnimationCurve, Color, traceWrite,
|
||||
traceEnabled, traceCategories, traceType
|
||||
AnimationBase, Properties, CubicBezierAnimationCurve
|
||||
} from "./animation-common";
|
||||
import { Color } from "../../color";
|
||||
import { Trace } from "../../trace";
|
||||
import {
|
||||
opacityProperty, backgroundColorProperty, rotateProperty, rotateXProperty, rotateYProperty,
|
||||
translateXProperty, translateYProperty, scaleXProperty, scaleYProperty,
|
||||
@@ -44,40 +45,40 @@ propertyKeys[Properties.width] = Symbol(keyPrefix + Properties.width);
|
||||
export function _resolveAnimationCurve(curve: string | CubicBezierAnimationCurve | android.view.animation.Interpolator | android.view.animation.LinearInterpolator): android.view.animation.Interpolator {
|
||||
switch (curve) {
|
||||
case "easeIn":
|
||||
if (traceEnabled()) {
|
||||
traceWrite("Animation curve resolved to android.view.animation.AccelerateInterpolator(1).", traceCategories.Animation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("Animation curve resolved to android.view.animation.AccelerateInterpolator(1).", Trace.categories.Animation);
|
||||
}
|
||||
|
||||
return easeIn();
|
||||
case "easeOut":
|
||||
if (traceEnabled()) {
|
||||
traceWrite("Animation curve resolved to android.view.animation.DecelerateInterpolator(1).", traceCategories.Animation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("Animation curve resolved to android.view.animation.DecelerateInterpolator(1).", Trace.categories.Animation);
|
||||
}
|
||||
|
||||
return easeOut();
|
||||
case "easeInOut":
|
||||
if (traceEnabled()) {
|
||||
traceWrite("Animation curve resolved to android.view.animation.AccelerateDecelerateInterpolator().", traceCategories.Animation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("Animation curve resolved to android.view.animation.AccelerateDecelerateInterpolator().", Trace.categories.Animation);
|
||||
}
|
||||
|
||||
return easeInOut();
|
||||
case "linear":
|
||||
if (traceEnabled()) {
|
||||
traceWrite("Animation curve resolved to android.view.animation.LinearInterpolator().", traceCategories.Animation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("Animation curve resolved to android.view.animation.LinearInterpolator().", Trace.categories.Animation);
|
||||
}
|
||||
|
||||
return linear();
|
||||
case "spring":
|
||||
if (traceEnabled()) {
|
||||
traceWrite("Animation curve resolved to android.view.animation.BounceInterpolator().", traceCategories.Animation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("Animation curve resolved to android.view.animation.BounceInterpolator().", Trace.categories.Animation);
|
||||
}
|
||||
|
||||
return bounce();
|
||||
case "ease":
|
||||
return (<any>androidx).core.view.animation.PathInterpolatorCompat.create(0.25, 0.1, 0.25, 1.0);
|
||||
default:
|
||||
if (traceEnabled()) {
|
||||
traceWrite("Animation curve resolved to original: " + curve, traceCategories.Animation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("Animation curve resolved to original: " + curve, Trace.categories.Animation);
|
||||
}
|
||||
if (curve instanceof CubicBezierAnimationCurve) {
|
||||
return (<any>androidx).core.view.animation.PathInterpolatorCompat.create(curve.x1, curve.y1, curve.x2, curve.y2);
|
||||
@@ -143,18 +144,18 @@ export class Animation extends AnimationBase {
|
||||
let that = new WeakRef(this);
|
||||
this._animatorListener = new android.animation.Animator.AnimatorListener({
|
||||
onAnimationStart: function (animator: android.animation.Animator): void {
|
||||
if (traceEnabled()) {
|
||||
traceWrite("MainAnimatorListener.onAndroidAnimationStart(" + animator + ")", traceCategories.Animation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("MainAnimatorListener.onAndroidAnimationStart(" + animator + ")", Trace.categories.Animation);
|
||||
}
|
||||
},
|
||||
onAnimationRepeat: function (animator: android.animation.Animator): void {
|
||||
if (traceEnabled()) {
|
||||
traceWrite("MainAnimatorListener.onAnimationRepeat(" + animator + ")", traceCategories.Animation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("MainAnimatorListener.onAnimationRepeat(" + animator + ")", Trace.categories.Animation);
|
||||
}
|
||||
},
|
||||
onAnimationEnd: function (animator: android.animation.Animator): void {
|
||||
if (traceEnabled()) {
|
||||
traceWrite("MainAnimatorListener.onAnimationEnd(" + animator + ")", traceCategories.Animation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("MainAnimatorListener.onAnimationEnd(" + animator + ")", Trace.categories.Animation);
|
||||
}
|
||||
const thisRef = that.get();
|
||||
if (thisRef) {
|
||||
@@ -162,8 +163,8 @@ export class Animation extends AnimationBase {
|
||||
}
|
||||
},
|
||||
onAnimationCancel: function (animator: android.animation.Animator): void {
|
||||
if (traceEnabled()) {
|
||||
traceWrite("MainAnimatorListener.onAnimationCancel(" + animator + ")", traceCategories.Animation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("MainAnimatorListener.onAnimationCancel(" + animator + ")", Trace.categories.Animation);
|
||||
}
|
||||
const thisRef = that.get();
|
||||
if (thisRef) {
|
||||
@@ -207,12 +208,12 @@ export class Animation extends AnimationBase {
|
||||
|
||||
public cancel(): void {
|
||||
if (!this.isPlaying) {
|
||||
traceWrite("Animation is not currently playing.", traceCategories.Animation, traceType.warn);
|
||||
Trace.write("Animation is not currently playing.", Trace.categories.Animation, Trace.messageType.warn);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
traceWrite("Cancelling AnimatorSet.", traceCategories.Animation);
|
||||
Trace.write("Cancelling AnimatorSet.", Trace.categories.Animation);
|
||||
|
||||
this._animatorSet.cancel();
|
||||
}
|
||||
@@ -238,8 +239,8 @@ export class Animation extends AnimationBase {
|
||||
}
|
||||
}
|
||||
|
||||
if (traceEnabled()) {
|
||||
traceWrite("Starting " + this._nativeAnimatorsArray.length + " animations " + (this._playSequentially ? "sequentially." : "together."), traceCategories.Animation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("Starting " + this._nativeAnimatorsArray.length + " animations " + (this._playSequentially ? "sequentially." : "together."), Trace.categories.Animation);
|
||||
}
|
||||
|
||||
this._animatorSet.setupStartValues();
|
||||
@@ -276,8 +277,8 @@ export class Animation extends AnimationBase {
|
||||
return;
|
||||
}
|
||||
|
||||
if (traceEnabled()) {
|
||||
traceWrite("Creating ObjectAnimator(s) for animation: " + Animation._getAnimationInfo(propertyAnimation) + "...", traceCategories.Animation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("Creating ObjectAnimator(s) for animation: " + Animation._getAnimationInfo(propertyAnimation) + "...", Trace.categories.Animation);
|
||||
}
|
||||
|
||||
if (propertyAnimation.target === null || propertyAnimation.target === undefined) {
|
||||
@@ -546,8 +547,8 @@ export class Animation extends AnimationBase {
|
||||
animators[i].setInterpolator(propertyAnimation.curve);
|
||||
}
|
||||
|
||||
if (traceEnabled()) {
|
||||
traceWrite("Animator created: " + animators[i], traceCategories.Animation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("Animator created: " + animators[i], Trace.categories.Animation);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
/**
|
||||
* @module "ui/animation"
|
||||
*/ /** */
|
||||
|
||||
import { View, Color } from "../core/view";
|
||||
import { View } from "../core/view";
|
||||
import { Color } from "../../color";
|
||||
import { PercentLength } from "../styling/style-properties";
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,9 +7,9 @@ import { View } from "../core/view";
|
||||
|
||||
// Requires
|
||||
import {
|
||||
AnimationBase, Properties, CubicBezierAnimationCurve,
|
||||
traceWrite, traceEnabled, traceCategories, traceType
|
||||
AnimationBase, Properties, CubicBezierAnimationCurve
|
||||
} from "./animation-common";
|
||||
import { Trace } from "../../trace";
|
||||
import {
|
||||
opacityProperty, backgroundColorProperty, rotateProperty, rotateXProperty, rotateYProperty,
|
||||
translateXProperty, translateYProperty, scaleXProperty, scaleYProperty,
|
||||
@@ -167,12 +167,12 @@ export class Animation extends AnimationBase {
|
||||
}
|
||||
|
||||
if (!playSequentially) {
|
||||
if (traceEnabled()) {
|
||||
traceWrite("Non-merged Property Animations: " + this._propertyAnimations.length, traceCategories.Animation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("Non-merged Property Animations: " + this._propertyAnimations.length, Trace.categories.Animation);
|
||||
}
|
||||
this._mergedPropertyAnimations = Animation._mergeAffineTransformAnimations(this._propertyAnimations);
|
||||
if (traceEnabled()) {
|
||||
traceWrite("Merged Property Animations: " + this._mergedPropertyAnimations.length, traceCategories.Animation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("Merged Property Animations: " + this._mergedPropertyAnimations.length, Trace.categories.Animation);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -200,14 +200,14 @@ export class Animation extends AnimationBase {
|
||||
}
|
||||
|
||||
if (that._cancelledAnimations > 0 && (that._cancelledAnimations + that._finishedAnimations) === that._mergedPropertyAnimations.length) {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(that._cancelledAnimations + " animations cancelled.", traceCategories.Animation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(that._cancelledAnimations + " animations cancelled.", Trace.categories.Animation);
|
||||
}
|
||||
that._rejectAnimationFinishedPromise();
|
||||
}
|
||||
else if (that._finishedAnimations === that._mergedPropertyAnimations.length) {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(that._finishedAnimations + " animations finished.", traceCategories.Animation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(that._finishedAnimations + " animations finished.", Trace.categories.Animation);
|
||||
}
|
||||
that._resolveAnimationFinishedPromise();
|
||||
}
|
||||
@@ -232,7 +232,7 @@ export class Animation extends AnimationBase {
|
||||
|
||||
public cancel(): void {
|
||||
if (!this.isPlaying) {
|
||||
traceWrite("Animation is not currently playing.", traceCategories.Animation, traceType.warn);
|
||||
Trace.write("Animation is not currently playing.", Trace.categories.Animation, Trace.messageType.warn);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -256,8 +256,8 @@ export class Animation extends AnimationBase {
|
||||
return (cancelled?: boolean) => {
|
||||
|
||||
if (cancelled && finishedCallback) {
|
||||
if (traceEnabled()) {
|
||||
traceWrite("Animation " + (index - 1).toString() + " was cancelled. Will skip the rest of animations and call finishedCallback(true).", traceCategories.Animation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("Animation " + (index - 1).toString() + " was cancelled. Will skip the rest of animations and call finishedCallback(true).", Trace.categories.Animation);
|
||||
}
|
||||
finishedCallback(cancelled);
|
||||
|
||||
@@ -664,12 +664,12 @@ export class Animation extends AnimationBase {
|
||||
iterations: propertyAnimations[i].iterations,
|
||||
curve: propertyAnimations[i].curve
|
||||
};
|
||||
if (traceEnabled()) {
|
||||
traceWrite("Curve: " + propertyAnimations[i].curve, traceCategories.Animation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("Curve: " + propertyAnimations[i].curve, Trace.categories.Animation);
|
||||
}
|
||||
newTransformAnimation.value[propertyAnimations[i].property] = propertyAnimations[i].value;
|
||||
if (traceEnabled()) {
|
||||
traceWrite("Created new transform animation: " + Animation._getAnimationInfo(newTransformAnimation), traceCategories.Animation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("Created new transform animation: " + Animation._getAnimationInfo(newTransformAnimation), Trace.categories.Animation);
|
||||
}
|
||||
|
||||
// Merge all compatible affine transform animations to the right into this new animation.
|
||||
@@ -677,8 +677,8 @@ export class Animation extends AnimationBase {
|
||||
if (j < length) {
|
||||
for (; j < length; j++) {
|
||||
if (Animation._canBeMerged(propertyAnimations[i], propertyAnimations[j])) {
|
||||
if (traceEnabled()) {
|
||||
traceWrite("Merging animations: " + Animation._getAnimationInfo(newTransformAnimation) + " + " + Animation._getAnimationInfo(propertyAnimations[j]) + ";", traceCategories.Animation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("Merging animations: " + Animation._getAnimationInfo(newTransformAnimation) + " + " + Animation._getAnimationInfo(propertyAnimations[j]) + ";", Trace.categories.Animation);
|
||||
}
|
||||
newTransformAnimation.value[propertyAnimations[j].property] = propertyAnimations[j].value;
|
||||
// Mark that it has been merged so we can skip it on our outer loop.
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
/**
|
||||
* @module "ui/animation/keyframe-animation"
|
||||
*/ /** */
|
||||
|
||||
import { View } from "../core/view";
|
||||
|
||||
export declare const ANIMATION_PROPERTIES;
|
||||
|
||||
@@ -8,11 +8,12 @@ import {
|
||||
KeyframeAnimation as KeyframeAnimationDefinition,
|
||||
} from "./keyframe-animation";
|
||||
|
||||
import { View, Color } from "../core/view";
|
||||
import { View } from "../core/view";
|
||||
import { Color } from "../../color";
|
||||
|
||||
import { AnimationCurve } from "../enums";
|
||||
|
||||
import { write as traceWrite, categories as traceCategories, messageType as traceType } from "../../trace";
|
||||
import { Trace } from "../../trace";
|
||||
|
||||
// Types.
|
||||
import { unsetValue } from "../core/properties";
|
||||
@@ -148,7 +149,7 @@ export class KeyframeAnimation implements KeyframeAnimationDefinition {
|
||||
|
||||
public cancel() {
|
||||
if (!this.isPlaying) {
|
||||
traceWrite("Keyframe animation is already playing.", traceCategories.Animation, traceType.warn);
|
||||
Trace.write("Keyframe animation is already playing.", Trace.categories.Animation, Trace.messageType.warn);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -169,7 +170,7 @@ export class KeyframeAnimation implements KeyframeAnimationDefinition {
|
||||
|
||||
public play(view: View): Promise<void> {
|
||||
if (this._isPlaying) {
|
||||
traceWrite("Keyframe animation is already playing.", traceCategories.Animation, traceType.warn);
|
||||
Trace.write("Keyframe animation is already playing.", Trace.categories.Animation, Trace.messageType.warn);
|
||||
|
||||
return new Promise<void>(resolve => {
|
||||
resolve();
|
||||
@@ -262,9 +263,9 @@ export class KeyframeAnimation implements KeyframeAnimationDefinition {
|
||||
animation.play(isLastIteration).then(() => {
|
||||
this.animate(view, index + 1, iterations);
|
||||
}, (error: any) => {
|
||||
traceWrite(typeof error === "string" ? error : error.message, traceCategories.Animation, traceType.warn);
|
||||
Trace.write(typeof error === "string" ? error : error.message, Trace.categories.Animation, Trace.messageType.warn);
|
||||
}).catch((error: any) => {
|
||||
traceWrite(typeof error === "string" ? error : error.message, traceCategories.Animation, traceType.warn);
|
||||
Trace.write(typeof error === "string" ? error : error.message, Trace.categories.Animation, Trace.messageType.warn);
|
||||
}); // tslint:disable-line
|
||||
}
|
||||
}
|
||||
|
||||
7
nativescript-core/ui/border/border.d.ts
vendored
7
nativescript-core/ui/border/border.d.ts
vendored
@@ -1,9 +1,4 @@
|
||||
/**
|
||||
* Contains the Border class, which represents a UI border component.
|
||||
* @module "ui/animation/keyframe-animation"
|
||||
*/ /** */
|
||||
|
||||
import { ContentView } from "../content-view";
|
||||
import { ContentView } from "../content-view";
|
||||
|
||||
/**
|
||||
* Represents a UI border component.
|
||||
|
||||
@@ -8,8 +8,9 @@ import { TextTransform } from "../text-base";
|
||||
import * as application from "../../application";
|
||||
import { ImageSource } from "../../image-source";
|
||||
import { ad, isFontIconURI, layout, RESOURCE_PREFIX } from "../../utils/utils";
|
||||
import { Color, CSSType } from "../core/view";
|
||||
import { Frame, View } from "../frame";
|
||||
import { CSSType, View } from "../core/view";
|
||||
import { Color } from "../../color";
|
||||
import { Frame } from "../frame";
|
||||
import { Font } from "../styling/font";
|
||||
import {
|
||||
getIconSpecSize, itemsProperty, selectedIndexProperty, TabNavigationBase, tabStripProperty
|
||||
@@ -17,7 +18,7 @@ import {
|
||||
import { getTransformedText } from "../text-base";
|
||||
|
||||
// TODO: Impl trace
|
||||
// import { isEnabled as traceEnabled, write as traceWrite } from "../../../trace";
|
||||
// import { Trace } from "../../../trace";
|
||||
|
||||
const PRIMARY_COLOR = "colorPrimary";
|
||||
const DEFAULT_ELEVATION = 8;
|
||||
@@ -278,8 +279,8 @@ export class BottomNavigation extends TabNavigationBase {
|
||||
|
||||
public createNativeView() {
|
||||
initializeNativeClasses();
|
||||
// if (traceEnabled()) {
|
||||
// traceWrite("BottomNavigation._createUI(" + this + ");", traceCategory);
|
||||
// if (Trace.isEnabled()) {
|
||||
// Trace.write("BottomNavigation._createUI(" + this + ");", traceCategory);
|
||||
// }
|
||||
|
||||
const context: android.content.Context = this._context;
|
||||
@@ -848,8 +849,8 @@ export class BottomNavigation extends TabNavigationBase {
|
||||
[selectedIndexProperty.setNative](value: number) {
|
||||
// const smoothScroll = false;
|
||||
|
||||
// if (traceEnabled()) {
|
||||
// traceWrite("TabView this._viewPager.setCurrentItem(" + value + ", " + smoothScroll + ");", traceCategory);
|
||||
// if (Trace.isEnabled()) {
|
||||
// Trace.write("TabView this._viewPager.setCurrentItem(" + value + ", " + smoothScroll + ");", traceCategory);
|
||||
// }
|
||||
|
||||
if (this.tabStrip) {
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
/**
|
||||
* Contains the BottomNavigation class, which represents a tab navigation widget with static tabs at the bottom.
|
||||
* @module "ui/tab-navigation/bottom-navigation"
|
||||
*/ /** */
|
||||
|
||||
import { TabNavigationBase } from "../tab-navigation-base/tab-navigation-base";
|
||||
import { TabNavigationBase } from "../tab-navigation-base/tab-navigation-base";
|
||||
import { TabContentItem } from "../tab-navigation-base/tab-content-item";
|
||||
import { TabStrip } from "../tab-navigation-base/tab-strip";
|
||||
import { Property, CoercibleProperty, EventData } from "../core/view";
|
||||
import { Property, CoercibleProperty } from "../core/properties";
|
||||
import { EventData } from "../../data/observable";
|
||||
|
||||
/**
|
||||
* Defines the data for the TabView.selectedIndexChanged event.
|
||||
|
||||
@@ -110,8 +110,8 @@ class UITabBarControllerDelegateImpl extends NSObject implements UITabBarControl
|
||||
|
||||
public tabBarControllerShouldSelectViewController(tabBarController: UITabBarController, viewController: UIViewController): boolean {
|
||||
// TODO
|
||||
// if (traceEnabled()) {
|
||||
// traceWrite("TabView.delegate.SHOULD_select(" + tabBarController + ", " + viewController + ");", traceCategories.Debug);
|
||||
// if (Trace.isEnabled()) {
|
||||
// Trace.write("TabView.delegate.SHOULD_select(" + tabBarController + ", " + viewController + ");", Trace.categories.Debug);
|
||||
// }
|
||||
|
||||
let owner = this._owner.get();
|
||||
@@ -145,8 +145,8 @@ class UITabBarControllerDelegateImpl extends NSObject implements UITabBarControl
|
||||
|
||||
public tabBarControllerDidSelectViewController(tabBarController: UITabBarController, viewController: UIViewController): void {
|
||||
// TODO
|
||||
// if (traceEnabled()) {
|
||||
// traceWrite("TabView.delegate.DID_select(" + tabBarController + ", " + viewController + ");", traceCategories.Debug);
|
||||
// if (Trace.isEnabled()) {
|
||||
// Trace.write("TabView.delegate.DID_select(" + tabBarController + ", " + viewController + ");", Trace.categories.Debug);
|
||||
// }
|
||||
|
||||
const owner = this._owner.get();
|
||||
@@ -172,8 +172,8 @@ class UINavigationControllerDelegateImpl extends NSObject implements UINavigatio
|
||||
|
||||
navigationControllerWillShowViewControllerAnimated(navigationController: UINavigationController, viewController: UIViewController, animated: boolean): void {
|
||||
// TODO
|
||||
// if (traceEnabled()) {
|
||||
// traceWrite("TabView.moreNavigationController.WILL_show(" + navigationController + ", " + viewController + ", " + animated + ");", traceCategories.Debug);
|
||||
// if (Trace.isEnabled()) {
|
||||
// Trace.write("TabView.moreNavigationController.WILL_show(" + navigationController + ", " + viewController + ", " + animated + ");", Trace.categories.Debug);
|
||||
// }
|
||||
|
||||
let owner = this._owner.get();
|
||||
@@ -187,8 +187,8 @@ class UINavigationControllerDelegateImpl extends NSObject implements UINavigatio
|
||||
|
||||
navigationControllerDidShowViewControllerAnimated(navigationController: UINavigationController, viewController: UIViewController, animated: boolean): void {
|
||||
// TODO
|
||||
// if (traceEnabled()) {
|
||||
// traceWrite("TabView.moreNavigationController.DID_show(" + navigationController + ", " + viewController + ", " + animated + ");", traceCategories.Debug);
|
||||
// if (Trace.isEnabled()) {
|
||||
// Trace.write("TabView.moreNavigationController.DID_show(" + navigationController + ", " + viewController + ", " + animated + ");", Trace.categories.Debug);
|
||||
// }
|
||||
// We don't need Edit button in More screen.
|
||||
navigationController.navigationBar.topItem.rightBarButtonItem = null;
|
||||
@@ -454,15 +454,15 @@ export class BottomNavigation extends TabNavigationBase {
|
||||
public _onViewControllerShown(viewController: UIViewController) {
|
||||
// This method could be called with the moreNavigationController or its list controller, so we have to check.
|
||||
// TODO
|
||||
// if (traceEnabled()) {
|
||||
// traceWrite("TabView._onViewControllerShown(" + viewController + ");", traceCategories.Debug);
|
||||
// if (Trace.isEnabled()) {
|
||||
// Trace.write("TabView._onViewControllerShown(" + viewController + ");", Trace.categories.Debug);
|
||||
// }
|
||||
if (this._ios.viewControllers && this._ios.viewControllers.containsObject(viewController)) {
|
||||
this.selectedIndex = this._ios.viewControllers.indexOfObject(viewController);
|
||||
} else {
|
||||
// TODO
|
||||
// if (traceEnabled()) {
|
||||
// traceWrite("TabView._onViewControllerShown: viewController is not one of our viewControllers", traceCategories.Debug);
|
||||
// if (Trace.isEnabled()) {
|
||||
// Trace.write("TabView._onViewControllerShown: viewController is not one of our viewControllers", Trace.categories.Debug);
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -470,8 +470,8 @@ export class BottomNavigation extends TabNavigationBase {
|
||||
private _actionBarHiddenByTabView: boolean;
|
||||
public _handleTwoNavigationBars(backToMoreWillBeVisible: boolean) {
|
||||
// TODO
|
||||
// if (traceEnabled()) {
|
||||
// traceWrite(`TabView._handleTwoNavigationBars(backToMoreWillBeVisible: ${backToMoreWillBeVisible})`, traceCategories.Debug);
|
||||
// if (Trace.isEnabled()) {
|
||||
// Trace.write(`TabView._handleTwoNavigationBars(backToMoreWillBeVisible: ${backToMoreWillBeVisible})`, Trace.categories.Debug);
|
||||
// }
|
||||
|
||||
// The "< Back" and "< More" navigation bars should not be visible simultaneously.
|
||||
@@ -489,8 +489,8 @@ export class BottomNavigation extends TabNavigationBase {
|
||||
this._actionBarHiddenByTabView = true;
|
||||
|
||||
// TODO
|
||||
// if (traceEnabled()) {
|
||||
// traceWrite(`TabView hid action bar`, traceCategories.Debug);
|
||||
// if (Trace.isEnabled()) {
|
||||
// Trace.write(`TabView hid action bar`, Trace.categories.Debug);
|
||||
// }
|
||||
return;
|
||||
}
|
||||
@@ -502,8 +502,8 @@ export class BottomNavigation extends TabNavigationBase {
|
||||
this._actionBarHiddenByTabView = undefined;
|
||||
|
||||
// TODO
|
||||
// if (traceEnabled()) {
|
||||
// traceWrite(`TabView restored action bar`, traceCategories.Debug);
|
||||
// if (Trace.isEnabled()) {
|
||||
// Trace.write(`TabView restored action bar`, Trace.categories.Debug);
|
||||
// }
|
||||
return;
|
||||
}
|
||||
@@ -729,8 +729,8 @@ export class BottomNavigation extends TabNavigationBase {
|
||||
|
||||
[selectedIndexProperty.setNative](value: number) {
|
||||
// TODO
|
||||
// if (traceEnabled()) {
|
||||
// traceWrite("TabView._onSelectedIndexPropertyChangedSetNativeValue(" + value + ")", traceCategories.Debug);
|
||||
// if (Trace.isEnabled()) {
|
||||
// Trace.write("TabView._onSelectedIndexPropertyChangedSetNativeValue(" + value + ")", Trace.categories.Debug);
|
||||
// }
|
||||
|
||||
if (value > -1) {
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
/**
|
||||
* @module "ui/builder/binding-builder"
|
||||
* @private
|
||||
*/ /** */
|
||||
|
||||
//@private
|
||||
//@private
|
||||
export module bindingConstants {
|
||||
export const sourceProperty: string;
|
||||
export const targetProperty: string;
|
||||
|
||||
6
nativescript-core/ui/builder/builder.d.ts
vendored
6
nativescript-core/ui/builder/builder.d.ts
vendored
@@ -1,8 +1,4 @@
|
||||
/**
|
||||
* @module "ui/builder"
|
||||
*/ /** */
|
||||
|
||||
import { View, Template, KeyedTemplate } from "../core/view";
|
||||
import { View, Template, KeyedTemplate } from "../core/view";
|
||||
import { Page } from "../page";
|
||||
import { NavigationEntry } from "../frame";
|
||||
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
/**
|
||||
* @module "ui/builder/component-builder"
|
||||
*/ /** */
|
||||
|
||||
import { View } from "../../core/view";
|
||||
|
||||
export interface ComponentModule {
|
||||
|
||||
@@ -1,5 +1 @@
|
||||
/**
|
||||
* @module "ui/builder/module-name-sanitizer"
|
||||
*/ /** */
|
||||
|
||||
export function sanitizeModuleName(moduleName: string, removeExtension?: boolean): string;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { Button as ButtonDefinition } from ".";
|
||||
import { TextBase, booleanConverter, CSSType } from "../text-base";
|
||||
import { TextBase } from "../text-base";
|
||||
import { CSSType } from "../core/view";
|
||||
import { booleanConverter } from "../core/view-base";
|
||||
|
||||
@CSSType("Button")
|
||||
export abstract class ButtonBase extends TextBase implements ButtonDefinition {
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
/**
|
||||
* Contains the Button class, which represents a standard button widget.
|
||||
* @module "ui/button"
|
||||
*/ /** */
|
||||
|
||||
import { TextBase, EventData } from "../text-base";
|
||||
import { TextBase } from "../text-base";
|
||||
import { EventData } from "../../data/observable";
|
||||
|
||||
/**
|
||||
* Represents a standard Button widget.
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"name": "button",
|
||||
"main": "button",
|
||||
"types": "button.d.ts"
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/**
|
||||
* View that can host another view.
|
||||
* @module "ui/content-view"
|
||||
*/ /** */
|
||||
|
||||
import { View, AddChildFromBuilder } from "../core/view";
|
||||
|
||||
export * from "../core/view";
|
||||
|
||||
/**
|
||||
* Represents a View that has a single child - content.
|
||||
* The View itself does not have visual representation and serves as a placeholder for its content in the logical tree.
|
||||
*/
|
||||
export class ContentView extends View implements AddChildFromBuilder {
|
||||
/**
|
||||
* Gets or sets the single child of the view.
|
||||
*/
|
||||
content: View;
|
||||
|
||||
//@private
|
||||
/**
|
||||
* Called when the content property has changed.
|
||||
* @private
|
||||
* @param oldView The previous content.
|
||||
* @param newView The new content.
|
||||
*/
|
||||
_onContentChanged(oldView: View, newView: View);
|
||||
//@endprivate
|
||||
|
||||
_addChildFromBuilder(name: string, value: any): void;
|
||||
|
||||
layoutView: View;
|
||||
}
|
||||
@@ -1,9 +1,18 @@
|
||||
import { ContentView as ContentViewDefinition } from ".";
|
||||
import { View, CustomLayoutView, AddChildFromBuilder, layout, isIOS } from "../core/view";
|
||||
import { View, CustomLayoutView, AddChildFromBuilder } from "../core/view";
|
||||
import { layout } from "../../utils/utils";
|
||||
import { isIOS } from "../../platform";
|
||||
import { ContentView as ContentViewDefinition } from ".";
|
||||
|
||||
/**
|
||||
* Represents a View that has a single child - content.
|
||||
* The View itself does not have visual representation and serves as a placeholder for its content in the logical tree.
|
||||
*/
|
||||
export class ContentView extends CustomLayoutView implements ContentViewDefinition, AddChildFromBuilder {
|
||||
private _content: View;
|
||||
|
||||
/**
|
||||
* Gets or sets the single child of the view.
|
||||
*/
|
||||
get content(): View {
|
||||
return this._content;
|
||||
}
|
||||
@@ -47,6 +56,13 @@ export class ContentView extends CustomLayoutView implements ContentViewDefiniti
|
||||
return this._content ? 1 : 0;
|
||||
}
|
||||
|
||||
//@private
|
||||
/**
|
||||
* Called when the content property has changed.
|
||||
* @private
|
||||
* @param oldView The previous content.
|
||||
* @param newView The new content.
|
||||
*/
|
||||
public _onContentChanged(oldView: View, newView: View) {
|
||||
//
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"name": "content-view",
|
||||
"main": "content-view",
|
||||
"types": "content-view.d.ts"
|
||||
}
|
||||
71
nativescript-core/ui/core/bindable/bindable.d.ts
vendored
71
nativescript-core/ui/core/bindable/bindable.d.ts
vendored
@@ -1,71 +0,0 @@
|
||||
/**
|
||||
* @module "ui/core/bindable"
|
||||
*/ /** */
|
||||
|
||||
import { ViewBase } from "../view-base";
|
||||
import { Observable, WrappedValue, PropertyChangeData, EventData } from "../../../data/observable";
|
||||
import {
|
||||
isEnabled as traceEnabled,
|
||||
write as traceWrite,
|
||||
error as traceError,
|
||||
categories as traceCategories,
|
||||
notifyEvent as traceNotifyEvent,
|
||||
messageType as traceMessageType,
|
||||
isCategorySet
|
||||
} from "../../../trace";
|
||||
|
||||
export {
|
||||
Observable, WrappedValue, PropertyChangeData, EventData,
|
||||
traceEnabled, traceWrite, traceError, traceCategories, traceNotifyEvent,
|
||||
traceMessageType, isCategorySet
|
||||
};
|
||||
|
||||
/**
|
||||
* The options object used in the Bindable.bind method.
|
||||
*/
|
||||
export interface BindingOptions {
|
||||
/**
|
||||
* The property name of the source object (typically the ViewModel) to bind to.
|
||||
*/
|
||||
sourceProperty: string;
|
||||
/**
|
||||
* The property name of the target object (that is the Bindable instance) to bind the source property to.
|
||||
*/
|
||||
targetProperty: string;
|
||||
/**
|
||||
* True to establish a two-way binding, false otherwise. A two-way binding will synchronize both the source and the target property values regardless of which one initiated the change.
|
||||
*/
|
||||
twoWay?: boolean;
|
||||
/**
|
||||
* An expression used for calculations (convertions) based on the value of the property.
|
||||
*/
|
||||
expression?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* An interface which defines methods need to create binding value converter.
|
||||
*/
|
||||
export interface ValueConverter {
|
||||
/**
|
||||
* A method that will be executed when a value (of the binding property) should be converted to the observable model.
|
||||
* For example: user types in a text field, but our business logic requires to store data in a different manner (e.g. in lower case).
|
||||
* @param params - An array of parameters where first element is the value of the property and next elements are parameters send to converter.
|
||||
*/
|
||||
toModel: (...params: any[]) => any;
|
||||
/**
|
||||
* A method that will be executed when a value should be converted to the UI view. For example we have a date object which should be displayed to the end user in a specific date format.
|
||||
* @param params - An array of parameters where first element is the value of the property and next elements are parameters send to converter.
|
||||
*/
|
||||
toView: (...params: any[]) => any;
|
||||
}
|
||||
|
||||
export class Binding {
|
||||
constructor(target: ViewBase, options: BindingOptions);
|
||||
public bind(source: Object): void;
|
||||
public unbind();
|
||||
public sourceIsBindingContext: boolean;
|
||||
public updateTwoWay(value: any);
|
||||
}
|
||||
|
||||
export function getEventOrGestureName(name: string): string;
|
||||
export function isEventOrGesture(name: string, view: ViewBase): boolean;
|
||||
@@ -1,5 +1,4 @@
|
||||
// Types
|
||||
import { BindingOptions } from ".";
|
||||
import { ViewBase } from "../view-base";
|
||||
|
||||
// Requires
|
||||
@@ -9,13 +8,7 @@ import { addWeakEventListener, removeWeakEventListener } from "../weak-event-lis
|
||||
import { bindingConstants, parentsRegex } from "../../builder/binding-builder";
|
||||
import { escapeRegexSymbols } from "../../../utils/utils";
|
||||
import {
|
||||
isEnabled as traceEnabled,
|
||||
write as traceWrite,
|
||||
error as traceError,
|
||||
categories as traceCategories,
|
||||
notifyEvent as traceNotifyEvent,
|
||||
isCategorySet,
|
||||
messageType as traceMessageType
|
||||
Trace
|
||||
} from "../../../trace";
|
||||
import * as types from "../../../utils/types";
|
||||
import * as bindableResources from "./bindable-resources";
|
||||
@@ -59,6 +52,45 @@ function getProperties(property: string): Array<string> {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* The options object used in the Bindable.bind method.
|
||||
*/
|
||||
export interface BindingOptions {
|
||||
/**
|
||||
* The property name of the source object (typically the ViewModel) to bind to.
|
||||
*/
|
||||
sourceProperty: string;
|
||||
/**
|
||||
* The property name of the target object (that is the Bindable instance) to bind the source property to.
|
||||
*/
|
||||
targetProperty: string;
|
||||
/**
|
||||
* True to establish a two-way binding, false otherwise. A two-way binding will synchronize both the source and the target property values regardless of which one initiated the change.
|
||||
*/
|
||||
twoWay?: boolean;
|
||||
/**
|
||||
* An expression used for calculations (convertions) based on the value of the property.
|
||||
*/
|
||||
expression?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* An interface which defines methods need to create binding value converter.
|
||||
*/
|
||||
export interface ValueConverter {
|
||||
/**
|
||||
* A method that will be executed when a value (of the binding property) should be converted to the observable model.
|
||||
* For example: user types in a text field, but our business logic requires to store data in a different manner (e.g. in lower case).
|
||||
* @param params - An array of parameters where first element is the value of the property and next elements are parameters send to converter.
|
||||
*/
|
||||
toModel: (...params: any[]) => any;
|
||||
/**
|
||||
* A method that will be executed when a value should be converted to the UI view. For example we have a date object which should be displayed to the end user in a specific date format.
|
||||
* @param params - An array of parameters where first element is the value of the property and next elements are parameters send to converter.
|
||||
*/
|
||||
toView: (...params: any[]) => any;
|
||||
}
|
||||
|
||||
export function getEventOrGestureName(name: string): string {
|
||||
return name.indexOf("on") === 0 ? name.substr(2, name.length - 2) : name;
|
||||
}
|
||||
@@ -348,7 +380,7 @@ export class Binding {
|
||||
|
||||
let expressionValue = this._getExpressionValue(updateExpression, true, changedModel);
|
||||
if (expressionValue instanceof Error) {
|
||||
traceWrite((<Error>expressionValue).message, traceCategories.Binding, traceMessageType.error);
|
||||
Trace.write((<Error>expressionValue).message, Trace.categories.Binding, Trace.messageType.error);
|
||||
}
|
||||
|
||||
newValue = expressionValue;
|
||||
@@ -410,7 +442,7 @@ export class Binding {
|
||||
if (this.options.expression) {
|
||||
const expressionValue = this._getExpressionValue(this.options.expression, false, undefined);
|
||||
if (expressionValue instanceof Error) {
|
||||
traceWrite(expressionValue.message, traceCategories.Binding, traceMessageType.error);
|
||||
Trace.write(expressionValue.message, Trace.categories.Binding, Trace.messageType.error);
|
||||
} else {
|
||||
this.updateTarget(expressionValue);
|
||||
}
|
||||
@@ -517,7 +549,7 @@ export class Binding {
|
||||
changedModel[bc.bindingValueKey] = this.source ? this.source.get() : undefined;
|
||||
let expressionValue = this._getExpressionValue(this.options.expression, false, changedModel);
|
||||
if (expressionValue instanceof Error) {
|
||||
traceWrite((<Error>expressionValue).message, traceCategories.Binding, traceMessageType.error);
|
||||
Trace.write((<Error>expressionValue).message, Trace.categories.Binding, Trace.messageType.error);
|
||||
}
|
||||
else {
|
||||
return expressionValue;
|
||||
@@ -534,7 +566,7 @@ export class Binding {
|
||||
this.sourceOptions.property in sourceOptionsInstance) {
|
||||
return sourceOptionsInstance[this.sourceOptions.property];
|
||||
} else {
|
||||
traceWrite("Property: '" + this.sourceOptions.property + "' is invalid or does not exist. SourceProperty: '" + this.options.sourceProperty + "'", traceCategories.Binding, traceMessageType.error);
|
||||
Trace.write("Property: '" + this.sourceOptions.property + "' is invalid or does not exist. SourceProperty: '" + this.options.sourceProperty + "'", Trace.categories.Binding, Trace.messageType.error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -635,9 +667,9 @@ export class Binding {
|
||||
optionsInstance[options.property] = value;
|
||||
}
|
||||
} catch (ex) {
|
||||
traceWrite("Binding error while setting property " + options.property + " of " + optionsInstance + ": " + ex,
|
||||
traceCategories.Binding,
|
||||
traceMessageType.error);
|
||||
Trace.write("Binding error while setting property " + options.property + " of " + optionsInstance + ": " + ex,
|
||||
Trace.categories.Binding,
|
||||
Trace.messageType.error);
|
||||
}
|
||||
|
||||
this.updating = false;
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"name": "bindable",
|
||||
"main": "bindable",
|
||||
"types": "bindable.d.ts"
|
||||
}
|
||||
@@ -1,8 +1,4 @@
|
||||
/**
|
||||
* @module "ui/core/control-state-change"
|
||||
*/ /** */
|
||||
|
||||
/**
|
||||
* An utility class used for supporting styling infrastructure.
|
||||
* WARNING: This class is intended for IOS only.
|
||||
*/
|
||||
|
||||
@@ -1,23 +1,55 @@
|
||||
import * as reduceCSSCalc from "reduce-css-calc";
|
||||
|
||||
// Definitions.
|
||||
import * as definitions from "../view-base";
|
||||
import { ViewBase } from "../view-base";
|
||||
|
||||
// Types.
|
||||
import { WrappedValue, PropertyChangeData } from "../../../data/observable";
|
||||
import {
|
||||
write as traceWrite,
|
||||
categories as traceCategories,
|
||||
messageType as traceMessageType,
|
||||
Trace
|
||||
} from "../../../trace";
|
||||
|
||||
import { Style } from "../../styling/style";
|
||||
|
||||
import { profile } from "../../../profiling";
|
||||
|
||||
/**
|
||||
* Value specifing that Property should be set to its initial value.
|
||||
*/
|
||||
export const unsetValue: any = new Object();
|
||||
|
||||
export interface PropertyOptions<T, U> {
|
||||
readonly name: string;
|
||||
readonly defaultValue?: U;
|
||||
readonly affectsLayout?: boolean;
|
||||
readonly equalityComparer?: (x: U, y: U) => boolean;
|
||||
readonly valueChanged?: (target: T, oldValue: U, newValue: U) => void;
|
||||
readonly valueConverter?: (value: string) => U;
|
||||
}
|
||||
|
||||
export interface CoerciblePropertyOptions<T, U> extends PropertyOptions<T, U> {
|
||||
readonly coerceValue: (t: T, u: U) => U;
|
||||
}
|
||||
|
||||
export interface CssPropertyOptions<T extends Style, U> extends PropertyOptions<T, U> {
|
||||
readonly cssName: string;
|
||||
}
|
||||
|
||||
export interface ShorthandPropertyOptions<P> {
|
||||
readonly name: string,
|
||||
readonly cssName: string;
|
||||
readonly converter: (value: string | P) => [CssProperty<any, any> | CssAnimationProperty<any, any>, any][],
|
||||
readonly getter: (this: Style) => string | P
|
||||
}
|
||||
|
||||
export interface CssAnimationPropertyOptions<T, U> {
|
||||
readonly name: string;
|
||||
readonly cssName?: string;
|
||||
readonly defaultValue?: U;
|
||||
readonly equalityComparer?: (x: U, y: U) => boolean;
|
||||
readonly valueChanged?: (target: T, oldValue: U, newValue: U) => void;
|
||||
readonly valueConverter?: (value: string) => U;
|
||||
}
|
||||
|
||||
let cssPropertyNames: string[] = [];
|
||||
let symbolPropertyMap = {};
|
||||
let cssSymbolPropertyMap = {};
|
||||
@@ -132,7 +164,7 @@ function getPropertiesFromMap(map): Property<any, any>[] | CssProperty<any, any>
|
||||
return props;
|
||||
}
|
||||
|
||||
export class Property<T extends ViewBase, U> implements TypedPropertyDescriptor<U>, definitions.Property<T, U> {
|
||||
export class Property<T extends ViewBase, U> implements TypedPropertyDescriptor<U>, Property<T, U> {
|
||||
private registered: boolean;
|
||||
|
||||
public readonly name: string;
|
||||
@@ -152,7 +184,7 @@ export class Property<T extends ViewBase, U> implements TypedPropertyDescriptor<
|
||||
public enumerable: boolean = true;
|
||||
public configurable: boolean = true;
|
||||
|
||||
constructor(options: definitions.PropertyOptions<T, U>) {
|
||||
constructor(options: PropertyOptions<T, U>) {
|
||||
const propertyName = options.name;
|
||||
this.name = propertyName;
|
||||
|
||||
@@ -302,10 +334,10 @@ export class Property<T extends ViewBase, U> implements TypedPropertyDescriptor<
|
||||
}
|
||||
Property.prototype.isStyleProperty = false;
|
||||
|
||||
export class CoercibleProperty<T extends ViewBase, U> extends Property<T, U> implements definitions.CoercibleProperty<T, U> {
|
||||
export class CoercibleProperty<T extends ViewBase, U> extends Property<T, U> implements CoercibleProperty<T, U> {
|
||||
public readonly coerce: (target: T) => void;
|
||||
|
||||
constructor(options: definitions.CoerciblePropertyOptions<T, U>) {
|
||||
constructor(options: CoerciblePropertyOptions<T, U>) {
|
||||
super(options);
|
||||
|
||||
const propertyName = options.name;
|
||||
@@ -415,11 +447,11 @@ export class CoercibleProperty<T extends ViewBase, U> extends Property<T, U> imp
|
||||
}
|
||||
}
|
||||
|
||||
export class InheritedProperty<T extends ViewBase, U> extends Property<T, U> implements definitions.InheritedProperty<T, U> {
|
||||
export class InheritedProperty<T extends ViewBase, U> extends Property<T, U> implements InheritedProperty<T, U> {
|
||||
public readonly sourceKey: symbol;
|
||||
public readonly setInheritedValue: (value: U) => void;
|
||||
|
||||
constructor(options: definitions.PropertyOptions<T, U>) {
|
||||
constructor(options: PropertyOptions<T, U>) {
|
||||
super(options);
|
||||
const name = options.name;
|
||||
const key = this.key;
|
||||
@@ -488,7 +520,7 @@ export class InheritedProperty<T extends ViewBase, U> extends Property<T, U> imp
|
||||
}
|
||||
}
|
||||
|
||||
export class CssProperty<T extends Style, U> implements definitions.CssProperty<T, U> {
|
||||
export class CssProperty<T extends Style, U> implements CssProperty<T, U> {
|
||||
private registered: boolean;
|
||||
|
||||
public readonly name: string;
|
||||
@@ -507,7 +539,7 @@ export class CssProperty<T extends Style, U> implements definitions.CssProperty<
|
||||
public readonly defaultValueKey: symbol;
|
||||
public readonly defaultValue: U;
|
||||
|
||||
constructor(options: definitions.CssPropertyOptions<T, U>) {
|
||||
constructor(options: CssPropertyOptions<T, U>) {
|
||||
const propertyName = options.name;
|
||||
this.name = propertyName;
|
||||
|
||||
@@ -545,7 +577,7 @@ export class CssProperty<T extends Style, U> implements definitions.CssProperty<
|
||||
function setLocalValue(this: T, newValue: U | string): void {
|
||||
const view = this.viewRef.get();
|
||||
if (!view) {
|
||||
traceWrite(`${newValue} not set to view because ".viewRef" is cleared`, traceCategories.Style, traceMessageType.warn);
|
||||
Trace.write(`${newValue} not set to view because ".viewRef" is cleared`, Trace.categories.Style, Trace.messageType.warn);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -619,7 +651,7 @@ export class CssProperty<T extends Style, U> implements definitions.CssProperty<
|
||||
function setCssValue(this: T, newValue: U | string): void {
|
||||
const view = this.viewRef.get();
|
||||
if (!view) {
|
||||
traceWrite(`${newValue} not set to view because ".viewRef" is cleared`, traceCategories.Style, traceMessageType.warn);
|
||||
Trace.write(`${newValue} not set to view because ".viewRef" is cleared`, Trace.categories.Style, Trace.messageType.warn);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -736,7 +768,7 @@ export class CssProperty<T extends Style, U> implements definitions.CssProperty<
|
||||
}
|
||||
CssProperty.prototype.isStyleProperty = true;
|
||||
|
||||
export class CssAnimationProperty<T extends Style, U> implements definitions.CssAnimationProperty<T, U> {
|
||||
export class CssAnimationProperty<T extends Style, U> implements CssAnimationProperty<T, U> {
|
||||
public readonly name: string;
|
||||
public readonly cssName: string;
|
||||
public readonly cssLocalName: string;
|
||||
@@ -759,7 +791,7 @@ export class CssAnimationProperty<T extends Style, U> implements definitions.Css
|
||||
|
||||
public _valueConverter?: (value: string) => any;
|
||||
|
||||
constructor(options: definitions.CssAnimationPropertyOptions<T, U>) {
|
||||
constructor(options: CssAnimationPropertyOptions<T, U>) {
|
||||
const { valueConverter, equalityComparer, valueChanged, defaultValue } = options;
|
||||
const propertyName = options.name;
|
||||
this.name = propertyName;
|
||||
@@ -809,7 +841,7 @@ export class CssAnimationProperty<T extends Style, U> implements definitions.Css
|
||||
set(this: T, boxedValue: U | string) {
|
||||
const view = this.viewRef.get();
|
||||
if (!view) {
|
||||
traceWrite(`${boxedValue} not set to view because ".viewRef" is cleared`, traceCategories.Animation, traceMessageType.warn);
|
||||
Trace.write(`${boxedValue} not set to view because ".viewRef" is cleared`, Trace.categories.Animation, Trace.messageType.warn);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -912,7 +944,7 @@ export class CssAnimationProperty<T extends Style, U> implements definitions.Css
|
||||
public _initDefaultNativeValue(target: T): void {
|
||||
const view = target.viewRef.get();
|
||||
if (!view) {
|
||||
traceWrite(`_initDefaultNativeValue not executed to view because ".viewRef" is cleared`, traceCategories.Animation, traceMessageType.warn);
|
||||
Trace.write(`_initDefaultNativeValue not executed to view because ".viewRef" is cleared`, Trace.categories.Animation, Trace.messageType.warn);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -939,10 +971,10 @@ export class CssAnimationProperty<T extends Style, U> implements definitions.Css
|
||||
}
|
||||
CssAnimationProperty.prototype.isStyleProperty = true;
|
||||
|
||||
export class InheritedCssProperty<T extends Style, U> extends CssProperty<T, U> implements definitions.InheritedCssProperty<T, U> {
|
||||
export class InheritedCssProperty<T extends Style, U> extends CssProperty<T, U> implements InheritedCssProperty<T, U> {
|
||||
public setInheritedValue: (value: U) => void;
|
||||
|
||||
constructor(options: definitions.CssPropertyOptions<T, U>) {
|
||||
constructor(options: CssPropertyOptions<T, U>) {
|
||||
super(options);
|
||||
const propertyName = options.name;
|
||||
|
||||
@@ -964,7 +996,7 @@ export class InheritedCssProperty<T extends Style, U> extends CssProperty<T, U>
|
||||
const setFunc = (valueSource: ValueSource) => function (this: T, boxedValue: any): void {
|
||||
const view = this.viewRef.get();
|
||||
if (!view) {
|
||||
traceWrite(`${boxedValue} not set to view's property because ".viewRef" is cleared`, traceCategories.Style, traceMessageType.warn);
|
||||
Trace.write(`${boxedValue} not set to view's property because ".viewRef" is cleared`, Trace.categories.Style, Trace.messageType.warn);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1077,7 +1109,7 @@ export class InheritedCssProperty<T extends Style, U> extends CssProperty<T, U>
|
||||
}
|
||||
}
|
||||
|
||||
export class ShorthandProperty<T extends Style, P> implements definitions.ShorthandProperty<T, P> {
|
||||
export class ShorthandProperty<T extends Style, P> implements ShorthandProperty<T, P> {
|
||||
private registered: boolean;
|
||||
|
||||
public readonly key: symbol;
|
||||
@@ -1091,7 +1123,7 @@ export class ShorthandProperty<T extends Style, P> implements definitions.Shorth
|
||||
|
||||
public readonly sourceKey: symbol;
|
||||
|
||||
constructor(options: definitions.ShorthandPropertyOptions<P>) {
|
||||
constructor(options: ShorthandPropertyOptions<P>) {
|
||||
this.name = options.name;
|
||||
|
||||
const key = Symbol(this.name + ":propertyKey");
|
||||
@@ -1105,7 +1137,7 @@ export class ShorthandProperty<T extends Style, P> implements definitions.Shorth
|
||||
function setLocalValue(this: T, value: string | P): void {
|
||||
const view = this.viewRef.get();
|
||||
if (!view) {
|
||||
traceWrite(`setLocalValue not executed to view because ".viewRef" is cleared`, traceCategories.Animation, traceMessageType.warn);
|
||||
Trace.write(`setLocalValue not executed to view because ".viewRef" is cleared`, Trace.categories.Animation, Trace.messageType.warn);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1120,7 +1152,7 @@ export class ShorthandProperty<T extends Style, P> implements definitions.Shorth
|
||||
function setCssValue(this: T, value: string): void {
|
||||
const view = this.viewRef.get();
|
||||
if (!view) {
|
||||
traceWrite(`setCssValue not executed to view because ".viewRef" is cleared`, traceCategories.Animation, traceMessageType.warn);
|
||||
Trace.write(`setCssValue not executed to view because ".viewRef" is cleared`, Trace.categories.Animation, Trace.messageType.warn);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"name": "properties",
|
||||
"main": "properties",
|
||||
"types": "properties.d.ts"
|
||||
}
|
||||
165
nativescript-core/ui/core/properties/properties.d.ts
vendored
165
nativescript-core/ui/core/properties/properties.d.ts
vendored
@@ -1,165 +0,0 @@
|
||||
/**
|
||||
* @module "ui/core/properties"
|
||||
*/ /** */
|
||||
|
||||
import { ViewBase } from "../view-base";
|
||||
import { Style } from "../../styling/style";
|
||||
|
||||
export { Style };
|
||||
|
||||
/**
|
||||
* Value specifing that Property should be set to its initial value.
|
||||
*/
|
||||
export const unsetValue: any;
|
||||
|
||||
export interface PropertyOptions<T, U> {
|
||||
readonly name: string;
|
||||
readonly defaultValue?: U;
|
||||
readonly affectsLayout?: boolean;
|
||||
readonly equalityComparer?: (x: U, y: U) => boolean;
|
||||
readonly valueChanged?: (target: T, oldValue: U, newValue: U) => void;
|
||||
readonly valueConverter?: (value: string) => U;
|
||||
}
|
||||
|
||||
export interface CoerciblePropertyOptions<T, U> extends PropertyOptions<T, U> {
|
||||
readonly coerceValue: (t: T, u: U) => U;
|
||||
}
|
||||
|
||||
export interface CssPropertyOptions<T extends Style, U> extends PropertyOptions<T, U> {
|
||||
readonly cssName: string;
|
||||
}
|
||||
|
||||
export interface ShorthandPropertyOptions<P> {
|
||||
readonly name: string,
|
||||
readonly cssName: string;
|
||||
readonly converter: (value: string | P) => [CssProperty<any, any> | CssAnimationProperty<any, any>, any][],
|
||||
readonly getter: (this: Style) => string | P
|
||||
}
|
||||
|
||||
export interface CssAnimationPropertyOptions<T, U> {
|
||||
readonly name: string;
|
||||
readonly cssName?: string;
|
||||
readonly defaultValue?: U;
|
||||
readonly equalityComparer?: (x: U, y: U) => boolean;
|
||||
readonly valueChanged?: (target: T, oldValue: U, newValue: U) => void;
|
||||
readonly valueConverter?: (value: string) => U;
|
||||
}
|
||||
|
||||
export class Property<T extends ViewBase, U> {
|
||||
constructor(options: PropertyOptions<T, U>);
|
||||
|
||||
public readonly getDefault: symbol;
|
||||
public readonly setNative: symbol;
|
||||
public readonly defaultValue: U;
|
||||
public register(cls: { prototype: T }): void;
|
||||
public nativeValueChange(owner: T, value: U): void;
|
||||
public isSet(instance: T): boolean;
|
||||
}
|
||||
export interface Property<T extends ViewBase, U> extends TypedPropertyDescriptor<U> {
|
||||
}
|
||||
|
||||
export class CoercibleProperty<T extends ViewBase, U> extends Property<T, U> {
|
||||
constructor(options: CoerciblePropertyOptions<T, U>);
|
||||
|
||||
public readonly coerce: (target: T) => void;
|
||||
}
|
||||
export interface CoercibleProperty<T extends ViewBase, U> extends TypedPropertyDescriptor<U> {
|
||||
}
|
||||
|
||||
export class InheritedProperty<T extends ViewBase, U> extends Property<T, U> {
|
||||
constructor(options: PropertyOptions<T, U>);
|
||||
}
|
||||
|
||||
export class CssProperty<T extends Style, U> {
|
||||
constructor(options: CssPropertyOptions<T, U>);
|
||||
|
||||
public readonly getDefault: symbol;
|
||||
public readonly setNative: symbol;
|
||||
public readonly name: string;
|
||||
public readonly cssName: string;
|
||||
public readonly cssLocalName: string;
|
||||
public readonly defaultValue: U;
|
||||
public register(cls: { prototype: T }): void;
|
||||
public isSet(instance: T): boolean;
|
||||
}
|
||||
|
||||
export class InheritedCssProperty<T extends Style, U> extends CssProperty<T, U> {
|
||||
constructor(options: CssPropertyOptions<T, U>);
|
||||
}
|
||||
|
||||
export class ShorthandProperty<T extends Style, P> {
|
||||
constructor(options: ShorthandPropertyOptions<P>);
|
||||
|
||||
public readonly name: string;
|
||||
public readonly cssName: string;
|
||||
|
||||
public register(cls: typeof Style): void;
|
||||
}
|
||||
|
||||
export class CssAnimationProperty<T extends Style, U> {
|
||||
constructor(options: CssAnimationPropertyOptions<T, U>);
|
||||
|
||||
public readonly getDefault: symbol;
|
||||
public readonly setNative: symbol;
|
||||
|
||||
public readonly name: string;
|
||||
public readonly cssName: string;
|
||||
public readonly cssLocalName: string;
|
||||
|
||||
readonly keyframe: string;
|
||||
|
||||
public readonly defaultValue: U;
|
||||
|
||||
public register(cls: { prototype: T }): void;
|
||||
public isSet(instance: T): boolean;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
public _initDefaultNativeValue(target: T): void;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
public _valueConverter?: (value: string) => any;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
public static _getByCssName(name: string): CssAnimationProperty<any, any>;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
public static _getPropertyNames(): string[];
|
||||
}
|
||||
|
||||
export function initNativeView(view: ViewBase): void;
|
||||
export function resetNativeView(view: ViewBase): void;
|
||||
export function resetCSSProperties(style: Style): void;
|
||||
export function propagateInheritableProperties(view: ViewBase, childView: ViewBase): void;
|
||||
export function propagateInheritableCssProperties(parentStyle: Style, childStyle: Style): void;
|
||||
export function clearInheritedProperties(view: ViewBase): void;
|
||||
|
||||
export function makeValidator<T>(...values: T[]): (value: any) => value is T;
|
||||
export function makeParser<T>(isValid: (value: any) => boolean): (value: any) => T;
|
||||
|
||||
export function getSetProperties(view: ViewBase): [string, any][];
|
||||
export function getComputedCssValues(view: ViewBase): [string, any][];
|
||||
|
||||
export function isCssVariable(property: string): boolean;
|
||||
export function isCssCalcExpression(value: string): boolean;
|
||||
export function isCssVariableExpression(value: string): boolean;
|
||||
|
||||
//@private
|
||||
/**
|
||||
* @private get all properties defined on ViewBase
|
||||
*/
|
||||
export function _getProperties(): Property<any, any>[];
|
||||
|
||||
/**
|
||||
* @private get all properties defined on Style
|
||||
*/
|
||||
export function _getStyleProperties(): CssProperty<any, any>[];
|
||||
|
||||
export function _evaluateCssVariableExpression(view: ViewBase, cssName: string, value: string): string;
|
||||
|
||||
export function _evaluateCssCalcExpression(value: string): string;
|
||||
//@endprivate
|
||||
@@ -1,26 +1,13 @@
|
||||
/**
|
||||
* @module "ui/core/view-base"
|
||||
*/ /** */
|
||||
import { Property, CssProperty, CssAnimationProperty, InheritedProperty, Style } from "../properties";
|
||||
import { BindingOptions, Observable } from "../bindable";
|
||||
import { BindingOptions } from "../bindable";
|
||||
import { Observable } from "../../../data/observable";
|
||||
|
||||
import { SelectorCore } from "../../styling/css-selector";
|
||||
import { isIOS, isAndroid } from "../../../platform";
|
||||
|
||||
import { KeyframeAnimation } from "../../animation/keyframe-animation";
|
||||
import { Page } from "../../page";
|
||||
import { layout } from "../../../utils/utils";
|
||||
|
||||
import { Color } from "../../../color";
|
||||
import { Order, FlexGrow, FlexShrink, FlexWrapBefore, AlignSelf } from "../../layouts/flexbox-layout";
|
||||
import { Length } from "../../styling/style-properties";
|
||||
import { DOMNode } from "../../../debugger/dom-node";
|
||||
|
||||
export { isIOS, isAndroid, layout, Color };
|
||||
|
||||
export * from "../properties";
|
||||
export * from "../bindable";
|
||||
|
||||
/**
|
||||
* Iterates through all child views (via visual tree) and executes a function.
|
||||
* @param view - Starting view (parent container).
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
// Definitions.
|
||||
import { ViewBase as ViewBaseDefinition } from ".";
|
||||
import {
|
||||
AlignSelf, FlexGrow, FlexShrink, FlexWrapBefore, Order
|
||||
AlignSelf, FlexGrow, FlexShrink, FlexWrapBefore, Order
|
||||
} from "../../layouts/flexbox-layout";
|
||||
import { Page } from "../../page";
|
||||
|
||||
// Types.
|
||||
import { Property, CssProperty, CssAnimationProperty, InheritedProperty, Style, clearInheritedProperties, propagateInheritableProperties, propagateInheritableCssProperties, initNativeView } from "../properties";
|
||||
import { Property, CssProperty, CssAnimationProperty, InheritedProperty, clearInheritedProperties, propagateInheritableProperties, propagateInheritableCssProperties, initNativeView } from "../properties";
|
||||
import { getSystemCssClasses, MODAL_ROOT_VIEW_CSS_CLASS, ROOT_VIEW_CSS_CLASS } from "../../../css/system-classes";
|
||||
import { Source } from "../../../utils/debug";
|
||||
import { Binding, BindingOptions, Observable, WrappedValue, PropertyChangeData, traceEnabled, traceWrite, traceCategories } from "../bindable";
|
||||
import { Binding, BindingOptions } from "../bindable";
|
||||
import { Trace } from "../../../trace";
|
||||
import { Observable, PropertyChangeData, WrappedValue } from "../../../data/observable";
|
||||
import { Style } from "../../styling/style";
|
||||
import { isAndroid } from "../../../platform";
|
||||
import { Length, paddingTopProperty, paddingRightProperty, paddingBottomProperty, paddingLeftProperty } from "../../styling/style-properties";
|
||||
|
||||
@@ -20,6 +22,7 @@ import { profile } from "../../../profiling";
|
||||
|
||||
import * as dnm from "../../../debugger/dom-node";
|
||||
import * as ssm from "../../styling/style-scope";
|
||||
import { ViewBase as ViewBaseDefinition } from ".";
|
||||
|
||||
let domNodeModule: typeof dnm;
|
||||
|
||||
@@ -582,8 +585,8 @@ export abstract class ViewBase extends Observable implements ViewBaseDefinition
|
||||
|
||||
@profile
|
||||
public _addView(view: ViewBase, atIndex?: number) {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`${this}._addView(${view}, ${atIndex})`, traceCategories.ViewHierarchy);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`${this}._addView(${view}, ${atIndex})`, Trace.categories.ViewHierarchy);
|
||||
}
|
||||
|
||||
if (!view) {
|
||||
@@ -639,8 +642,8 @@ export abstract class ViewBase extends Observable implements ViewBaseDefinition
|
||||
* Core logic for removing a child view from this instance. Used by the framework to handle lifecycle events more centralized. Do not use outside the UI Stack implementation.
|
||||
*/
|
||||
public _removeView(view: ViewBase) {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`${this}._removeView(${view})`, traceCategories.ViewHierarchy);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`${this}._removeView(${view})`, Trace.categories.ViewHierarchy);
|
||||
}
|
||||
|
||||
if (view.parent !== this) {
|
||||
@@ -881,8 +884,8 @@ export abstract class ViewBase extends Observable implements ViewBaseDefinition
|
||||
}
|
||||
|
||||
public _goToVisualState(state: string) {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(this + " going to state: " + state, traceCategories.Style);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(this + " going to state: " + state, Trace.categories.Style);
|
||||
}
|
||||
|
||||
if (state === this._visualState) {
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
// Definitions.
|
||||
import {
|
||||
View as ViewDefinition, Point, Size, Color, dip,
|
||||
View as ViewDefinition, Point, Size, dip,
|
||||
ShownModallyData
|
||||
} from ".";
|
||||
|
||||
import {
|
||||
booleanConverter, EventData, getEventOrGestureName, InheritedProperty, layout,
|
||||
Property, ShowModalOptions, traceCategories, traceEnabled, traceWrite, ViewBase
|
||||
booleanConverter,
|
||||
ShowModalOptions, ViewBase
|
||||
} from "../view-base";
|
||||
import { getEventOrGestureName } from "../bindable";
|
||||
import { layout } from "../../../utils/utils";
|
||||
import { Color } from "../../../color";
|
||||
import { Property, InheritedProperty } from "../properties";
|
||||
import { EventData } from "../../../data/observable";
|
||||
import { Trace } from "../../../trace";
|
||||
import { ViewHelper } from "./view-helper";
|
||||
|
||||
import { HorizontalAlignment, VerticalAlignment, Visibility, Length, PercentLength } from "../../styling/style-properties";
|
||||
@@ -168,8 +174,8 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
|
||||
}
|
||||
|
||||
public _onLivesync(context?: ModuleContext): boolean {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`${this}._onLivesync(${JSON.stringify(context)})`, traceCategories.Livesync);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`${this}._onLivesync(${JSON.stringify(context)})`, Trace.categories.Livesync);
|
||||
}
|
||||
|
||||
if (this._closeAllModalViewsInternal()) {
|
||||
@@ -193,14 +199,14 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
|
||||
}
|
||||
|
||||
public _handleLivesync(context?: ModuleContext): boolean {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`${this}._handleLivesync(${JSON.stringify(context)})`, traceCategories.Livesync);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`${this}._handleLivesync(${JSON.stringify(context)})`, Trace.categories.Livesync);
|
||||
}
|
||||
|
||||
// Handle local CSS
|
||||
if (viewMatchesModuleContext(this, context, ["style"])) {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`Change Handled: Changing CSS for ${this}`, traceCategories.Livesync);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`Change Handled: Changing CSS for ${this}`, Trace.categories.Livesync);
|
||||
}
|
||||
|
||||
// Always load styles with ".css" extension. Even when changes are in ".scss" ot ".less" files
|
||||
@@ -216,8 +222,8 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
|
||||
this.page &&
|
||||
this.page.frame) {
|
||||
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`Change Handled: Changing ${context.type} for ${this} inside ${this.page}`, traceCategories.Livesync);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`Change Handled: Changing ${context.type} for ${this} inside ${this.page}`, Trace.categories.Livesync);
|
||||
}
|
||||
|
||||
return this.page.frame._handleLivesync({ type: context.type, path: this.page._moduleName });
|
||||
@@ -818,8 +824,8 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
|
||||
public setMeasuredDimension(measuredWidth: number, measuredHeight: number): void {
|
||||
this._measuredWidth = measuredWidth;
|
||||
this._measuredHeight = measuredHeight;
|
||||
if (traceEnabled()) {
|
||||
traceWrite(this + " :setMeasuredDimension: " + measuredWidth + ", " + measuredHeight, traceCategories.Layout);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(this + " :setMeasuredDimension: " + measuredWidth + ", " + measuredHeight, Trace.categories.Layout);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ export class ViewHelper {
|
||||
public static combineMeasuredStates(curState: number, newState): number;
|
||||
}
|
||||
|
||||
export namespace ios {
|
||||
export namespace IOSHelper {
|
||||
/**
|
||||
* String value used when hooking to traitCollectionColorAppearanceChangedEvent event.
|
||||
*/
|
||||
@@ -8,17 +8,14 @@ import {
|
||||
layout
|
||||
} from "../../../../utils/utils";
|
||||
import {
|
||||
isEnabled as traceEnabled,
|
||||
messageType as traceMessageType,
|
||||
categories as traceCategories,
|
||||
write as traceWrite
|
||||
Trace
|
||||
} from "../../../../trace";
|
||||
|
||||
export * from "./view-helper-common";
|
||||
|
||||
const majorVersion = iosUtils.MajorVersion;
|
||||
|
||||
export namespace ios {
|
||||
export namespace IOSHelper {
|
||||
export const traitCollectionColorAppearanceChangedEvent = "traitCollectionColorAppearanceChanged";
|
||||
|
||||
export function getParentWithViewController(view: View): View {
|
||||
@@ -65,19 +62,19 @@ export namespace ios {
|
||||
export function layoutView(controller: UIViewController, owner: View): void {
|
||||
let layoutGuide = controller.view.safeAreaLayoutGuide;
|
||||
if (!layoutGuide) {
|
||||
traceWrite(`safeAreaLayoutGuide during layout of ${owner}. Creating fallback constraints, but layout might be wrong.`,
|
||||
traceCategories.Layout, traceMessageType.error);
|
||||
Trace.write(`safeAreaLayoutGuide during layout of ${owner}. Creating fallback constraints, but layout might be wrong.`,
|
||||
Trace.categories.Layout, Trace.messageType.error);
|
||||
|
||||
layoutGuide = initLayoutGuide(controller);
|
||||
}
|
||||
const safeArea = layoutGuide.layoutFrame;
|
||||
let position = ios.getPositionFromFrame(safeArea);
|
||||
let position = IOSHelper.getPositionFromFrame(safeArea);
|
||||
const safeAreaSize = safeArea.size;
|
||||
|
||||
const hasChildViewControllers = controller.childViewControllers.count > 0;
|
||||
if (hasChildViewControllers) {
|
||||
const fullscreen = controller.view.frame;
|
||||
position = ios.getPositionFromFrame(fullscreen);
|
||||
position = IOSHelper.getPositionFromFrame(fullscreen);
|
||||
}
|
||||
|
||||
const safeAreaWidth = layout.round(layout.toDevicePixels(safeAreaSize.width));
|
||||
@@ -117,11 +114,11 @@ export namespace ios {
|
||||
export function shrinkToSafeArea(view: View, frame: CGRect): CGRect {
|
||||
const insets = view.getSafeAreaInsets();
|
||||
if (insets.left || insets.top) {
|
||||
const position = ios.getPositionFromFrame(frame);
|
||||
const adjustedFrame = ios.getFrameFromPosition(position, insets);
|
||||
const position = IOSHelper.getPositionFromFrame(frame);
|
||||
const adjustedFrame = IOSHelper.getFrameFromPosition(position, insets);
|
||||
|
||||
if (traceEnabled()) {
|
||||
traceWrite(this + " :shrinkToSafeArea: " + JSON.stringify(ios.getPositionFromFrame(adjustedFrame)), traceCategories.Layout);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(this + " :shrinkToSafeArea: " + JSON.stringify(IOSHelper.getPositionFromFrame(adjustedFrame)), Trace.categories.Layout);
|
||||
}
|
||||
|
||||
return adjustedFrame;
|
||||
@@ -136,10 +133,10 @@ export namespace ios {
|
||||
const fullscreen = availableSpace.fullscreen;
|
||||
const inWindow = availableSpace.inWindow;
|
||||
|
||||
const position = ios.getPositionFromFrame(frame);
|
||||
const safeAreaPosition = ios.getPositionFromFrame(safeArea);
|
||||
const fullscreenPosition = ios.getPositionFromFrame(fullscreen);
|
||||
const inWindowPosition = ios.getPositionFromFrame(inWindow);
|
||||
const position = IOSHelper.getPositionFromFrame(frame);
|
||||
const safeAreaPosition = IOSHelper.getPositionFromFrame(safeArea);
|
||||
const fullscreenPosition = IOSHelper.getPositionFromFrame(fullscreen);
|
||||
const inWindowPosition = IOSHelper.getPositionFromFrame(inWindow);
|
||||
|
||||
const adjustedPosition = position;
|
||||
|
||||
@@ -161,8 +158,8 @@ export namespace ios {
|
||||
|
||||
const adjustedFrame = CGRectMake(layout.toDeviceIndependentPixels(adjustedPosition.left), layout.toDeviceIndependentPixels(adjustedPosition.top), layout.toDeviceIndependentPixels(adjustedPosition.right - adjustedPosition.left), layout.toDeviceIndependentPixels(adjustedPosition.bottom - adjustedPosition.top));
|
||||
|
||||
if (traceEnabled()) {
|
||||
traceWrite(view + " :expandBeyondSafeArea: " + JSON.stringify(ios.getPositionFromFrame(adjustedFrame)), traceCategories.Layout);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(view + " :expandBeyondSafeArea: " + JSON.stringify(IOSHelper.getPositionFromFrame(adjustedFrame)), Trace.categories.Layout);
|
||||
}
|
||||
|
||||
return adjustedFrame;
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"name": "view-helper",
|
||||
"main": "view-helper",
|
||||
"types": "view-helper.d.ts"
|
||||
}
|
||||
@@ -8,9 +8,7 @@ import {
|
||||
// Requires
|
||||
import { layout } from "../../../../utils/utils";
|
||||
import {
|
||||
isEnabled as traceEnabled,
|
||||
categories as traceCategories,
|
||||
write as traceWrite
|
||||
Trace
|
||||
} from "../../../../trace";
|
||||
|
||||
export class ViewHelper {
|
||||
@@ -39,8 +37,8 @@ export class ViewHelper {
|
||||
const childWidthMeasureSpec = ViewHelper.getMeasureSpec(widthMeasureSpec, horizontalMargins, child.effectiveWidth, style.horizontalAlignment === "stretch");
|
||||
const childHeightMeasureSpec = ViewHelper.getMeasureSpec(heightMeasureSpec, verticalMargins, child.effectiveHeight, style.verticalAlignment === "stretch");
|
||||
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`${child.parent} :measureChild: ${child} ${layout.measureSpecToString(childWidthMeasureSpec)}, ${layout.measureSpecToString(childHeightMeasureSpec)}}`, traceCategories.Layout);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`${child.parent} :measureChild: ${child} ${layout.measureSpecToString(childWidthMeasureSpec)}, ${layout.measureSpecToString(childHeightMeasureSpec)}}`, Trace.categories.Layout);
|
||||
}
|
||||
|
||||
child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
|
||||
@@ -131,8 +129,8 @@ export class ViewHelper {
|
||||
childLeft = Math.round(childLeft);
|
||||
childTop = Math.round(childTop);
|
||||
|
||||
if (traceEnabled()) {
|
||||
traceWrite(child.parent + " :layoutChild: " + child + " " + childLeft + ", " + childTop + ", " + childRight + ", " + childBottom, traceCategories.Layout);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(child.parent + " :layoutChild: " + child + " " + childLeft + ", " + childTop + ", " + childRight + ", " + childBottom, Trace.categories.Layout);
|
||||
}
|
||||
|
||||
child.layout(childLeft, childTop, childRight, childBottom, setFrame);
|
||||
|
||||
@@ -3,11 +3,13 @@ import { Point, CustomLayoutView as CustomLayoutViewDefinition, dip } from ".";
|
||||
import { GestureTypes, GestureEventData } from "../../gestures";
|
||||
// Types.
|
||||
import {
|
||||
ViewCommon, layout, isEnabledProperty, originXProperty, originYProperty, automationTextProperty, isUserInteractionEnabledProperty,
|
||||
traceEnabled, traceWrite, traceCategories, traceNotifyEvent,
|
||||
ViewCommon, isEnabledProperty, originXProperty, originYProperty, automationTextProperty, isUserInteractionEnabledProperty,
|
||||
paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty,
|
||||
Color, EventData, ShowModalOptions
|
||||
EventData, ShowModalOptions
|
||||
} from "./view-common";
|
||||
// import { layout} from "../../layouts"
|
||||
import { Trace } from "../../../trace";
|
||||
import { Color } from "../../../color";
|
||||
|
||||
import {
|
||||
perspectiveProperty, Length, PercentLength, Visibility, HorizontalAlignment, VerticalAlignment,
|
||||
@@ -1035,8 +1037,8 @@ export class CustomLayoutView extends ContainerView implements CustomLayoutViewD
|
||||
super._addViewToNativeVisualTree(child);
|
||||
|
||||
if (this.nativeViewProtected && child.nativeViewProtected) {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`${this}.nativeView.addView(${child}.nativeView, ${atIndex})`, traceCategories.VisualTreeEvents);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`${this}.nativeView.addView(${child}.nativeView, ${atIndex})`, Trace.categories.VisualTreeEvents);
|
||||
}
|
||||
this.nativeViewProtected.addView(child.nativeViewProtected, atIndex);
|
||||
if (child instanceof View) {
|
||||
@@ -1068,9 +1070,9 @@ export class CustomLayoutView extends ContainerView implements CustomLayoutViewD
|
||||
const childView = child.nativeViewProtected;
|
||||
if (nativeView && childView) {
|
||||
nativeView.removeView(childView);
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`${nativeView}.removeView(${childView})`, traceCategories.VisualTreeEvents);
|
||||
traceNotifyEvent(child, "childInLayoutRemovedFromNativeVisualTree");
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`${nativeView}.removeView(${childView})`, Trace.categories.VisualTreeEvents);
|
||||
Trace.notifyEvent(child, "childInLayoutRemovedFromNativeVisualTree");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
15
nativescript-core/ui/core/view/view.d.ts
vendored
15
nativescript-core/ui/core/view/view.d.ts
vendored
@@ -1,19 +1,12 @@
|
||||
/**
|
||||
* @module "ui/core/view"
|
||||
*/ /** */
|
||||
|
||||
/// <reference path="../../../tns-core-modules.d.ts" />
|
||||
|
||||
import { ViewBase, Property, InheritedProperty, EventData, Color } from "../view-base";
|
||||
import { ViewBase } from "../view-base";
|
||||
import { Property, InheritedProperty } from '../properties';
|
||||
import { EventData } from '../../../data/observable';
|
||||
import { Color } from '../../../color';
|
||||
import { Animation, AnimationDefinition, AnimationPromise } from "../../animation";
|
||||
import { HorizontalAlignment, VerticalAlignment, Visibility, Length, PercentLength } from "../../styling/style-properties";
|
||||
import { GestureTypes, GestureEventData, GesturesObserver } from "../../gestures";
|
||||
import { LinearGradient } from "../../styling/gradient";
|
||||
|
||||
export * from "../view-base";
|
||||
export * from "../../styling/style-properties";
|
||||
export { LinearGradient };
|
||||
|
||||
export function PseudoClassHandler(...pseudoClasses: string[]): MethodDecorator;
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,10 +3,12 @@ import { Point, View as ViewDefinition, dip } from ".";
|
||||
|
||||
// Requires
|
||||
import {
|
||||
ViewCommon, layout, isEnabledProperty, originXProperty, originYProperty, automationTextProperty, isUserInteractionEnabledProperty,
|
||||
traceEnabled, traceWrite, traceCategories, traceError, traceMessageType, ShowModalOptions
|
||||
ViewCommon, isEnabledProperty, originXProperty, originYProperty, automationTextProperty, isUserInteractionEnabledProperty
|
||||
} from "./view-common";
|
||||
import { ios } from "./view-helper";
|
||||
import { ShowModalOptions } from "../view-base";
|
||||
import { Trace } from "../../../trace";
|
||||
import { layout } from "../../../utils/utils";
|
||||
import { IOSHelper } from "./view-helper";
|
||||
import { ios as iosBackground, Background } from "../../styling/background";
|
||||
import { ios as iosUtils } from "../../../utils/utils";
|
||||
import { ios as iosNativeHelper } from "../../../utils/native-helper";
|
||||
@@ -21,7 +23,7 @@ import {
|
||||
import { profile } from "../../../profiling";
|
||||
|
||||
export * from "./view-common";
|
||||
export { ios };
|
||||
export { IOSHelper };
|
||||
|
||||
const PFLAG_FORCE_LAYOUT = 1;
|
||||
const PFLAG_MEASURED_DIMENSION_SET = 1 << 1;
|
||||
@@ -32,8 +34,8 @@ const majorVersion = iosUtils.MajorVersion;
|
||||
export class View extends ViewCommon implements ViewDefinition {
|
||||
nativeViewProtected: UIView;
|
||||
viewController: UIViewController;
|
||||
private _popoverPresentationDelegate: ios.UIPopoverPresentationControllerDelegateImp;
|
||||
private _adaptivePresentationDelegate: ios.UIAdaptivePresentationControllerDelegateImp;
|
||||
private _popoverPresentationDelegate: IOSHelper.UIPopoverPresentationControllerDelegateImp;
|
||||
private _adaptivePresentationDelegate: IOSHelper.UIAdaptivePresentationControllerDelegateImp;
|
||||
|
||||
private _isLaidOut = false;
|
||||
private _hasTransfrom = false;
|
||||
@@ -102,7 +104,7 @@ export class View extends ViewCommon implements ViewDefinition {
|
||||
// on iOS 11+ it is possible to have a changed layout frame due to safe area insets
|
||||
// get the frame and adjust the position, so that onLayout works correctly
|
||||
const frame = this.nativeViewProtected.frame;
|
||||
position = ios.getPositionFromFrame(frame);
|
||||
position = IOSHelper.getPositionFromFrame(frame);
|
||||
}
|
||||
|
||||
this.onLayout(position.left, position.top, position.right, position.bottom);
|
||||
@@ -161,8 +163,8 @@ export class View extends ViewCommon implements ViewDefinition {
|
||||
|
||||
let oldFrame = this._cachedFrame || nativeView.frame;
|
||||
if (!CGRectEqualToRect(oldFrame, frame)) {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(this + " :_setNativeViewFrame: " + JSON.stringify(ios.getPositionFromFrame(frame)), traceCategories.Layout);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(this + " :_setNativeViewFrame: " + JSON.stringify(IOSHelper.getPositionFromFrame(frame)), Trace.categories.Layout);
|
||||
}
|
||||
this._cachedFrame = frame;
|
||||
let adjustedFrame = null;
|
||||
@@ -215,7 +217,7 @@ export class View extends ViewCommon implements ViewDefinition {
|
||||
}
|
||||
|
||||
const nativeView = this.nativeViewProtected;
|
||||
const frame = ios.getFrameFromPosition({ left, top, right, bottom });
|
||||
const frame = IOSHelper.getFrameFromPosition({ left, top, right, bottom });
|
||||
this._setNativeViewFrame(nativeView, frame);
|
||||
}
|
||||
|
||||
@@ -250,7 +252,7 @@ export class View extends ViewCommon implements ViewDefinition {
|
||||
|
||||
public focus(): boolean {
|
||||
if (this.ios) {
|
||||
return this.ios.becomeFirstResponder();
|
||||
return this.IOSHelper.becomeFirstResponder();
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -262,9 +264,9 @@ export class View extends ViewCommon implements ViewDefinition {
|
||||
}
|
||||
|
||||
if (!this.iosOverflowSafeArea || !this.iosOverflowSafeAreaEnabled) {
|
||||
return ios.shrinkToSafeArea(this, frame);
|
||||
return IOSHelper.shrinkToSafeArea(this, frame);
|
||||
} else if (this.nativeViewProtected && this.nativeViewProtected.window) {
|
||||
return ios.expandBeyondSafeArea(this, frame);
|
||||
return IOSHelper.expandBeyondSafeArea(this, frame);
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -400,25 +402,25 @@ export class View extends ViewCommon implements ViewDefinition {
|
||||
}
|
||||
|
||||
protected _showNativeModalView(parent: View, options: ShowModalOptions) {
|
||||
const parentWithController = ios.getParentWithViewController(parent);
|
||||
const parentWithController = IOSHelper.getParentWithViewController(parent);
|
||||
if (!parentWithController) {
|
||||
traceWrite(`Could not find parent with viewController for ${parent} while showing modal view.`,
|
||||
traceCategories.ViewHierarchy, traceMessageType.error);
|
||||
Trace.write(`Could not find parent with viewController for ${parent} while showing modal view.`,
|
||||
Trace.categories.ViewHierarchy, Trace.messageType.error);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const parentController = parentWithController.viewController;
|
||||
if (parentController.presentedViewController) {
|
||||
traceWrite("Parent is already presenting view controller. Close the current modal page before showing another one!",
|
||||
traceCategories.ViewHierarchy, traceMessageType.error);
|
||||
Trace.write("Parent is already presenting view controller. Close the current modal page before showing another one!",
|
||||
Trace.categories.ViewHierarchy, Trace.messageType.error);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!parentController.view || !parentController.view.window) {
|
||||
traceWrite("Parent page is not part of the window hierarchy.",
|
||||
traceCategories.ViewHierarchy, traceMessageType.error);
|
||||
Trace.write("Parent page is not part of the window hierarchy.",
|
||||
Trace.categories.ViewHierarchy, Trace.messageType.error);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -429,7 +431,7 @@ export class View extends ViewCommon implements ViewDefinition {
|
||||
let controller = this.viewController;
|
||||
if (!controller) {
|
||||
const nativeView = this.ios || this.nativeViewProtected;
|
||||
controller = <UIViewController>ios.UILayoutViewController.initWithOwner(new WeakRef(this));
|
||||
controller = <UIViewController>IOSHelper.UILayoutViewController.initWithOwner(new WeakRef(this));
|
||||
|
||||
if (nativeView instanceof UIView) {
|
||||
controller.view.addSubview(nativeView);
|
||||
@@ -444,13 +446,13 @@ export class View extends ViewCommon implements ViewDefinition {
|
||||
controller.modalPresentationStyle = UIModalPresentationStyle.FormSheet;
|
||||
//check whether both height and width is provided and are positive numbers
|
||||
// set it has prefered content size to the controller presenting the dialog
|
||||
if (options.ios && options.ios.width > 0 && options.ios.height > 0) {
|
||||
controller.preferredContentSize = CGSizeMake(options.ios.width, options.ios.height);
|
||||
if (options.ios && options.IOSHelper.width > 0 && options.IOSHelper.height > 0) {
|
||||
controller.preferredContentSize = CGSizeMake(options.IOSHelper.width, options.IOSHelper.height);
|
||||
}
|
||||
}
|
||||
|
||||
if (options.ios && options.ios.presentationStyle) {
|
||||
const presentationStyle = options.ios.presentationStyle;
|
||||
if (options.ios && options.IOSHelper.presentationStyle) {
|
||||
const presentationStyle = options.IOSHelper.presentationStyle;
|
||||
controller.modalPresentationStyle = presentationStyle;
|
||||
|
||||
if (presentationStyle === UIModalPresentationStyle.Popover) {
|
||||
@@ -490,7 +492,7 @@ export class View extends ViewCommon implements ViewDefinition {
|
||||
|
||||
protected _hideNativeModalView(parent: View, whenClosedCallback: () => void) {
|
||||
if (!parent || !parent.viewController) {
|
||||
traceError("Trying to hide modal view but no parent with viewController specified.");
|
||||
Trace.error("Trying to hide modal view but no parent with viewController specified.");
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -704,7 +706,7 @@ export class View extends ViewCommon implements ViewDefinition {
|
||||
|
||||
private _setupPopoverControllerDelegate(controller: UIViewController, parent: View) {
|
||||
const popoverPresentationController = controller.popoverPresentationController;
|
||||
this._popoverPresentationDelegate = ios.UIPopoverPresentationControllerDelegateImp.initWithOwnerAndCallback(new WeakRef(this), this._closeModalCallback);
|
||||
this._popoverPresentationDelegate = IOSHelper.UIPopoverPresentationControllerDelegateImp.initWithOwnerAndCallback(new WeakRef(this), this._closeModalCallback);
|
||||
popoverPresentationController.delegate = <UIPopoverPresentationControllerDelegate>this._popoverPresentationDelegate;
|
||||
const view = parent.nativeViewProtected;
|
||||
// Note: sourceView and sourceRect are needed to specify the anchor location for the popover.
|
||||
@@ -714,7 +716,7 @@ export class View extends ViewCommon implements ViewDefinition {
|
||||
}
|
||||
|
||||
private _setupAdaptiveControllerDelegate(controller: UIViewController) {
|
||||
this._adaptivePresentationDelegate = ios.UIAdaptivePresentationControllerDelegateImp.initWithOwnerAndCallback(new WeakRef(this), this._closeModalCallback);
|
||||
this._adaptivePresentationDelegate = IOSHelper.UIAdaptivePresentationControllerDelegateImp.initWithOwnerAndCallback(new WeakRef(this), this._closeModalCallback);
|
||||
controller.presentationController.delegate = <UIAdaptivePresentationControllerDelegate>this._adaptivePresentationDelegate;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
/**
|
||||
* @module "ui/core/weak-event-listener"
|
||||
*/ /** */
|
||||
|
||||
import { Observable, EventData } from "../../../data/observable";
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { DatePicker as DatePickerDefinition } from ".";
|
||||
import { View, Property, CSSType } from "../core/view";
|
||||
import { View, CSSType } from "../core/view";
|
||||
import {Property } from "../core/properties";
|
||||
|
||||
const defaultDate = new Date();
|
||||
const dateComparer = (x: Date, y: Date): boolean => (x <= y && x >= y);
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
/**
|
||||
* Contains the DatePicker class.
|
||||
* @module "ui/date-picker"
|
||||
*/ /** */
|
||||
|
||||
import { View, Property } from "../core/view";
|
||||
import { View } from "../core/view";
|
||||
import { Property } from "../core/properties";
|
||||
|
||||
export const yearProperty: Property<DatePicker, number>;
|
||||
export const monthProperty: Property<DatePicker, number>;
|
||||
@@ -1,7 +1,9 @@
|
||||
import {
|
||||
DatePickerBase, yearProperty, monthProperty, dayProperty,
|
||||
dateProperty, maxDateProperty, minDateProperty, colorProperty, Color
|
||||
dateProperty, maxDateProperty, minDateProperty
|
||||
} from "./date-picker-common";
|
||||
import { colorProperty } from '../styling/style-properties'
|
||||
import { Color } from '../../color'
|
||||
|
||||
export * from "./date-picker-common";
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"name": "date-picker",
|
||||
"main": "date-picker",
|
||||
"types": "date-picker.d.ts"
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import { Color } from "../../color";
|
||||
import { Page } from "../page";
|
||||
import { isIOS } from "../../platform";
|
||||
import { Frame as FrameDef } from "../frame";
|
||||
import { LoginOptions } from "./dialogs";
|
||||
import { isObject, isString } from "../../utils/types";
|
||||
|
||||
export const STRING = "string";
|
||||
@@ -15,6 +14,163 @@ export const LOGIN = "Login";
|
||||
export const OK = "OK";
|
||||
export const CANCEL = "Cancel";
|
||||
|
||||
/**
|
||||
* Provides options for the dialog.
|
||||
*/
|
||||
export interface CancelableOptions {
|
||||
/**
|
||||
* [Android only] Gets or sets if the dialog can be canceled by taping outside of the dialog.
|
||||
*/
|
||||
cancelable?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides options for the dialog.
|
||||
*/
|
||||
export interface ActionOptions extends CancelableOptions {
|
||||
/**
|
||||
* Gets or sets the dialog title.
|
||||
*/
|
||||
title?: string;
|
||||
|
||||
/**
|
||||
* Gets or sets the dialog message.
|
||||
*/
|
||||
message?: string;
|
||||
|
||||
/**
|
||||
* Gets or sets the Cancel button text.
|
||||
*/
|
||||
cancelButtonText?: string;
|
||||
|
||||
/**
|
||||
* Gets or sets the list of available actions.
|
||||
*/
|
||||
actions?: Array<string>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides options for the dialog.
|
||||
*/
|
||||
export interface DialogOptions extends CancelableOptions {
|
||||
/**
|
||||
* Gets or sets the dialog title.
|
||||
*/
|
||||
title?: string;
|
||||
|
||||
/**
|
||||
* Gets or sets the dialog message.
|
||||
*/
|
||||
message?: string;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides options for the alert.
|
||||
*/
|
||||
export interface AlertOptions extends DialogOptions {
|
||||
/**
|
||||
* Gets or sets the OK button text.
|
||||
*/
|
||||
okButtonText?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides options for the confirm dialog.
|
||||
*/
|
||||
export interface ConfirmOptions extends AlertOptions {
|
||||
/**
|
||||
* Gets or sets the Cancel button text.
|
||||
*/
|
||||
cancelButtonText?: string;
|
||||
|
||||
/**
|
||||
* Gets or sets the neutral button text.
|
||||
*/
|
||||
neutralButtonText?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides options for the prompt dialog.
|
||||
*/
|
||||
export interface PromptOptions extends ConfirmOptions {
|
||||
/**
|
||||
* Gets or sets the default text to display in the input box.
|
||||
*/
|
||||
defaultText?: string;
|
||||
|
||||
/**
|
||||
* Gets or sets the prompt input type (plain text, password, or email).
|
||||
*/
|
||||
inputType?: string;
|
||||
|
||||
/**
|
||||
* Gets or sets the prompt capitalizationType (none, all, sentences, or words).
|
||||
*/
|
||||
capitalizationType?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides result data from the prompt dialog.
|
||||
*/
|
||||
export interface PromptResult {
|
||||
/**
|
||||
* Gets or sets the prompt dialog boolean result.
|
||||
*/
|
||||
result: boolean;
|
||||
|
||||
/**
|
||||
* Gets or sets the text entered in the prompt dialog.
|
||||
*/
|
||||
text: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides result data from the login dialog.
|
||||
*/
|
||||
export interface LoginResult {
|
||||
/**
|
||||
* Gets or sets the login dialog boolean result.
|
||||
*/
|
||||
result: boolean;
|
||||
|
||||
/**
|
||||
* Gets or sets the user entered in the login dialog.
|
||||
*/
|
||||
userName: string;
|
||||
|
||||
/**
|
||||
* Gets or sets the password entered in the login dialog.
|
||||
*/
|
||||
password: string;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Provides options for the login dialog.
|
||||
*/
|
||||
export interface LoginOptions extends ConfirmOptions {
|
||||
/**
|
||||
* Gets or sets the default text to display as hint in the user name input box.
|
||||
*/
|
||||
userNameHint?: string;
|
||||
|
||||
/**
|
||||
* Gets or sets the default text to display as hint in the password input box.
|
||||
*/
|
||||
passwordHint?: string;
|
||||
|
||||
/**
|
||||
* Gets or sets the default text to display in the user name input box.
|
||||
*/
|
||||
userName?: string;
|
||||
|
||||
/**
|
||||
* Gets or sets the default text to display in the password input box.
|
||||
*/
|
||||
password?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the input type for prompt dialog.
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Android specific dialogs functions implementation.
|
||||
*/
|
||||
import { DialogOptions, ConfirmOptions, PromptOptions, PromptResult, LoginOptions, LoginResult, ActionOptions } from ".";
|
||||
import { DialogOptions, ConfirmOptions, PromptOptions, PromptResult, LoginOptions, LoginResult, ActionOptions } from "./dialogs-common";
|
||||
import { getLabelColor, getButtonColors, isDialogOptions, inputType, capitalizationType, ALERT, OK, CONFIRM, CANCEL, PROMPT, parseLoginOptions } from "./dialogs-common";
|
||||
import { android as androidApp } from "../../application";
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
/**
|
||||
* Allows you to show different dialogs such as alerts, prompts, etc.
|
||||
* @module "ui/dialogs"
|
||||
*/ /** */
|
||||
|
||||
import { ConfirmOptions, PromptOptions, AlertOptions, PromptResult, LoginOptions, LoginResult, ActionOptions } from "./dialogs-common";
|
||||
/**
|
||||
* Defines the input type for prompt dialog.
|
||||
*/
|
||||
@@ -1,35 +1,9 @@
|
||||
/**
|
||||
* iOS specific dialogs functions implementation.
|
||||
*/
|
||||
import {
|
||||
ios as iosView,
|
||||
traceCategories,
|
||||
traceWrite,
|
||||
traceMessageType,
|
||||
} from "../core/view";
|
||||
import {
|
||||
ConfirmOptions,
|
||||
PromptOptions,
|
||||
PromptResult,
|
||||
LoginOptions,
|
||||
LoginResult,
|
||||
ActionOptions,
|
||||
} from ".";
|
||||
import {
|
||||
getCurrentPage,
|
||||
getLabelColor,
|
||||
getButtonColors,
|
||||
getTextFieldColor,
|
||||
isDialogOptions,
|
||||
inputType,
|
||||
capitalizationType,
|
||||
ALERT,
|
||||
OK,
|
||||
CONFIRM,
|
||||
CANCEL,
|
||||
PROMPT,
|
||||
parseLoginOptions,
|
||||
} from "./dialogs-common";
|
||||
import { ios as iosView } from "../core/view";
|
||||
import { Trace } from "../../trace";
|
||||
import { ConfirmOptions, PromptOptions, PromptResult, LoginOptions, LoginResult, ActionOptions, getCurrentPage, getLabelColor, getButtonColors, getTextFieldColor, isDialogOptions, inputType, capitalizationType, ALERT, OK, CONFIRM, CANCEL, PROMPT, parseLoginOptions } from "./dialogs-common";
|
||||
import { isString, isDefined, isFunction } from "../../utils/types";
|
||||
import { getRootView, ios } from "../../application";
|
||||
|
||||
@@ -297,13 +271,9 @@ function showUIAlertController(alertController: UIAlertController) {
|
||||
}
|
||||
|
||||
if (!viewController) {
|
||||
traceWrite(
|
||||
`No root controller found to open dialog.`,
|
||||
traceCategories.Error,
|
||||
traceMessageType.warn
|
||||
);
|
||||
|
||||
return;
|
||||
Trace.write(`No root controller found to open dialog.`, Trace.categories.Error, Trace.messageType.warn);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (alertController.popoverPresentationController) {
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"name": "dialogs",
|
||||
"main": "dialogs",
|
||||
"types": "dialogs.d.ts"
|
||||
}
|
||||
@@ -1,5 +1,10 @@
|
||||
import { EditableTextBase as EditableTextBaseDefinition, KeyboardType, ReturnKeyType, UpdateTextTrigger, AutocapitalizationType } from ".";
|
||||
import { TextBase, Property, CssProperty, Style, Color, booleanConverter, makeValidator, makeParser, PseudoClassHandler } from "../text-base";
|
||||
import { TextBase } from "../text-base";
|
||||
import { Property, CssProperty, makeValidator, makeParser } from "../core/properties";
|
||||
import {PseudoClassHandler } from "../core/view";
|
||||
import {booleanConverter } from "../core/view-base";
|
||||
import {Style } from "../styling/style";
|
||||
import {Color } from "../../color";
|
||||
|
||||
export abstract class EditableTextBase extends TextBase implements EditableTextBaseDefinition {
|
||||
public static blurEvent = "blur";
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* @module "ui/editor-text-base"
|
||||
*/ /** */
|
||||
|
||||
import { TextBase, Property, CssProperty, Style, Color, FormattedString } from "../text-base";
|
||||
import { TextBase } from "../text-base";
|
||||
import { Color } from '../../color';
|
||||
import { FormattedString } from '../text-base/formatted-string';
|
||||
import { Style } from '../styling/style';
|
||||
import { Property, CssProperty } from "../core/properties";
|
||||
|
||||
/**
|
||||
* Represents the base class for all editable text views.
|
||||
|
||||
6
nativescript-core/ui/enums/enums.d.ts
vendored
6
nativescript-core/ui/enums/enums.d.ts
vendored
@@ -1,8 +1,4 @@
|
||||
/**
|
||||
* @module "ui/enums"
|
||||
*/ /** */
|
||||
|
||||
import { CubicBezierAnimationCurve } from "../animation";
|
||||
import { CubicBezierAnimationCurve } from "../animation";
|
||||
import {
|
||||
KeyboardType as BaseKeyboardType,
|
||||
ReturnKeyType as BaseReturnKeyType,
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/// <reference path="transition-definitions.android.d.ts"/>
|
||||
|
||||
// Definitions.
|
||||
import { NavigationType } from "./frame-common";
|
||||
import { NavigationTransition, BackstackEntry } from "../frame";
|
||||
@@ -9,7 +7,7 @@ import { Transition, AndroidTransitionType } from "../transition/transition";
|
||||
import { FlipTransition } from "../transition/flip-transition";
|
||||
import { _resolveAnimationCurve } from "../animation";
|
||||
import lazy from "../../utils/lazy";
|
||||
import { isEnabled as traceEnabled, write as traceWrite, categories as traceCategories } from "../../trace";
|
||||
import {Trace } from "../../trace";
|
||||
|
||||
interface TransitionListener {
|
||||
new(entry: ExpandedEntry, transition: androidx.transition.Transition): ExpandedTransitionListener;
|
||||
@@ -220,27 +218,27 @@ function getAnimationListener(): android.animation.Animator.AnimatorListener {
|
||||
onAnimationStart(animator: ExpandedAnimator): void {
|
||||
const entry = animator.entry;
|
||||
addToWaitingQueue(entry);
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`START ${animator.transitionType} for ${entry.fragmentTag}`, traceCategories.Transition);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`START ${animator.transitionType} for ${entry.fragmentTag}`, Trace.categories.Transition);
|
||||
}
|
||||
}
|
||||
|
||||
onAnimationRepeat(animator: ExpandedAnimator): void {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`REPEAT ${animator.transitionType} for ${animator.entry.fragmentTag}`, traceCategories.Transition);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`REPEAT ${animator.transitionType} for ${animator.entry.fragmentTag}`, Trace.categories.Transition);
|
||||
}
|
||||
}
|
||||
|
||||
onAnimationEnd(animator: ExpandedAnimator): void {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`END ${animator.transitionType} for ${animator.entry.fragmentTag}`, traceCategories.Transition);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`END ${animator.transitionType} for ${animator.entry.fragmentTag}`, Trace.categories.Transition);
|
||||
}
|
||||
transitionOrAnimationCompleted(animator.entry);
|
||||
}
|
||||
|
||||
onAnimationCancel(animator: ExpandedAnimator): void {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`CANCEL ${animator.transitionType} for ${animator.entry.fragmentTag}`, traceCategories.Transition);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`CANCEL ${animator.transitionType} for ${animator.entry.fragmentTag}`, Trace.categories.Transition);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -258,9 +256,9 @@ function clearAnimationListener(animator: ExpandedAnimator, listener: android.an
|
||||
|
||||
animator.removeListener(listener);
|
||||
|
||||
if (animator.entry && traceEnabled()) {
|
||||
if (animator.entry && Trace.isEnabled()) {
|
||||
const entry = animator.entry;
|
||||
traceWrite(`Clear ${animator.transitionType} - ${entry.transition} for ${entry.fragmentTag}`, traceCategories.Transition);
|
||||
Trace.write(`Clear ${animator.transitionType} - ${entry.transition} for ${entry.fragmentTag}`, Trace.categories.Transition);
|
||||
}
|
||||
|
||||
animator.entry = null;
|
||||
@@ -332,36 +330,36 @@ function getTransitionListener(entry: ExpandedEntry, transition: androidx.transi
|
||||
public onTransitionStart(transition: androidx.transition.Transition): void {
|
||||
const entry = this.entry;
|
||||
addToWaitingQueue(entry);
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`START ${toShortString(transition)} transition for ${entry.fragmentTag}`, traceCategories.Transition);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`START ${toShortString(transition)} transition for ${entry.fragmentTag}`, Trace.categories.Transition);
|
||||
}
|
||||
}
|
||||
|
||||
onTransitionEnd(transition: androidx.transition.Transition): void {
|
||||
const entry = this.entry;
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`END ${toShortString(transition)} transition for ${entry.fragmentTag}`, traceCategories.Transition);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`END ${toShortString(transition)} transition for ${entry.fragmentTag}`, Trace.categories.Transition);
|
||||
}
|
||||
|
||||
transitionOrAnimationCompleted(entry);
|
||||
}
|
||||
|
||||
onTransitionResume(transition: androidx.transition.Transition): void {
|
||||
if (traceEnabled()) {
|
||||
if (Trace.isEnabled()) {
|
||||
const fragment = this.entry.fragmentTag;
|
||||
traceWrite(`RESUME ${toShortString(transition)} transition for ${fragment}`, traceCategories.Transition);
|
||||
Trace.write(`RESUME ${toShortString(transition)} transition for ${fragment}`, Trace.categories.Transition);
|
||||
}
|
||||
}
|
||||
|
||||
onTransitionPause(transition: androidx.transition.Transition): void {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`PAUSE ${toShortString(transition)} transition for ${this.entry.fragmentTag}`, traceCategories.Transition);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`PAUSE ${toShortString(transition)} transition for ${this.entry.fragmentTag}`, Trace.categories.Transition);
|
||||
}
|
||||
}
|
||||
|
||||
onTransitionCancel(transition: androidx.transition.Transition): void {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`CANCEL ${toShortString(transition)} transition for ${this.entry.fragmentTag}`, traceCategories.Transition);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`CANCEL ${toShortString(transition)} transition for ${this.entry.fragmentTag}`, Trace.categories.Transition);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -394,8 +392,8 @@ function clearExitAndReenterTransitions(entry: ExpandedEntry, removeListener: bo
|
||||
}
|
||||
|
||||
fragment.setExitTransition(null);
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`Cleared Exit ${exitTransition.getClass().getSimpleName()} transition for ${fragment}`, traceCategories.Transition);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`Cleared Exit ${exitTransition.getClass().getSimpleName()} transition for ${fragment}`, Trace.categories.Transition);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -413,8 +411,8 @@ function clearExitAndReenterTransitions(entry: ExpandedEntry, removeListener: bo
|
||||
}
|
||||
|
||||
fragment.setReenterTransition(null);
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`Cleared Reenter ${reenterTransition.getClass().getSimpleName()} transition for ${fragment}`, traceCategories.Transition);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`Cleared Reenter ${reenterTransition.getClass().getSimpleName()} transition for ${fragment}`, Trace.categories.Transition);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -445,8 +443,8 @@ function clearEntry(entry: ExpandedEntry, removeListener: boolean): void {
|
||||
}
|
||||
|
||||
fragment.setEnterTransition(null);
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`Cleared Enter ${enterTransition.getClass().getSimpleName()} transition for ${fragment}`, traceCategories.Transition);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`Cleared Enter ${enterTransition.getClass().getSimpleName()} transition for ${fragment}`, Trace.categories.Transition);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -464,8 +462,8 @@ function clearEntry(entry: ExpandedEntry, removeListener: boolean): void {
|
||||
}
|
||||
|
||||
fragment.setReturnTransition(null);
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`Cleared Return ${returnTransition.getClass().getSimpleName()} transition for ${fragment}`, traceCategories.Transition);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`Cleared Return ${returnTransition.getClass().getSimpleName()} transition for ${fragment}`, Trace.categories.Transition);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -685,7 +683,7 @@ function toShortString(nativeTransition: androidx.transition.Transition): string
|
||||
}
|
||||
|
||||
function printTransitions(entry: ExpandedEntry) {
|
||||
if (entry && traceEnabled()) {
|
||||
if (entry && Trace.isEnabled()) {
|
||||
let result = `${entry.fragmentTag} Transitions:`;
|
||||
if (entry.transitionName) {
|
||||
result += `transitionName=${entry.transitionName}, `;
|
||||
@@ -697,7 +695,7 @@ function printTransitions(entry: ExpandedEntry) {
|
||||
result += `${fragment.getReenterTransition() ? " popEnter=" + toShortString(fragment.getReenterTransition()) : ""}`;
|
||||
result += `${fragment.getReturnTransition() ? " popExit=" + toShortString(fragment.getReturnTransition()) : ""}`;
|
||||
|
||||
traceWrite(result, traceCategories.Transition);
|
||||
Trace.write(result, Trace.categories.Transition);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
/**
|
||||
* @module "ui/transition"
|
||||
*/ /** */
|
||||
|
||||
import { NavigationTransition, BackstackEntry } from "../frame";
|
||||
// Types.
|
||||
import { Transition, AndroidTransitionType } from "../transition/transition";
|
||||
import { NavigationTransition, BackstackEntry } from "../frame";
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Transition } from "../transition/transition";
|
||||
import { SlideTransition } from "../transition/slide-transition";
|
||||
import { FadeTransition } from "../transition/fade-transition";
|
||||
|
||||
import { isEnabled as traceEnabled, write as traceWrite, categories as traceCategories } from "../../trace";
|
||||
import { Trace } from "../../trace";
|
||||
|
||||
module UIViewControllerAnimatedTransitioningMethods {
|
||||
const methodSignature = NSMethodSignature.signatureWithObjCTypes("v@:c");
|
||||
@@ -45,8 +45,8 @@ class AnimatedTransitioning extends NSObject implements UIViewControllerAnimated
|
||||
case UINavigationControllerOperation.None: this._transitionType = "none"; break;
|
||||
}
|
||||
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`START ${this._transition} ${this._transitionType}`, traceCategories.Transition);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`START ${this._transition} ${this._transitionType}`, Trace.categories.Transition);
|
||||
}
|
||||
this._transition.animateIOSTransition(containerView, this._fromVC.view, this._toVC.view, this._operation, completion);
|
||||
}
|
||||
@@ -57,12 +57,12 @@ class AnimatedTransitioning extends NSObject implements UIViewControllerAnimated
|
||||
|
||||
public animationEnded(transitionCompleted: boolean): void {
|
||||
if (transitionCompleted) {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`END ${this._transition} ${this._transitionType}`, traceCategories.Transition);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`END ${this._transition} ${this._transitionType}`, Trace.categories.Transition);
|
||||
}
|
||||
} else {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`CANCEL ${this._transition} ${this._transitionType}`, traceCategories.Transition);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`CANCEL ${this._transition} ${this._transitionType}`, Trace.categories.Transition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
/**
|
||||
* @module "ui/fragment.transition.types"
|
||||
* @private
|
||||
*/ /** */
|
||||
//@private
|
||||
export const enum AnimationType {
|
||||
enterFakeResourceId = -10,
|
||||
|
||||
@@ -2,11 +2,15 @@
|
||||
import { Frame as FrameDefinition } from ".";
|
||||
import { BackstackEntry, NavigationContext, NavigationEntry, NavigationTransition, NavigationType } from "./frame-interfaces";
|
||||
import { Page } from "../page";
|
||||
import { View, CustomLayoutView, isIOS, isAndroid, traceEnabled, traceWrite, traceCategories, Property, CSSType } from "../core/view";
|
||||
import { View, CustomLayoutView, CSSType } from "../core/view";
|
||||
import { Property } from "../core/properties";
|
||||
import { isIOS, isAndroid } from "../../platform";
|
||||
import { Trace } from "../../trace";
|
||||
|
||||
// Requires.
|
||||
import { frameStack, topmost as frameStackTopmost, _pushInFrameStack, _popFromFrameStack, _removeFromFrameStack } from "./frame-stack";
|
||||
import { getAncestor, viewMatchesModuleContext } from "../core/view/view-common";
|
||||
import { viewMatchesModuleContext } from "../core/view/view-common";
|
||||
import { getAncestor } from "../core/view-base";
|
||||
import { Builder } from "../builder";
|
||||
import { sanitizeModuleName } from "../builder/module-name-sanitizer";
|
||||
import { profile } from "../../profiling";
|
||||
@@ -162,8 +166,8 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition {
|
||||
* @param to The backstack entry to navigate back to.
|
||||
*/
|
||||
public goBack(backstackEntry?: BackstackEntry): void {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`GO BACK`, traceCategories.Navigation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`GO BACK`, Trace.categories.Navigation);
|
||||
}
|
||||
|
||||
if (!this.canGoBack()) {
|
||||
@@ -201,8 +205,8 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition {
|
||||
}
|
||||
|
||||
public navigate(param: any) {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`NAVIGATE`, traceCategories.Navigation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`NAVIGATE`, Trace.categories.Navigation);
|
||||
}
|
||||
|
||||
this._pushInFrameStack();
|
||||
@@ -355,7 +359,7 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition {
|
||||
}
|
||||
|
||||
public _updateActionBar(page?: Page, disableNavBarAnimation?: boolean) {
|
||||
//traceWrite("calling _updateActionBar on Frame", traceCategories.Navigation);
|
||||
//Trace.write("calling _updateActionBar on Frame", Trace.categories.Navigation);
|
||||
}
|
||||
|
||||
protected _processNextNavigationEntry() {
|
||||
@@ -399,14 +403,14 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition {
|
||||
}
|
||||
|
||||
public _goBackCore(backstackEntry: BackstackEntry) {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`GO BACK CORE(${this._backstackEntryTrace(backstackEntry)}); currentPage: ${this.currentPage}`, traceCategories.Navigation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`GO BACK CORE(${this._backstackEntryTrace(backstackEntry)}); currentPage: ${this.currentPage}`, Trace.categories.Navigation);
|
||||
}
|
||||
}
|
||||
|
||||
public _navigateCore(backstackEntry: BackstackEntry) {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`NAVIGATE CORE(${this._backstackEntryTrace(backstackEntry)}); currentPage: ${this.currentPage}`, traceCategories.Navigation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`NAVIGATE CORE(${this._backstackEntryTrace(backstackEntry)}); currentPage: ${this.currentPage}`, Trace.categories.Navigation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -617,7 +621,7 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition {
|
||||
if (this.currentPage &&
|
||||
viewMatchesModuleContext(this.currentPage, context, ["markup", "script"])) {
|
||||
|
||||
traceWrite(`Change Handled: Replacing page ${context.path}`, traceCategories.Livesync);
|
||||
Trace.write(`Change Handled: Replacing page ${context.path}`, Trace.categories.Livesync);
|
||||
|
||||
this.replacePage(context.path);
|
||||
|
||||
@@ -631,8 +635,8 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition {
|
||||
// Reset activity/window content when:
|
||||
// + Changes are not handled on View
|
||||
// + There is no ModuleContext
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`${this}._onLivesync()`, traceCategories.Livesync);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`${this}._onLivesync()`, Trace.categories.Livesync);
|
||||
}
|
||||
|
||||
if (!this._currentEntry || !this._currentEntry.entry) {
|
||||
|
||||
@@ -10,9 +10,12 @@ import { Page } from "../page";
|
||||
import * as application from "../../application";
|
||||
|
||||
import {
|
||||
_stack, FrameBase, NavigationType, Observable,
|
||||
traceCategories, traceEnabled, traceError, traceWrite, View, Color
|
||||
_stack, FrameBase, NavigationType
|
||||
} from "./frame-common";
|
||||
import { Color } from "../../color";
|
||||
import { Trace } from "../../trace";
|
||||
import { View } from "../core/view";
|
||||
import { Observable } from "../../data/observable";
|
||||
|
||||
import {
|
||||
_setAndroidFragmentTransitions, _getAnimatedEntries,
|
||||
@@ -118,7 +121,7 @@ export class Frame extends FrameBase {
|
||||
callbacks.resetActivityContent(activity);
|
||||
}
|
||||
} else {
|
||||
traceError(`${activity}[CALLBACKS] is null or undefined`);
|
||||
Trace.error(`${activity}[CALLBACKS] is null or undefined`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -747,8 +750,8 @@ class AndroidFrame extends Observable implements AndroidFrameDefinition {
|
||||
|
||||
function findPageForFragment(fragment: androidx.fragment.app.Fragment, frame: Frame) {
|
||||
const fragmentTag = fragment.getTag();
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`Finding page for ${fragmentTag}.`, traceCategories.NativeLifecycle);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`Finding page for ${fragmentTag}.`, Trace.categories.NativeLifecycle);
|
||||
}
|
||||
|
||||
let entry: BackstackEntry;
|
||||
@@ -829,8 +832,8 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
|
||||
|
||||
@profile
|
||||
public onHiddenChanged(fragment: androidx.fragment.app.Fragment, hidden: boolean, superFunc: Function): void {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`${fragment}.onHiddenChanged(${hidden})`, traceCategories.NativeLifecycle);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`${fragment}.onHiddenChanged(${hidden})`, Trace.categories.NativeLifecycle);
|
||||
}
|
||||
superFunc.call(fragment, hidden);
|
||||
}
|
||||
@@ -851,8 +854,8 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
|
||||
|
||||
@profile
|
||||
public onCreate(fragment: androidx.fragment.app.Fragment, savedInstanceState: android.os.Bundle, superFunc: Function): void {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`${fragment}.onCreate(${savedInstanceState})`, traceCategories.NativeLifecycle);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`${fragment}.onCreate(${savedInstanceState})`, Trace.categories.NativeLifecycle);
|
||||
}
|
||||
|
||||
superFunc.call(fragment, savedInstanceState);
|
||||
@@ -872,27 +875,27 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
|
||||
|
||||
@profile
|
||||
public onCreateView(fragment: androidx.fragment.app.Fragment, inflater: android.view.LayoutInflater, container: android.view.ViewGroup, savedInstanceState: android.os.Bundle, superFunc: Function): android.view.View {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`${fragment}.onCreateView(inflater, container, ${savedInstanceState})`, traceCategories.NativeLifecycle);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`${fragment}.onCreateView(inflater, container, ${savedInstanceState})`, Trace.categories.NativeLifecycle);
|
||||
}
|
||||
|
||||
const entry = this.entry;
|
||||
if (!entry) {
|
||||
traceError(`${fragment}.onCreateView: entry is null or undefined`);
|
||||
Trace.error(`${fragment}.onCreateView: entry is null or undefined`);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
const page = entry.resolvedPage;
|
||||
if (!page) {
|
||||
traceError(`${fragment}.onCreateView: entry has no resolvedPage`);
|
||||
Trace.error(`${fragment}.onCreateView: entry has no resolvedPage`);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
const frame = this.frame;
|
||||
if (!frame) {
|
||||
traceError(`${fragment}.onCreateView: this.frame is null or undefined`);
|
||||
Trace.error(`${fragment}.onCreateView: this.frame is null or undefined`);
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -946,8 +949,8 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
|
||||
|
||||
@profile
|
||||
public onSaveInstanceState(fragment: androidx.fragment.app.Fragment, outState: android.os.Bundle, superFunc: Function): void {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`${fragment}.onSaveInstanceState(${outState})`, traceCategories.NativeLifecycle);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`${fragment}.onSaveInstanceState(${outState})`, Trace.categories.NativeLifecycle);
|
||||
}
|
||||
superFunc.call(fragment, outState);
|
||||
}
|
||||
@@ -955,8 +958,8 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
|
||||
@profile
|
||||
public onDestroyView(fragment: org.nativescript.widgets.FragmentBase, superFunc: Function): void {
|
||||
try {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`${fragment}.onDestroyView()`, traceCategories.NativeLifecycle);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`${fragment}.onDestroyView()`, Trace.categories.NativeLifecycle);
|
||||
}
|
||||
|
||||
const hasRemovingParent = fragment.getRemovingParentFragment();
|
||||
@@ -974,15 +977,15 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
|
||||
|
||||
@profile
|
||||
public onDestroy(fragment: androidx.fragment.app.Fragment, superFunc: Function): void {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`${fragment}.onDestroy()`, traceCategories.NativeLifecycle);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`${fragment}.onDestroy()`, Trace.categories.NativeLifecycle);
|
||||
}
|
||||
|
||||
superFunc.call(fragment);
|
||||
|
||||
const entry = this.entry;
|
||||
if (!entry) {
|
||||
traceError(`${fragment}.onDestroy: entry is null or undefined`);
|
||||
Trace.error(`${fragment}.onDestroy: entry is null or undefined`);
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -995,7 +998,7 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
|
||||
|
||||
const page = entry.resolvedPage;
|
||||
if (!page) {
|
||||
traceError(`${fragment}.onDestroy: entry has no resolvedPage`);
|
||||
Trace.error(`${fragment}.onDestroy: entry has no resolvedPage`);
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -1064,8 +1067,8 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
|
||||
|
||||
@profile
|
||||
public onCreate(activity: androidx.appcompat.app.AppCompatActivity, savedInstanceState: android.os.Bundle, intentOrSuperFunc: android.content.Intent | Function, superFunc?: Function): void {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`Activity.onCreate(${savedInstanceState})`, traceCategories.NativeLifecycle);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`Activity.onCreate(${savedInstanceState})`, Trace.categories.NativeLifecycle);
|
||||
}
|
||||
|
||||
const intent: android.content.Intent = superFunc ? <android.content.Intent>intentOrSuperFunc : undefined;
|
||||
@@ -1135,8 +1138,8 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
|
||||
public onStart(activity: any, superFunc: Function): void {
|
||||
superFunc.call(activity);
|
||||
|
||||
if (traceEnabled()) {
|
||||
traceWrite("NativeScriptActivity.onStart();", traceCategories.NativeLifecycle);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("NativeScriptActivity.onStart();", Trace.categories.NativeLifecycle);
|
||||
}
|
||||
|
||||
const rootView = this._rootView;
|
||||
@@ -1149,8 +1152,8 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
|
||||
public onStop(activity: any, superFunc: Function): void {
|
||||
superFunc.call(activity);
|
||||
|
||||
if (traceEnabled()) {
|
||||
traceWrite("NativeScriptActivity.onStop();", traceCategories.NativeLifecycle);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("NativeScriptActivity.onStop();", Trace.categories.NativeLifecycle);
|
||||
}
|
||||
|
||||
const rootView = this._rootView;
|
||||
@@ -1163,8 +1166,8 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
|
||||
public onPostResume(activity: any, superFunc: Function): void {
|
||||
superFunc.call(activity);
|
||||
|
||||
if (traceEnabled()) {
|
||||
traceWrite("NativeScriptActivity.onPostResume();", traceCategories.NativeLifecycle);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("NativeScriptActivity.onPostResume();", Trace.categories.NativeLifecycle);
|
||||
}
|
||||
|
||||
// NOTE: activity.onPostResume() is called when activity resume is complete and we can
|
||||
@@ -1186,8 +1189,8 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
|
||||
@profile
|
||||
public onDestroy(activity: any, superFunc: Function): void {
|
||||
try {
|
||||
if (traceEnabled()) {
|
||||
traceWrite("NativeScriptActivity.onDestroy();", traceCategories.NativeLifecycle);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("NativeScriptActivity.onDestroy();", Trace.categories.NativeLifecycle);
|
||||
}
|
||||
|
||||
const rootView = this._rootView;
|
||||
@@ -1204,8 +1207,8 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
|
||||
|
||||
@profile
|
||||
public onBackPressed(activity: any, superFunc: Function): void {
|
||||
if (traceEnabled()) {
|
||||
traceWrite("NativeScriptActivity.onBackPressed;", traceCategories.NativeLifecycle);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("NativeScriptActivity.onBackPressed;", Trace.categories.NativeLifecycle);
|
||||
}
|
||||
|
||||
const args = <application.AndroidActivityBackPressedEventData>{
|
||||
@@ -1248,8 +1251,8 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
|
||||
grantResults: Array<number>,
|
||||
superFunc: Function
|
||||
): void {
|
||||
if (traceEnabled()) {
|
||||
traceWrite("NativeScriptActivity.onRequestPermissionsResult;", traceCategories.NativeLifecycle);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("NativeScriptActivity.onRequestPermissionsResult;", Trace.categories.NativeLifecycle);
|
||||
}
|
||||
|
||||
application.android.notify(<application.AndroidActivityRequestPermissionsEventData>{
|
||||
@@ -1271,8 +1274,8 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
|
||||
superFunc: Function
|
||||
): void {
|
||||
superFunc.call(activity, requestCode, resultCode, data);
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`NativeScriptActivity.onActivityResult(${requestCode}, ${resultCode}, ${data})`, traceCategories.NativeLifecycle);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`NativeScriptActivity.onActivityResult(${requestCode}, ${resultCode}, ${data})`, Trace.categories.NativeLifecycle);
|
||||
}
|
||||
|
||||
application.android.notify(<application.AndroidActivityResultEventData>{
|
||||
@@ -1310,10 +1313,10 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
|
||||
): void {
|
||||
let rootView = this._rootView;
|
||||
|
||||
if (traceEnabled()) {
|
||||
traceWrite(
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(
|
||||
`Frame.setActivityContent rootView: ${rootView} shouldCreateRootFrame: false fireLaunchEvent: ${fireLaunchEvent}`,
|
||||
traceCategories.NativeLifecycle
|
||||
Trace.categories.NativeLifecycle
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
13
nativescript-core/ui/frame/frame.d.ts
vendored
13
nativescript-core/ui/frame/frame.d.ts
vendored
@@ -1,14 +1,9 @@
|
||||
/**
|
||||
* Contains the Frame class, which represents the logical View unit that is responsible for navigation within an application.
|
||||
* @module "ui/frame"
|
||||
*/ /** */
|
||||
|
||||
import { NavigationType } from "./frame-common";
|
||||
import { Page, View, Observable, EventData } from "../page";
|
||||
import { NavigationType } from "./frame-common";
|
||||
import { Page } from "../page";
|
||||
import { Observable, EventData } from "../../data/observable";
|
||||
import { View } from "../core/view";
|
||||
import { Transition } from "../transition";
|
||||
|
||||
export * from "../page";
|
||||
|
||||
/**
|
||||
* Represents the logical View unit that is responsible for navigation within an application.
|
||||
* Nested frames are supported, enabling hierarchical navigation scenarios.
|
||||
|
||||
@@ -6,12 +6,11 @@ import { View } from "../core/view";
|
||||
|
||||
// Requires
|
||||
import { _createIOSAnimatedTransitioning } from "./fragment.transitions";
|
||||
import { ios as iosViewHelper } from "../core/view/view-helper";
|
||||
import { IOSHelper } from "../core/view/view-helper";
|
||||
import { profile } from "../../profiling";
|
||||
import { ios as iosUtils, layout } from "../../utils/utils";
|
||||
import {
|
||||
isCategorySet, isEnabled as traceEnabled,
|
||||
categories as traceCategories, write as traceWrite
|
||||
Trace
|
||||
} from "../../trace";
|
||||
|
||||
export * from "./frame-common";
|
||||
@@ -125,8 +124,8 @@ export class Frame extends FrameBase {
|
||||
// Update action-bar with disabled animations before the initial navigation.
|
||||
this._updateActionBar(backstackEntry.resolvedPage, true);
|
||||
this._ios.controller.pushViewControllerAnimated(viewController, animated);
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`${this}.pushViewControllerAnimated(${viewController}, ${animated}); depth = ${navDepth}`, traceCategories.Navigation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`${this}.pushViewControllerAnimated(${viewController}, ${animated}); depth = ${navDepth}`, Trace.categories.Navigation);
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -145,8 +144,8 @@ export class Frame extends FrameBase {
|
||||
}
|
||||
|
||||
this._ios.controller.setViewControllersAnimated(newControllers, animated);
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`${this}.setViewControllersAnimated([${viewController}], ${animated}); depth = ${navDepth}`, traceCategories.Navigation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`${this}.setViewControllersAnimated([${viewController}], ${animated}); depth = ${navDepth}`, Trace.categories.Navigation);
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -173,8 +172,8 @@ export class Frame extends FrameBase {
|
||||
|
||||
// replace the controllers instead of pushing directly
|
||||
this._ios.controller.setViewControllersAnimated(newControllers, animated);
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`${this}.setViewControllersAnimated([originalControllers - lastController + ${viewController}], ${animated}); depth = ${navDepth}`, traceCategories.Navigation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`${this}.setViewControllersAnimated([originalControllers - lastController + ${viewController}], ${animated}); depth = ${navDepth}`, Trace.categories.Navigation);
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -182,8 +181,8 @@ export class Frame extends FrameBase {
|
||||
|
||||
// General case.
|
||||
this._ios.controller.pushViewControllerAnimated(viewController, animated);
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`${this}.pushViewControllerAnimated(${viewController}, ${animated}); depth = ${navDepth}`, traceCategories.Navigation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`${this}.pushViewControllerAnimated(${viewController}, ${animated}); depth = ${navDepth}`, Trace.categories.Navigation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,8 +194,8 @@ export class Frame extends FrameBase {
|
||||
let animated = this._currentEntry ? this._getIsAnimatedNavigation(this._currentEntry.entry) : false;
|
||||
|
||||
this._updateActionBar(backstackEntry.resolvedPage);
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`${this}.popToViewControllerAnimated(${controller}, ${animated}); depth = ${navDepth}`, traceCategories.Navigation);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`${this}.popToViewControllerAnimated(${controller}, ${animated}); depth = ${navDepth}`, Trace.categories.Navigation);
|
||||
}
|
||||
|
||||
this._ios.controller.popToViewControllerAnimated(controller, animated);
|
||||
@@ -315,20 +314,20 @@ class TransitionDelegate extends NSObject {
|
||||
}
|
||||
|
||||
public animationWillStart(animationID: string, context: any): void {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`START ${this._id}`, traceCategories.Transition);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`START ${this._id}`, Trace.categories.Transition);
|
||||
}
|
||||
}
|
||||
|
||||
public animationDidStop(animationID: string, finished: boolean, context: any): void {
|
||||
if (finished) {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`END ${this._id}`, traceCategories.Transition);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`END ${this._id}`, Trace.categories.Transition);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`CANCEL ${this._id}`, traceCategories.Transition);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`CANCEL ${this._id}`, Trace.categories.Transition);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -374,8 +373,8 @@ class UINavigationControllerAnimatedDelegate extends NSObject implements UINavig
|
||||
return null;
|
||||
}
|
||||
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`UINavigationControllerImpl.navigationControllerAnimationControllerForOperationFromViewControllerToViewController(${operation}, ${fromVC}, ${toVC}), transition: ${JSON.stringify(navigationTransition)}`, traceCategories.NativeLifecycle);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`UINavigationControllerImpl.navigationControllerAnimationControllerForOperationFromViewControllerToViewController(${operation}, ${fromVC}, ${toVC}), transition: ${JSON.stringify(navigationTransition)}`, Trace.categories.NativeLifecycle);
|
||||
}
|
||||
|
||||
let curve = _getNativeCurve(navigationTransition);
|
||||
@@ -427,7 +426,7 @@ class UINavigationControllerImpl extends UINavigationController {
|
||||
let duration = navigationTransition.duration ? navigationTransition.duration / 1000 : _defaultTransitionDuration;
|
||||
let curve = _getNativeCurve(navigationTransition);
|
||||
|
||||
let transitionTraced = isCategorySet(traceCategories.Transition);
|
||||
let transitionTraced = Trace.isCategorySet(Trace.categories.Transition);
|
||||
let transitionDelegate: TransitionDelegate;
|
||||
if (transitionTraced) {
|
||||
let id = _getTransitionId(nativeTransition, transitionType);
|
||||
@@ -450,8 +449,8 @@ class UINavigationControllerImpl extends UINavigationController {
|
||||
@profile
|
||||
public pushViewControllerAnimated(viewController: UIViewController, animated: boolean): void {
|
||||
let navigationTransition = <NavigationTransition>viewController[TRANSITION];
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`UINavigationControllerImpl.pushViewControllerAnimated(${viewController}, ${animated}); transition: ${JSON.stringify(navigationTransition)}`, traceCategories.NativeLifecycle);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`UINavigationControllerImpl.pushViewControllerAnimated(${viewController}, ${animated}); transition: ${JSON.stringify(navigationTransition)}`, Trace.categories.NativeLifecycle);
|
||||
}
|
||||
|
||||
let nativeTransition = _getNativeTransition(navigationTransition, true);
|
||||
@@ -471,8 +470,8 @@ class UINavigationControllerImpl extends UINavigationController {
|
||||
let viewController = viewControllers.lastObject;
|
||||
let navigationTransition = <NavigationTransition>viewController[TRANSITION];
|
||||
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`UINavigationControllerImpl.setViewControllersAnimated(${viewControllers}, ${animated}); transition: ${JSON.stringify(navigationTransition)}`, traceCategories.NativeLifecycle);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`UINavigationControllerImpl.setViewControllersAnimated(${viewControllers}, ${animated}); transition: ${JSON.stringify(navigationTransition)}`, Trace.categories.NativeLifecycle);
|
||||
}
|
||||
|
||||
let nativeTransition = _getNativeTransition(navigationTransition, true);
|
||||
@@ -490,8 +489,8 @@ class UINavigationControllerImpl extends UINavigationController {
|
||||
public popViewControllerAnimated(animated: boolean): UIViewController {
|
||||
let lastViewController = this.viewControllers.lastObject;
|
||||
let navigationTransition = <NavigationTransition>lastViewController[TRANSITION];
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`UINavigationControllerImpl.popViewControllerAnimated(${animated}); transition: ${JSON.stringify(navigationTransition)}`, traceCategories.NativeLifecycle);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`UINavigationControllerImpl.popViewControllerAnimated(${animated}); transition: ${JSON.stringify(navigationTransition)}`, Trace.categories.NativeLifecycle);
|
||||
}
|
||||
|
||||
if (navigationTransition && navigationTransition.name === NON_ANIMATED_TRANSITION) {
|
||||
@@ -514,8 +513,8 @@ class UINavigationControllerImpl extends UINavigationController {
|
||||
public popToViewControllerAnimated(viewController: UIViewController, animated: boolean): NSArray<UIViewController> {
|
||||
let lastViewController = this.viewControllers.lastObject;
|
||||
let navigationTransition = <NavigationTransition>lastViewController[TRANSITION];
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`UINavigationControllerImpl.popToViewControllerAnimated(${viewController}, ${animated}); transition: ${JSON.stringify(navigationTransition)}`, traceCategories.NativeLifecycle);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`UINavigationControllerImpl.popToViewControllerAnimated(${viewController}, ${animated}); transition: ${JSON.stringify(navigationTransition)}`, Trace.categories.NativeLifecycle);
|
||||
}
|
||||
|
||||
if (navigationTransition && navigationTransition.name === NON_ANIMATED_TRANSITION) {
|
||||
@@ -544,7 +543,7 @@ class UINavigationControllerImpl extends UINavigationController {
|
||||
if (owner &&
|
||||
this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection &&
|
||||
this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
|
||||
owner.notify({ eventName: iosViewHelper.traitCollectionColorAppearanceChangedEvent, object: owner });
|
||||
owner.notify({ eventName: IOSHelper.traitCollectionColorAppearanceChangedEvent, object: owner });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -586,36 +585,36 @@ export function _getNativeCurve(transition: NavigationTransition): UIViewAnimati
|
||||
if (transition.curve) {
|
||||
switch (transition.curve) {
|
||||
case "easeIn":
|
||||
if (traceEnabled()) {
|
||||
traceWrite("Transition curve resolved to UIViewAnimationCurve.EaseIn.", traceCategories.Transition);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("Transition curve resolved to UIViewAnimationCurve.EaseIn.", Trace.categories.Transition);
|
||||
}
|
||||
|
||||
return UIViewAnimationCurve.EaseIn;
|
||||
|
||||
case "easeOut":
|
||||
if (traceEnabled()) {
|
||||
traceWrite("Transition curve resolved to UIViewAnimationCurve.EaseOut.", traceCategories.Transition);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("Transition curve resolved to UIViewAnimationCurve.EaseOut.", Trace.categories.Transition);
|
||||
}
|
||||
|
||||
return UIViewAnimationCurve.EaseOut;
|
||||
|
||||
case "easeInOut":
|
||||
if (traceEnabled()) {
|
||||
traceWrite("Transition curve resolved to UIViewAnimationCurve.EaseInOut.", traceCategories.Transition);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("Transition curve resolved to UIViewAnimationCurve.EaseInOut.", Trace.categories.Transition);
|
||||
}
|
||||
|
||||
return UIViewAnimationCurve.EaseInOut;
|
||||
|
||||
case "linear":
|
||||
if (traceEnabled()) {
|
||||
traceWrite("Transition curve resolved to UIViewAnimationCurve.Linear.", traceCategories.Transition);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("Transition curve resolved to UIViewAnimationCurve.Linear.", Trace.categories.Transition);
|
||||
}
|
||||
|
||||
return UIViewAnimationCurve.Linear;
|
||||
|
||||
default:
|
||||
if (traceEnabled()) {
|
||||
traceWrite("Transition curve resolved to original: " + transition.curve, traceCategories.Transition);
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("Transition curve resolved to original: " + transition.curve, Trace.categories.Transition);
|
||||
}
|
||||
|
||||
return transition.curve;
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
/**
|
||||
* @module "ui/frame/transition-definitions.android
|
||||
* @private
|
||||
*/ /** */
|
||||
|
||||
// Definitions for Android API lvl 21 transitions
|
||||
declare module android {
|
||||
export module transition {
|
||||
|
||||
8
nativescript-core/ui/gestures/gestures.d.ts
vendored
8
nativescript-core/ui/gestures/gestures.d.ts
vendored
@@ -1,9 +1,5 @@
|
||||
/**
|
||||
* Contains the GesturesObserver class, which lets you observe and respond to user gestures.
|
||||
* @module "ui/gestures"
|
||||
*/ /** */
|
||||
|
||||
import { View, EventData } from "../core/view";
|
||||
import { View } from "../core/view";
|
||||
import { EventData } from "../../data/observable";
|
||||
|
||||
/**
|
||||
* Defines an enum with supported gesture types.
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { Style, CssProperty } from "../core/properties";
|
||||
import { View, Property, CSSType } from "../core/view";
|
||||
import { CssProperty } from "../core/properties";
|
||||
import { View, CSSType } from "../core/view";
|
||||
import { Property } from "../core/properties";
|
||||
import { Style } from "../styling/style";
|
||||
import { Color } from "../../color";
|
||||
import { HtmlView as HtmlViewDefinition } from ".";
|
||||
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
/**
|
||||
* Contains the HtmlView class, which represents a standard html view widget.
|
||||
* @module "ui/html-view"
|
||||
*/ /** */
|
||||
|
||||
import { View, Property } from "../core/view";
|
||||
import { View } from "../core/view";
|
||||
import { Property } from "../core/properties";
|
||||
|
||||
/**
|
||||
* Represents a view with html content. Use this component instead WebView when you want to show just static HTML content.
|
||||
@@ -5,10 +5,11 @@ import {
|
||||
fontInternalProperty,
|
||||
} from "../styling/style-properties";
|
||||
import {
|
||||
HtmlViewBase, View, layout, htmlProperty, fontSizeProperty,
|
||||
HtmlViewBase, htmlProperty,
|
||||
linkColorProperty,
|
||||
} from "./html-view-common";
|
||||
import { ios } from "../../utils/utils";
|
||||
import { View } from '../core/view';
|
||||
import { ios, layout } from "../../utils/utils";
|
||||
|
||||
export * from "./html-view-common";
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"name": "html-view",
|
||||
"main": "html-view",
|
||||
"types": "html-view.d.ts"
|
||||
}
|
||||
@@ -1,9 +1,4 @@
|
||||
/**
|
||||
* Contains the Cache class, which handles image download requests and caches the already downloaded images.
|
||||
* @module "ui/image-cache"
|
||||
*/ /** */
|
||||
|
||||
import { Observable, EventData } from "../../data/observable";
|
||||
import { Observable, EventData } from "../../data/observable";
|
||||
import { ImageSource } from "../../image-source";
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
import { Image as ImageDefinition, Stretch } from ".";
|
||||
import { View, Property, InheritedCssProperty, Length, Style, Color, isIOS, booleanConverter, CSSType, traceEnabled, traceWrite, traceCategories } from "../core/view";
|
||||
import { View, CSSType } from "../core/view";
|
||||
import { booleanConverter } from "../core/view-base";
|
||||
import { ImageAsset } from "../../image-asset";
|
||||
import { ImageSource } from "../../image-source";
|
||||
import { isDataURI, isFontIconURI, isFileOrResourcePath, RESOURCE_PREFIX } from "../../utils/utils";
|
||||
export * from "../core/view";
|
||||
export { ImageSource, ImageAsset, isDataURI, isFontIconURI, isFileOrResourcePath, RESOURCE_PREFIX };
|
||||
import { Color } from "../../color";
|
||||
import { isIOS } from "../../platform";
|
||||
import { Style } from "../styling/style";
|
||||
import { Length } from "../styling/style-properties";
|
||||
import { Property, InheritedCssProperty, } from "../core/properties";
|
||||
import { Trace } from "../../trace";
|
||||
|
||||
@CSSType("Image")
|
||||
export abstract class ImageBase extends View implements ImageDefinition {
|
||||
@@ -89,11 +94,11 @@ export abstract class ImageBase extends View implements ImageDefinition {
|
||||
}, err => {
|
||||
// catch: Response content may not be converted to an Image
|
||||
this.isLoading = false;
|
||||
if (traceEnabled()) {
|
||||
if (Trace.isEnabled()) {
|
||||
if (typeof err === "object" && err.message) {
|
||||
err = err.message;
|
||||
}
|
||||
traceWrite(err, traceCategories.Debug);
|
||||
Trace.write(err, Trace.categories.Debug);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
11
nativescript-core/ui/image/image.d.ts
vendored
11
nativescript-core/ui/image/image.d.ts
vendored
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Contains the Image class, which represents an image widget.
|
||||
* @module "ui/image"
|
||||
*/ /** */
|
||||
|
||||
import { View, Property, InheritedCssProperty, Color, Style, Length } from "../core/view";
|
||||
import { View } from "../core/view";
|
||||
import { Style } from "../styling/style"
|
||||
import { ImageSource } from "../../image-source";
|
||||
import { Color } from "../../color";
|
||||
import { Property, InheritedCssProperty } from "../core/properties";
|
||||
import { Length } from '../styling/style-properties';
|
||||
|
||||
/**
|
||||
* Represents a class that provides functionality for loading and streching image(s).
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import {
|
||||
ImageSource, ImageBase, stretchProperty, imageSourceProperty, tintColorProperty, srcProperty, layout, Color,
|
||||
traceEnabled, traceWrite, traceCategories
|
||||
ImageBase, stretchProperty, imageSourceProperty, tintColorProperty, srcProperty
|
||||
} from "./image-common";
|
||||
import { ImageSource } from "../../image-source";
|
||||
import { Color } from "../../color";
|
||||
import { Trace } from "../../trace";
|
||||
import { layout } from "../../utils/utils";
|
||||
|
||||
export * from "./image-common";
|
||||
|
||||
@@ -76,10 +79,10 @@ export class Image extends ImageBase {
|
||||
measureWidth = finiteWidth ? Math.min(resultW, width) : resultW;
|
||||
measureHeight = finiteHeight ? Math.min(resultH, height) : resultH;
|
||||
|
||||
if (traceEnabled()) {
|
||||
traceWrite("Image stretch: " + this.stretch +
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write("Image stretch: " + this.stretch +
|
||||
", nativeWidth: " + nativeWidth +
|
||||
", nativeHeight: " + nativeHeight, traceCategories.Layout);
|
||||
", nativeHeight: " + nativeHeight, Trace.categories.Layout);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,11 +7,12 @@ export { Button } from "./button";
|
||||
export { ContentView } from "./content-view";
|
||||
export { ViewBase, ShowModalOptions } from "./core/view-base";
|
||||
export { View, Template, KeyedTemplate, ShownModallyData } from "./core/view";
|
||||
export { Property, CoercibleProperty, InheritedProperty, CssProperty, InheritedCssProperty, ShorthandProperty, CssAnimationProperty, } from "./core/properties";
|
||||
export { DatePicker } from "./date-picker";
|
||||
|
||||
// No need go export dialogs, they are already export exported globally
|
||||
// import { action, alert, confirm, login, prompt } from "./dialogs";
|
||||
// export const nsDialogs = { action, alert, confirm, login, prompt };
|
||||
import { action, alert, confirm, login, prompt } from "./dialogs";
|
||||
export const Dialogs = { action, alert, confirm, login, prompt };
|
||||
|
||||
export * from "./editable-text-base";
|
||||
export { Frame, NavigationEntry, NavigationContext, NavigationTransition, BackstackEntry, ViewEntry } from "./frame";
|
||||
|
||||
7
nativescript-core/ui/label/label.d.ts
vendored
7
nativescript-core/ui/label/label.d.ts
vendored
@@ -1,9 +1,4 @@
|
||||
/**
|
||||
* Contains the Label class, which represents a standard label widget.
|
||||
* @module "ui/label"
|
||||
*/ /** */
|
||||
|
||||
import { TextBase } from "../text-base";
|
||||
import { TextBase } from "../text-base";
|
||||
|
||||
/**
|
||||
* Represents a text label.
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/**
|
||||
* @module "ui/layouts/absolute-layout"
|
||||
*/ /** */
|
||||
|
||||
import { LayoutBase, View, Property, Length } from "../layout-base";
|
||||
import { LayoutBase } from "../layout-base";
|
||||
import { Property } from "../../core/properties";
|
||||
import { View } from '../../core/view';
|
||||
import { Length } from '../../styling/style-properties';
|
||||
|
||||
/**
|
||||
* A layout that lets you specify exact locations (left/top coordinates) of its children.
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
/**
|
||||
* @module "ui/layouts/dock-layout"
|
||||
*/ /** */
|
||||
|
||||
import { LayoutBase, View, Property } from "../layout-base";
|
||||
import { LayoutBase } from "../layout-base";
|
||||
import { Property } from "../../core/properties";
|
||||
import { View } from '../../core/view';
|
||||
|
||||
/**
|
||||
* A Layout that arranges its children at its outer edges, and allows its last child to take up the remaining space.
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/**
|
||||
* @module "ui/layouts/flexbox-layout"
|
||||
*/ /** */
|
||||
|
||||
import { LayoutBase, View, Style, CssProperty } from "../layout-base";
|
||||
import { LayoutBase } from "../layout-base";
|
||||
import { Style } from '../../styling/style';
|
||||
import { CssProperty } from "../../core/properties";
|
||||
import { View } from '../../core/view';
|
||||
|
||||
export type FlexDirection = "row" | "row-reverse" | "column" | "column-reverse";
|
||||
export type FlexWrap = "nowrap" | "wrap" | "wrap-reverse";
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
/**
|
||||
* @module "ui/layouts/grid-layout"
|
||||
*/ /** */
|
||||
|
||||
import { LayoutBase, Property, View } from "../layout-base";
|
||||
import { LayoutBase } from "../layout-base";
|
||||
import { View } from '../../core/view';
|
||||
import { Property } from "../../core/properties";
|
||||
|
||||
/**
|
||||
* Defines row/column specific properties that apply to GridLayout elements.
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { LayoutBase as LayoutBaseDefinition } from "./layout-base";
|
||||
import { View, CustomLayoutView, Property, AddChildFromBuilder, getViewById, Length, booleanConverter } from "../core/view";
|
||||
|
||||
export * from "../core/view";
|
||||
import { View, CustomLayoutView, AddChildFromBuilder, } from "../core/view";
|
||||
import { booleanConverter, getViewById } from "../core/view-base";
|
||||
import { Property } from "../core/properties";
|
||||
import { Length } from "../styling/style-properties";
|
||||
|
||||
export class LayoutBaseCommon extends CustomLayoutView implements LayoutBaseDefinition, AddChildFromBuilder {
|
||||
|
||||
|
||||
10
nativescript-core/ui/layouts/layout-base.d.ts
vendored
10
nativescript-core/ui/layouts/layout-base.d.ts
vendored
@@ -1,10 +1,6 @@
|
||||
/**
|
||||
* @module "ui/layouts/layout-base"
|
||||
*/ /** */
|
||||
|
||||
import { View, CustomLayoutView, Property, Length } from "../core/view";
|
||||
|
||||
export * from "../core/view";
|
||||
import { View, CustomLayoutView } from "../core/view";
|
||||
import { Property } from "../core/properties";
|
||||
import { Length } from "../styling/style-properties";
|
||||
|
||||
/**
|
||||
* Base class for all views that supports children positioning.
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/**
|
||||
* @module "ui/layouts/stack-layout"
|
||||
*/ /** */
|
||||
import { LayoutBase, Property } from "../layout-base";
|
||||
import { LayoutBase } from "../layout-base";
|
||||
import { Property } from "../../core/properties";
|
||||
|
||||
/**
|
||||
* A Layout that arranges its children horizontally or vertically. The direction can be set by orientation property.
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
/**
|
||||
* @module "ui/layouts/wrap-layout"
|
||||
*/ /** */
|
||||
|
||||
import { LayoutBase, Property, Length } from "../layout-base";
|
||||
import { LayoutBase } from "../layout-base";
|
||||
import { Length } from '../../styling/style-properties';
|
||||
import { Property } from "../../core/properties";
|
||||
|
||||
/**
|
||||
* WrapLayout position children in rows or columns depending on orientation property
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { ListPickerBase, selectedIndexProperty, itemsProperty, colorProperty, Color } from "./list-picker-common";
|
||||
import { ItemsSource } from ".";
|
||||
import { ListPickerBase, selectedIndexProperty, itemsProperty, ItemsSource } from "./list-picker-common";
|
||||
import { colorProperty } from '../styling/style-properties';
|
||||
import { Color } from '../../color';
|
||||
import { device } from "../../platform";
|
||||
import lazy from "../../utils/lazy";
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
/**
|
||||
* Contains the ListPicker class.
|
||||
* @module "ui/list-picker"
|
||||
*/ /** */
|
||||
|
||||
import { View, Property } from "../core/view";
|
||||
import { View } from "../core/view";
|
||||
import { Property } from "../core/properties";
|
||||
import { ItemsSource } from "./list-picker-common";
|
||||
|
||||
/**
|
||||
* Represents an list picker.
|
||||
@@ -31,10 +28,5 @@ export class ListPicker extends View {
|
||||
items: any;
|
||||
}
|
||||
|
||||
export interface ItemsSource {
|
||||
length: number;
|
||||
getItem(index: number): any;
|
||||
}
|
||||
|
||||
export const selectedIndexProperty: Property<ListPicker, number>;
|
||||
export const itemsProperty: Property<ListPicker, any[] | ItemsSource>;
|
||||
@@ -1,5 +1,6 @@
|
||||
import { ListPickerBase, Color, selectedIndexProperty, itemsProperty, backgroundColorProperty, colorProperty } from "./list-picker-common";
|
||||
import { ItemsSource } from ".";
|
||||
import { ListPickerBase, selectedIndexProperty, itemsProperty, ItemsSource } from "./list-picker-common";
|
||||
import { Color } from "../../color";
|
||||
import { backgroundColorProperty, colorProperty } from "../styling/style-properties";
|
||||
import { profile } from "../../profiling";
|
||||
|
||||
export * from "./list-picker-common";
|
||||
@@ -1,10 +1,13 @@
|
||||
import { ListPicker as ListPickerDefinition, ItemsSource } from ".";
|
||||
import { View, Property, CoercibleProperty, CSSType } from "../core/view";
|
||||
import { View, CSSType } from "../core/view";
|
||||
import { Property, CoercibleProperty } from "../core/properties";
|
||||
|
||||
export * from "../core/view";
|
||||
export interface ItemsSource {
|
||||
length: number;
|
||||
getItem(index: number): any;
|
||||
}
|
||||
|
||||
@CSSType("ListPicker")
|
||||
export class ListPickerBase extends View implements ListPickerDefinition {
|
||||
export class ListPickerBase extends View {
|
||||
|
||||
public selectedIndex: number;
|
||||
public items: any[] | ItemsSource;
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"name": "list-picker",
|
||||
"main": "list-picker",
|
||||
"types": "list-picker.d.ts"
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Contains the ListView class, which represents a standard list view widget.
|
||||
* @module "ui/list-view"
|
||||
*/ /** */
|
||||
|
||||
import { EventData, View, Template, KeyedTemplate, Length, Property, CssProperty, Color, Style } from "../core/view";
|
||||
import { View, Template, KeyedTemplate } from "../core/view";
|
||||
import { Color } from '../../color';
|
||||
import { EventData } from '../../data/observable';
|
||||
import { Length } from '../styling/style-properties';
|
||||
import { Style } from '../styling/style';
|
||||
import { Property, CssProperty } from "../core/properties";
|
||||
|
||||
/**
|
||||
* Known template names.
|
||||
@@ -1,12 +1,17 @@
|
||||
import { ItemEventData } from ".";
|
||||
import {
|
||||
ListViewBase, View, KeyedTemplate, Length, Observable, Color,
|
||||
separatorColorProperty, itemTemplatesProperty, iosEstimatedRowHeightProperty, layout, EventData
|
||||
ListViewBase,
|
||||
separatorColorProperty, itemTemplatesProperty, iosEstimatedRowHeightProperty
|
||||
} from "./list-view-common";
|
||||
import { View, KeyedTemplate } from "../core/view";
|
||||
import { Length } from "../styling/style-properties";
|
||||
import { Observable, EventData } from "../../data/observable";
|
||||
import { Color } from "../../color";
|
||||
import { layout } from "../../utils/utils";
|
||||
import { StackLayout } from "../layouts/stack-layout";
|
||||
import { ProxyViewContainer } from "../proxy-view-container";
|
||||
import { profile } from "../../profiling";
|
||||
import * as trace from "../../trace";
|
||||
import { Trace } from "../../trace";
|
||||
|
||||
export * from "./list-view-common";
|
||||
|
||||
@@ -311,8 +316,8 @@ export class ListView extends ListViewBase {
|
||||
|
||||
this.ios.scrollToRowAtIndexPathAtScrollPositionAnimated(NSIndexPath.indexPathForItemInSection(index, 0),
|
||||
UITableViewScrollPosition.Top, animated);
|
||||
} else if (trace.isEnabled()) {
|
||||
trace.write(`Cannot scroll listview to index ${index} when listview items not set`, trace.categories.Binding);
|
||||
} else if (Trace.isEnabled()) {
|
||||
Trace.write(`Cannot scroll listview to index ${index} when listview items not set`, Trace.categories.Binding);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
import { ListView as ListViewDefinition, ItemsSource, ItemEventData, TemplatedItemsView } from ".";
|
||||
import { CoercibleProperty, CssProperty, Style, View, ContainerView, Template, KeyedTemplate, Length, Property, Color, Observable, EventData, CSSType } from "../core/view";
|
||||
import { View, ContainerView, Template, KeyedTemplate, CSSType } from "../core/view";
|
||||
import { Property, CoercibleProperty, CssProperty } from "../core/properties";
|
||||
import { Length } from "../styling/style-properties";
|
||||
import { Style } from "../styling/style";
|
||||
import { Color } from "../../color";
|
||||
import { Builder } from "../builder";
|
||||
import { Label } from "../label";
|
||||
import { Observable, EventData } from "../../data/observable";
|
||||
import { ObservableArray, ChangedData } from "../../data/observable-array";
|
||||
import { addWeakEventListener, removeWeakEventListener } from "../core/weak-event-listener";
|
||||
|
||||
export * from "../core/view";
|
||||
|
||||
// TODO: Think of a way to register these instead of relying on hardcoded values.
|
||||
export module knownTemplates {
|
||||
export const itemTemplate = "itemTemplate";
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"name": "list-view",
|
||||
"main": "list-view",
|
||||
"types": "list-view.d.ts"
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
import { View, PageBase, Color, actionBarHiddenProperty, statusBarStyleProperty, androidStatusBarBackgroundProperty } from "./page-common";
|
||||
import { PageBase, actionBarHiddenProperty, statusBarStyleProperty, androidStatusBarBackgroundProperty } from "./page-common";
|
||||
import { View } from "../core/view";
|
||||
import { Color } from "../../color";
|
||||
import { ActionBar } from "../action-bar";
|
||||
import { GridLayout } from "../layouts/grid-layout";
|
||||
import { device } from "../../platform";
|
||||
@@ -1,17 +1,11 @@
|
||||
/**
|
||||
* Contains the Page class, which represents a logical unit for navigation inside a Frame.
|
||||
* @module "ui/page"
|
||||
*/ /** */
|
||||
|
||||
/// <reference path="../../tns-core-modules.d.ts" />
|
||||
|
||||
import { ShownModallyData } from "../core/view";
|
||||
import { ContentView, EventData, Property, Color, CssProperty, Style } from "../content-view";
|
||||
import { CssProperty, Property } from "../core/properties";
|
||||
import { Style } from "../styling/style";
|
||||
import { EventData } from "../../data/observable";
|
||||
import { ContentView } from "../content-view";
|
||||
import { Frame } from "../frame";
|
||||
import { ActionBar } from "../action-bar";
|
||||
import { KeyframeAnimationInfo } from "../animation/keyframe-animation";
|
||||
|
||||
export * from "../content-view";
|
||||
import { Color } from "../../color";
|
||||
|
||||
/**
|
||||
* Defines the data for the page navigation events.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user