mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
Merge pull request #3343 from NativeScript/cankov/modules30-lint-free
Fix tslint errors
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
import { EventData, TextBase, TextDecoration } from "ui/text-base";
|
||||
import { Page } from "ui/page";
|
||||
|
||||
const possibleValues = [
|
||||
TextDecoration.NONE,
|
||||
|
@ -1,5 +1,4 @@
|
||||
import * as stack from "ui/layouts/stack-layout";
|
||||
import * as style from "ui/styling/style";
|
||||
import * as view from "ui/core/view";
|
||||
import { unsetValue } from "ui/core/view";
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as model from "./myview";
|
||||
import { Button } from "ui/button";
|
||||
import { Page } from "ui/page";
|
||||
import { GridLayout, ItemSpec, GridUnitType } from "ui/layouts/grid-layout";
|
||||
import { GridLayout, ItemSpec } from "ui/layouts/grid-layout";
|
||||
|
||||
export function onLoaded(args: { eventName: string, object: any }) {
|
||||
var page = <Page>args.object;
|
||||
|
@ -1,13 +1,14 @@
|
||||
import * as style from "ui/styling/style";
|
||||
import {PropertyMetadata, PropertyMetadataSettings} from "ui/core/dependency-observable";
|
||||
import * as view from "ui/core/view";
|
||||
import * as buttonModule from "ui/button";
|
||||
import * as buttonModule from "ui/button";
|
||||
import * as pages from "ui/page";
|
||||
import * as stackLayoutDef from "ui/layouts/stack-layout";
|
||||
import {isAndroid} from "platform";
|
||||
|
||||
// import {isAndroid} from "platform";
|
||||
// import * as style from "ui/styling/style";
|
||||
// import {PropertyMetadata, PropertyMetadataSettings} from "ui/core/dependency-observable";
|
||||
// import * as view from "ui/core/view";
|
||||
|
||||
// on Android we explicitly set propertySettings to None because android will invalidate its layout (skip unnecessary native call).
|
||||
let AffectsLayout = isAndroid ? PropertyMetadataSettings.None : PropertyMetadataSettings.AffectsLayout;
|
||||
// let AffectsLayout = isAndroid ? PropertyMetadataSettings.None : PropertyMetadataSettings.AffectsLayout;
|
||||
|
||||
// export var fontFamilyProperty = new styleProperty.Property("fontFamily", "font-family", new PropertyMetadata(undefined, AffectsLayout));
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
import * as stack from "ui/layouts/stack-layout";
|
||||
import * as style from "ui/styling/style";
|
||||
import {unsetValue} from "ui/core/view";
|
||||
|
||||
export function buttonTap(args) {
|
||||
|
@ -1,8 +1,7 @@
|
||||
import * as p from "ui/page";
|
||||
import * as gridModule from "ui/layouts/grid-layout";
|
||||
import * as gridModule from "ui/layouts/grid-layout";
|
||||
import * as sp from "ui/layouts/stack-layout";
|
||||
import * as button from "ui/button";
|
||||
import * as enums from "ui/enums";
|
||||
import { Page } from "ui/page";
|
||||
|
||||
export function createPage() {
|
||||
var StackLayout = new sp.StackLayout();
|
||||
@ -48,7 +47,7 @@ export function createPage() {
|
||||
grid.addColumn(new gridModule.ItemSpec());
|
||||
grid.addColumn(new gridModule.ItemSpec());
|
||||
|
||||
var page = new p.Page();
|
||||
var page = new Page();
|
||||
//page.content = GridLayout;
|
||||
page.content = StackLayout;
|
||||
var x = 1;
|
||||
|
@ -1,5 +1,4 @@
|
||||
import * as enums from "ui/enums";
|
||||
import * as pageModule from "ui/page";
|
||||
import * as pageModule from "ui/page";
|
||||
import * as buttonModule from "ui/button";
|
||||
import * as stackModule from "ui/layouts/stack-layout";
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
import * as pages from "ui/page";
|
||||
import * as imageSource from "image-source";
|
||||
import * as gridModule from "ui/layouts/grid-layout";
|
||||
import * as enums from "ui/enums";
|
||||
import * as img from "ui/image";
|
||||
|
||||
export function createPage() {
|
||||
|
@ -8,7 +8,6 @@ import * as labelModule from "ui/label";
|
||||
import * as color from "color";
|
||||
|
||||
import {SelectorCore} from "ui/styling/css-selector";
|
||||
import { unsetValue } from "ui/core/view";
|
||||
|
||||
//import * as styling from "ui/styling";
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { Observable, fromObjectRecursive } from "data/observable";
|
||||
import { Observable, fromObjectRecursive } from "data/observable";
|
||||
import { ViewBase } from "ui/core/view-base";
|
||||
import { BindingOptions } from "ui/core/bindable";
|
||||
|
||||
import * as TKUnit from "../TKUnit";
|
||||
import * as types from "utils/types";
|
||||
import * as helper from "../ui/helper";
|
||||
|
@ -5,7 +5,6 @@ import * as stackLayoutModule from "ui/layouts/stack-layout";
|
||||
import * as button from "ui/button";
|
||||
import * as TKUnit from "../TKUnit";
|
||||
import * as utils from "utils/utils";
|
||||
import * as types from "utils/types";
|
||||
import * as platform from "platform";
|
||||
import * as colorModule from "color";
|
||||
import * as formattedStringModule from "text/formatted-string";
|
||||
|
@ -18,7 +18,6 @@ import * as ImageSourceModule from "image-source";
|
||||
import * as ViewModule from "ui/core/view";
|
||||
import * as helper from "../helper";
|
||||
import * as ObservableModule from "data/observable";
|
||||
import * as enumsModule from "ui/enums";
|
||||
import * as fs from "file-system";
|
||||
import * as color from "color";
|
||||
|
||||
|
@ -10,7 +10,6 @@ import * as colorModule from "color";
|
||||
import * as utils from "utils/utils";
|
||||
import * as observableModule from "data/observable";
|
||||
import * as bindable from "ui/core/bindable";
|
||||
import * as textBase from "ui/text-base";
|
||||
import * as enums from "ui/enums";
|
||||
import * as labelTestsNative from "./label-tests-native";
|
||||
import * as fs from "file-system";
|
||||
|
@ -1,6 +1,5 @@
|
||||
import * as TKUnit from "../../TKUnit";
|
||||
import * as layoutHelper from "./layout-helper";
|
||||
import * as enums from "ui/enums";
|
||||
import * as testModule from "../../ui-test";
|
||||
import {LayoutBase, unsetValue, PercentLength} from "ui/layouts/layout-base";
|
||||
import * as platform from "platform";
|
||||
|
@ -3,9 +3,7 @@ import { DockLayout } from "ui/layouts/dock-layout";
|
||||
import * as TKUnit from "../../TKUnit";
|
||||
import * as helper from "./layout-helper";
|
||||
import * as testModule from "../../ui-test";
|
||||
import * as layoutHelper from "./layout-helper";
|
||||
import * as commonTests from "./common-layout-tests";
|
||||
import { PercentLength } from "ui/core/view";
|
||||
|
||||
// >> dock-layout-require
|
||||
import * as dockModule from "ui/layouts/dock-layout";
|
||||
|
@ -5,7 +5,6 @@ import * as TKUnit from "../../TKUnit";
|
||||
import * as view from "ui/core/view";
|
||||
import { unsetValue } from "ui/core/view";
|
||||
import * as builder from "ui/builder";
|
||||
import * as enums from "ui/enums";
|
||||
import * as testModule from "../../ui-test";
|
||||
import * as layoutHelper from "./layout-helper";
|
||||
import * as platform from "platform";
|
||||
|
@ -8,10 +8,6 @@ import * as commonTests from "./common-layout-tests";
|
||||
import * as wrapLayoutModule from "ui/layouts/wrap-layout";
|
||||
// << wrap-layout-require
|
||||
|
||||
// >> wrap-layout-others
|
||||
import * as enums from "ui/enums";
|
||||
// << wrap-layout-others
|
||||
|
||||
export class WrapLayoutTest extends testModule.UITest<wrapLayoutModule.WrapLayout> {
|
||||
|
||||
public create(): wrapLayoutModule.WrapLayout {
|
||||
|
@ -21,9 +21,6 @@ Using a WrapLayout requires the WrapLayout module.
|
||||
</Page>
|
||||
```
|
||||
|
||||
Other frequently used modules when working with a WrapLayout include:
|
||||
{%snippet wrap-layout-others%}
|
||||
|
||||
## Creating a WrapLayout
|
||||
{%snippet wrap-layout-new%}
|
||||
|
||||
|
@ -22,7 +22,7 @@ import { Label } from "ui/label";
|
||||
import { EventData } from "data/observable";
|
||||
import { PercentLength } from "ui/core/view";
|
||||
import * as platform from "platform";
|
||||
import {unsetValue, Length} from "ui/core/view";
|
||||
import {unsetValue} from "ui/core/view";
|
||||
|
||||
export function addLabelToPage(page: Page, text?: string) {
|
||||
let label = new Label();
|
||||
|
@ -9,8 +9,6 @@ import * as tabViewModule from "ui/tab-view";
|
||||
import * as helper from "../../ui/helper";
|
||||
import * as types from "utils/types";
|
||||
import * as viewModule from "ui/core/view";
|
||||
import * as styleModule from "ui/styling/style";
|
||||
import * as dependencyObservableModule from "ui/core/dependency-observable";
|
||||
import { resolveFileNameFromUrl } from "ui/styling/style-scope";
|
||||
import { unsetValue } from "ui/core/view";
|
||||
|
||||
|
@ -13,7 +13,6 @@ import * as layoutModule from "ui/layouts/layout";
|
||||
import * as observable from "data/observable";
|
||||
import * as bindable from "ui/core/bindable";
|
||||
import * as definition from "./view-tests";
|
||||
import * as enums from "ui/enums";
|
||||
import * as absoluteLayoutModule from "ui/layouts/absolute-layout";
|
||||
|
||||
export var test_eachDescendant = function () {
|
||||
|
@ -1,7 +1,6 @@
|
||||
/* tslint:disable:class-name */
|
||||
import * as definition from "platform";
|
||||
import * as utils from "utils/utils";
|
||||
import * as enumsModule from "ui/enums";
|
||||
|
||||
const MIN_TABLET_PIXELS = 600;
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
NavigationButton
|
||||
} from "ui/action-bar";
|
||||
import { Page } from "ui/page";
|
||||
import { View, ViewBase, Bindable, Property, unsetValue, horizontalAlignmentProperty, verticalAlignmentProperty, HorizontalAlignment, VerticalAlignment } from "ui/core/view";
|
||||
import { View, ViewBase, Property, unsetValue, horizontalAlignmentProperty, verticalAlignmentProperty, HorizontalAlignment, VerticalAlignment } from "ui/core/view";
|
||||
|
||||
export * from "ui/core/view";
|
||||
|
||||
@ -339,7 +339,6 @@ function onTitlePropertyChanged(actionBar: ActionBarBase, oldValue: string, newV
|
||||
let titleProperty = new Property<ActionBarBase, string>({ name: "title", valueChanged: onTitlePropertyChanged });
|
||||
titleProperty.register(ActionBarBase);
|
||||
|
||||
|
||||
function onItemChanged(item: ActionItemBase, oldValue: string, newValue: string) {
|
||||
if (item.actionBar) {
|
||||
item.actionBar.update();
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { AndroidActionBarSettings as AndroidActionBarSettingsDefinition, AndroidActionItemSettings } from "ui/action-bar";
|
||||
import { ActionItemBase, ActionBarBase, isVisible, View, colorProperty, Color } from "./action-bar-common";
|
||||
import { ActionItemBase, ActionBarBase, isVisible, View, colorProperty } from "./action-bar-common";
|
||||
import { RESOURCE_PREFIX } from "utils/utils";
|
||||
import { fromFileOrResource } from "image-source";
|
||||
import * as application from "application";
|
||||
@ -331,7 +331,6 @@ export class ActionBar extends ActionBarBase {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
get [colorProperty.native](): number {
|
||||
if (!defaultTitleTextColor) {
|
||||
let textView = new android.widget.TextView(this._context);
|
||||
|
22
tns-core-modules/ui/action-bar/action-bar.d.ts
vendored
22
tns-core-modules/ui/action-bar/action-bar.d.ts
vendored
@ -2,7 +2,7 @@
|
||||
* Contains the action bar related classes.
|
||||
*/
|
||||
declare module "ui/action-bar" {
|
||||
import { EventData, ViewBase, View, AddArrayFromBuilder, AddChildFromBuilder, Property } from "ui/core/view";
|
||||
import { EventData, ViewBase, View, AddArrayFromBuilder, AddChildFromBuilder } from "ui/core/view";
|
||||
import { Page } from "ui/page";
|
||||
|
||||
/**
|
||||
@ -239,26 +239,6 @@ declare module "ui/action-bar" {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* String value used when hooking to tap event.
|
||||
*/
|
||||
let tapEvent: string;
|
||||
|
||||
/**
|
||||
* Represents the observable property backing the text property.
|
||||
*/
|
||||
let textProperty: Property<ActionItem, string>;
|
||||
|
||||
/**
|
||||
* Represents the observable property backing the icon property.
|
||||
*/
|
||||
let iconProperty: Property<ActionItem, string>;
|
||||
|
||||
/**
|
||||
* Represents the observable property backing the visibility property.
|
||||
*/
|
||||
let visibilityProperty: Property<ActionItem, string>;
|
||||
|
||||
/** @internal */
|
||||
export function _setNavBarColor(navBar: any /* UINavigationBar */, color: any /* UIColor */);
|
||||
/** @internal */
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { IOSActionItemSettings, ActionItem as ActionItemDefinition } from "ui/action-bar";
|
||||
import { ActionItemBase, ActionBarBase, isVisible, View, colorProperty, backgroundColorProperty, backgroundInternalProperty, Color, Background, layout } from "./action-bar-common";
|
||||
import { Frame, topmost as topmostFrame } from "ui/frame";
|
||||
import { ActionItemBase, ActionBarBase, isVisible, View, colorProperty, backgroundColorProperty, backgroundInternalProperty, layout } from "./action-bar-common";
|
||||
import { ImageSource, fromFileOrResource } from "image-source";
|
||||
|
||||
export * from "./action-bar-common";
|
||||
@ -319,7 +318,6 @@ export class ActionBar extends ActionBarBase {
|
||||
get [backgroundInternalProperty.native](): UIColor {
|
||||
return null;
|
||||
}
|
||||
set [backgroundInternalProperty.native](value: UIColor) {
|
||||
|
||||
set [backgroundInternalProperty.native](value: UIColor) { // tslint:disable-line
|
||||
}
|
||||
}
|
@ -3,7 +3,6 @@
|
||||
*/
|
||||
declare module "ui/activity-indicator" {
|
||||
import { View } from "ui/core/view";
|
||||
import { Property } from "ui/core/properties";
|
||||
|
||||
/**
|
||||
* Represents a UI widget which displays a progress indicator hinting the user for some background operation running.
|
||||
@ -24,9 +23,4 @@ declare module "ui/activity-indicator" {
|
||||
*/
|
||||
busy: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the busy property of the ActivityIndicator class.
|
||||
*/
|
||||
let busyProperty: Property<ActivityIndicator, boolean>;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
import { ActivityIndicatorBase, busyProperty, colorProperty, visibilityProperty, Visibility } from "./activity-indicator-common";
|
||||
import { ActivityIndicatorBase, busyProperty, colorProperty } from "./activity-indicator-common";
|
||||
import { ios } from "utils/utils";
|
||||
|
||||
export * from "./activity-indicator-common";
|
||||
|
@ -172,7 +172,7 @@ export class Animation extends AnimationBase {
|
||||
return _resolveAnimationCurve(curve);
|
||||
}
|
||||
|
||||
private _onAndroidAnimationEnd() {
|
||||
private _onAndroidAnimationEnd() { // tslint:disable-line
|
||||
if (!this.isPlaying) {
|
||||
// It has been cancelled
|
||||
return;
|
||||
@ -187,7 +187,7 @@ export class Animation extends AnimationBase {
|
||||
this._resolveAnimationFinishedPromise();
|
||||
}
|
||||
|
||||
private _onAndroidAnimationCancel() {
|
||||
private _onAndroidAnimationCancel() { // tslint:disable-line
|
||||
let i = 0;
|
||||
let length = this._propertyResetCallbacks.length;
|
||||
for (; i < length; i++) {
|
||||
|
2
tns-core-modules/ui/animation/animation.d.ts
vendored
2
tns-core-modules/ui/animation/animation.d.ts
vendored
@ -102,5 +102,5 @@
|
||||
public _resolveAnimationCurve(curve: any): any;
|
||||
}
|
||||
|
||||
function _resolveAnimationCurve(curve: any): any;
|
||||
export function _resolveAnimationCurve(curve: any): any;
|
||||
}
|
@ -35,7 +35,6 @@ export class Border extends ContentView implements BorderDefinition {
|
||||
}
|
||||
|
||||
public onLayout(left: number, top: number, right: number, bottom: number): void {
|
||||
let density = layout.getDisplayDensity();
|
||||
let style = this.style;
|
||||
let horizontalBorderLength = style.effectiveBorderLeftWidth + style.effectiveBorderRightWidth;
|
||||
let verticalBorderLength = style.effectiveBorderTopWidth + style.effectiveBorderBottomWidth;
|
||||
|
@ -536,7 +536,6 @@ namespace xml2ui {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
var componentModule: ComponentModule;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {
|
||||
ButtonBase, textProperty, formattedTextProperty, TouchGestureEventData, FormattedString, GestureTypes, TouchAction,
|
||||
PseudoClassHandler, TextTransform
|
||||
ButtonBase, TouchGestureEventData, GestureTypes, TouchAction,
|
||||
PseudoClassHandler
|
||||
} from "./button-common";
|
||||
|
||||
export * from "./button-common";
|
||||
@ -22,7 +22,6 @@ class ClickListener extends java.lang.Object implements android.view.View.OnClic
|
||||
|
||||
export class Button extends ButtonBase {
|
||||
_button: android.widget.Button;
|
||||
private _isPressed: boolean;
|
||||
private _highlightedHandler: (args: TouchGestureEventData) => void;
|
||||
|
||||
get android(): android.widget.Button {
|
||||
|
2
tns-core-modules/ui/button/button.d.ts
vendored
2
tns-core-modules/ui/button/button.d.ts
vendored
@ -2,7 +2,7 @@
|
||||
* Contains the Button class, which represents a standard button widget.
|
||||
*/
|
||||
declare module "ui/button" {
|
||||
import { TextBase, Property, EventData, FormattedString, FormattedStringView } from "ui/text-base";
|
||||
import { TextBase, EventData } from "ui/text-base";
|
||||
|
||||
/**
|
||||
* Represents a standard Button widget.
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { ControlStateChangeListener } from "ui/core/control-state-change";
|
||||
import {
|
||||
View, ButtonBase, PseudoClassHandler, textProperty, formattedTextProperty, whiteSpaceProperty,
|
||||
ButtonBase, PseudoClassHandler, whiteSpaceProperty,
|
||||
borderTopWidthProperty, borderRightWidthProperty, borderBottomWidthProperty, borderLeftWidthProperty,
|
||||
paddingTopProperty, paddingRightProperty, paddingBottomProperty, paddingLeftProperty, Length, WhiteSpace
|
||||
} from "./button-common";
|
||||
|
1
tns-core-modules/ui/core/bindable.d.ts
vendored
1
tns-core-modules/ui/core/bindable.d.ts
vendored
@ -66,7 +66,6 @@
|
||||
*/
|
||||
unbind(property: string);
|
||||
|
||||
|
||||
//@private
|
||||
// _onBindingContextChanged(oldValue: any, newValue: any);
|
||||
// _updateTwoWayBinding(propertyName: string, value: any);
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as definition from "ui/core/bindable";
|
||||
import { Observable, PropertyChangeData } from "data/observable";
|
||||
import { unsetValue, DependencyObservable, Property, PropertyMetadata, PropertyMetadataSettings, PropertyChangeData as DependencyPropertyChangeData } from "ui/core/dependency-observable";
|
||||
import { unsetValue, DependencyObservable, Property } from "ui/core/dependency-observable";
|
||||
import { addWeakEventListener, removeWeakEventListener } from "ui/core/weak-event-listener";
|
||||
import types = require("utils/types");
|
||||
import bindingBuilder = require("../builder/binding-builder");
|
||||
@ -10,7 +10,7 @@ import * as polymerExpressions from "js-libs/polymer-expressions";
|
||||
import * as specialProperties from "ui/builder/special-properties";
|
||||
import * as utils from "utils/utils";
|
||||
|
||||
import { enabled as traceEnabled, write as traceWrite, categories as traceCategories, notifyEvent as traceNotifyEvent, messageType as traceMessageType } from "trace";
|
||||
import { enabled as traceEnabled, write as traceWrite, categories as traceCategories, messageType as traceMessageType } from "trace";
|
||||
|
||||
// let bindingContextProperty = new Property(
|
||||
// "bindingContext",
|
||||
@ -39,7 +39,6 @@ export class Bindable extends DependencyObservable implements definition.Bindabl
|
||||
|
||||
private bindings = new Map<string, Binding>();
|
||||
|
||||
|
||||
get bindingContext(): Object {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
@ -299,7 +299,6 @@ export class InheritedProperty<T extends ViewBase, U> extends Property<T, U> {
|
||||
const setBase = this.set;
|
||||
const setFunc = (valueSource: ValueSource) => function (value: U): void {
|
||||
const that = <T>this;
|
||||
const currentValueSource: number = that[sourceKey] || ValueSource.Default;
|
||||
|
||||
let unboxedValue: U;
|
||||
let newValueSource: number;
|
||||
@ -358,8 +357,6 @@ export class InheritedProperty<T extends ViewBase, U> extends Property<T, U> {
|
||||
|
||||
export class CssProperty<T extends Style, U> {
|
||||
private registered: boolean;
|
||||
private readonly setLocalValue: (value: U) => void;
|
||||
private readonly setCssValue: (value: U) => void;
|
||||
|
||||
public readonly name: string;
|
||||
public readonly cssName: string;
|
||||
@ -554,7 +551,6 @@ export class InheritedCssProperty<T extends Style, U> extends CssProperty<T, U>
|
||||
constructor(options: CssPropertyOptions<T, U>) {
|
||||
super(options);
|
||||
const name = options.name;
|
||||
const cssName = `css-${name}`;
|
||||
|
||||
const key = this.key;
|
||||
const sourceKey = this.sourceKey;
|
||||
@ -676,8 +672,6 @@ export class InheritedCssProperty<T extends Style, U> extends CssProperty<T, U>
|
||||
|
||||
export class ShorthandProperty<T extends Style> {
|
||||
private registered: boolean;
|
||||
private readonly setLocalValue: (value: string) => void;
|
||||
private readonly setCssValue: (value: string) => void;
|
||||
|
||||
public readonly key: symbol;
|
||||
public readonly name: string;
|
||||
@ -782,32 +776,6 @@ function inheritableCssPropertyValuesOn(style: Style): Array<{ property: Inherit
|
||||
return array;
|
||||
}
|
||||
|
||||
function inheritablePropertiesOn(view: ViewBase): Array<InheritedProperty<any, any>> {
|
||||
const array = new Array<InheritedProperty<any, any>>();
|
||||
for (let prop of inheritableProperties) {
|
||||
const sourceKey = prop.sourceKey;
|
||||
const valueSource: number = view[sourceKey] || ValueSource.Default;
|
||||
if (valueSource === ValueSource.Inherited) {
|
||||
array.push(prop);
|
||||
}
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
function inheritableCssPropertiesOn(style: Object): Array<InheritedCssProperty<any, any>> {
|
||||
const array = new Array<InheritedCssProperty<any, any>>();
|
||||
for (let prop of inheritableCssProperties) {
|
||||
const sourceKey = prop.sourceKey;
|
||||
const valueSource: number = style[sourceKey] || ValueSource.Default;
|
||||
if (valueSource === ValueSource.Inherited) {
|
||||
array.push(prop);
|
||||
}
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
export function applyNativeSetters(view: ViewBase): void {
|
||||
let symbols = (<any>Object).getOwnPropertySymbols(view);
|
||||
for (let symbol of symbols) {
|
||||
|
1
tns-core-modules/ui/core/proxy.d.ts
vendored
1
tns-core-modules/ui/core/proxy.d.ts
vendored
@ -1,6 +1,5 @@
|
||||
declare module "ui/core/proxy" {
|
||||
import { DependencyObservable, Property, PropertyMetadata as PropertyMetadataBase, PropertyChangedCallback, PropertyValidationCallback } from "ui/core/dependency-observable";
|
||||
import { Bindable } from "ui/core/bindable";
|
||||
|
||||
/**
|
||||
* A class that describes dependency property metadata.
|
||||
|
@ -1,8 +1,6 @@
|
||||
import * as bindable from "ui/core/bindable";
|
||||
import * as dependencyObservable from "ui/core/dependency-observable";
|
||||
import * as definition from "ui/core/proxy";
|
||||
import * as types from "utils/types";
|
||||
import * as observable from "data/observable";
|
||||
|
||||
export class PropertyMetadata extends dependencyObservable.PropertyMetadata implements definition.PropertyMetadata {
|
||||
private _onSetNativeValue: dependencyObservable.PropertyChangedCallback;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { ViewBase as ViewBaseDefinition } from "ui/core/view-base";
|
||||
import { Observable, EventData } from "data/observable";
|
||||
import { Property, InheritedProperty, CssProperty, Style, clearInheritedProperties, propagateInheritedProperties, resetStyleProperties } from "./properties";
|
||||
import { Property, InheritedProperty, Style, clearInheritedProperties, propagateInheritedProperties, resetStyleProperties } from "./properties";
|
||||
import { Binding, BindingOptions, Bindable } from "ui/core/bindable";
|
||||
import { isIOS, isAndroid } from "platform";
|
||||
import { fromString as gestureFromString } from "ui/gestures";
|
||||
@ -507,7 +507,6 @@ export class ViewBase extends Observable implements ViewBaseDefinition {
|
||||
export const bindingContextProperty = new InheritedProperty<ViewBase, any>({ name: "bindingContext" });
|
||||
bindingContextProperty.register(ViewBase);
|
||||
|
||||
|
||||
function onCssClassPropertyChanged(view: ViewBase, oldValue: string, newValue: string) {
|
||||
let classes = view.cssClasses;
|
||||
classes.clear();
|
||||
|
@ -4,9 +4,9 @@ import { Animation, AnimationPromise } from "ui/animation";
|
||||
import { Source } from "utils/debug";
|
||||
import { Background } from "ui/styling/background";
|
||||
import {
|
||||
ViewBase, getEventOrGestureName, Observable, EventData, Style,
|
||||
Property, InheritedProperty, CssProperty, ShorthandProperty, InheritedCssProperty,
|
||||
gestureFromString, isIOS, traceEnabled, traceWrite, traceCategories, traceNotifyEvent, printUnregisteredProperties, makeParser, makeValidator
|
||||
ViewBase, getEventOrGestureName, EventData, Style,
|
||||
Property, CssProperty, ShorthandProperty, InheritedCssProperty,
|
||||
gestureFromString, isIOS, traceEnabled, traceWrite, traceCategories, printUnregisteredProperties, makeParser, makeValidator
|
||||
} from "./view-base";
|
||||
import { observe as gestureObserve, GesturesObserver, GestureTypes, GestureEventData } from "ui/gestures";
|
||||
import { Font, parseFont, FontStyle, FontWeight } from "ui/styling/font";
|
||||
@ -94,7 +94,6 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
|
||||
private _isLayoutValid: boolean;
|
||||
private _cssType: string;
|
||||
|
||||
private _updatingInheritedProperties: boolean;
|
||||
public _isAddedToNativeVisualTree: boolean;
|
||||
public _gestureObservers = {};
|
||||
|
||||
@ -596,11 +595,6 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
|
||||
vAlignment = childStyle.verticalAlignment;
|
||||
}
|
||||
|
||||
let marginTop = childStyle.marginTop;
|
||||
let marginBottom = childStyle.marginBottom;
|
||||
let marginLeft = childStyle.marginLeft;
|
||||
let marginRight = childStyle.marginRight;
|
||||
|
||||
switch (vAlignment) {
|
||||
case VerticalAlignment.TOP:
|
||||
childTop = top + effectiveMarginTop;
|
||||
@ -676,7 +670,6 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
|
||||
let height = layout.getMeasureSpecSize(heightMeasureSpec);
|
||||
let heightMode = layout.getMeasureSpecMode(heightMeasureSpec);
|
||||
|
||||
let parentWidthMeasureSpec = parent._currentWidthMeasureSpec;
|
||||
updateChildLayoutParams(child, parent, density);
|
||||
|
||||
let style = child.style;
|
||||
@ -974,31 +967,31 @@ function updateChildLayoutParams(child: ViewCommon, parent: ViewCommon, density:
|
||||
function equalsCommon(a: Length, b: Length): boolean;
|
||||
function equalsCommon(a: PercentLength, b: PercentLength): boolean;
|
||||
function equalsCommon(a: PercentLength, b: PercentLength): boolean {
|
||||
if (a == "auto") {
|
||||
return b == "auto";
|
||||
if (a == "auto") { // tslint:disable-line
|
||||
return b == "auto"; // tslint:disable-line
|
||||
}
|
||||
if (typeof a === "number") {
|
||||
if (b == "auto") {
|
||||
if (b == "auto") { // tslint:disable-line
|
||||
return false;
|
||||
}
|
||||
if (typeof b === "number") {
|
||||
return a == b;
|
||||
return a == b; // tslint:disable-line
|
||||
}
|
||||
return b.unit == "dip" && a == b.value;
|
||||
return b.unit == "dip" && a == b.value; // tslint:disable-line
|
||||
}
|
||||
if (b == "auto") {
|
||||
if (b == "auto") { // tslint:disable-line
|
||||
return false;
|
||||
}
|
||||
if (typeof b === "number") {
|
||||
return a.unit == "dip" && a.value == b;
|
||||
return a.unit == "dip" && a.value == b; // tslint:disable-line
|
||||
}
|
||||
return a.value == b.value && a.unit == b.unit;
|
||||
return a.value == b.value && a.unit == b.unit; // tslint:disable-line
|
||||
}
|
||||
|
||||
function toDevicePixelsCommon(length: Length, auto: number): number;
|
||||
function toDevicePixelsCommon(length: PercentLength, auto: number, parentSize: number): number;
|
||||
function toDevicePixelsCommon(length: PercentLength, auto: number, parentAvailableWidth?: number): number {
|
||||
if (length == "auto") {
|
||||
if (length == "auto") { // tslint:disable-line
|
||||
return auto;
|
||||
}
|
||||
if (typeof length === "number") {
|
||||
@ -1069,7 +1062,7 @@ export type Length = "auto" | number | {
|
||||
|
||||
export namespace Length {
|
||||
export function parse(value: string | Length): Length {
|
||||
if (value == "auto") {
|
||||
if (value == "auto") { // tslint:disable-line
|
||||
return "auto";
|
||||
} else if (typeof value === "string") {
|
||||
let type: "dip" | "px";
|
||||
@ -1478,7 +1471,7 @@ export const backgroundImageProperty = new CssProperty<Style, string>({
|
||||
style.backgroundInternal = currentBackground.withImage(fromBase64(base64Data));
|
||||
isValid = true;
|
||||
} else {
|
||||
style.backgroundInternal, currentBackground.withImage(undefined);
|
||||
style.backgroundInternal = currentBackground.withImage(undefined);
|
||||
}
|
||||
}
|
||||
else if (isFileOrResourcePath(url)) {
|
||||
@ -1842,11 +1835,6 @@ function opacityConverter(value: any): number {
|
||||
throw new Error(`Opacity should be between [0, 1]. Value: ${newValue}`);
|
||||
}
|
||||
|
||||
function isOpacityValid(value: string): boolean {
|
||||
let parsedValue: number = parseFloat(value);
|
||||
return !isNaN(parsedValue) && 0 <= parsedValue && parsedValue <= 1;
|
||||
}
|
||||
|
||||
export const opacityProperty = new CssProperty<Style, number>({ name: "opacity", cssName: "opacity", defaultValue: 1, valueConverter: opacityConverter });
|
||||
opacityProperty.register(Style);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { PercentLength, Length, Point, CustomLayoutView as CustomLayoutViewDefinition } from "ui/core/view";
|
||||
import { PercentLength, Point, CustomLayoutView as CustomLayoutViewDefinition } from "ui/core/view";
|
||||
import { ad as androidBackground } from "ui/styling/background";
|
||||
import {
|
||||
ViewCommon, layout, isEnabledProperty, originXProperty, originYProperty, automationTextProperty, isUserInteractionEnabledProperty, visibilityProperty, opacityProperty, minWidthProperty, minHeightProperty,
|
||||
@ -6,14 +6,12 @@ import {
|
||||
marginRightProperty, marginBottomProperty, horizontalAlignmentProperty, verticalAlignmentProperty,
|
||||
rotateProperty, scaleXProperty, scaleYProperty,
|
||||
translateXProperty, translateYProperty, zIndexProperty, backgroundInternalProperty,
|
||||
Background, GestureTypes, GestureEventData, applyNativeSetters, Property,
|
||||
Background, GestureTypes, GestureEventData, applyNativeSetters,
|
||||
traceEnabled, traceWrite, traceCategories, traceNotifyEvent, Visibility, HorizontalAlignment, VerticalAlignment
|
||||
} from "./view-common";
|
||||
|
||||
export * from "./view-common";
|
||||
|
||||
let flexbox;
|
||||
|
||||
const ANDROID = "_android";
|
||||
const NATIVE_VIEW = "_nativeView";
|
||||
const VIEW_GROUP = "_viewGroup";
|
||||
@ -65,7 +63,6 @@ const disableUserInteractionListener = new DisableUserInteractionListener();
|
||||
export class View extends ViewCommon {
|
||||
private touchListenerIsSet: boolean;
|
||||
private touchListener: android.view.View.OnTouchListener;
|
||||
private _gesturesListener: android.view.View.OnTouchListener;
|
||||
|
||||
public nativeView: android.view.View;
|
||||
|
||||
@ -536,15 +533,15 @@ function createNativePercentLengthProperty({key, auto = 0, getPixels, setPixels,
|
||||
Object.defineProperty(View.prototype, key, {
|
||||
get: function (this: View) { return { value: getPixels(this.nativeView), unit: "px" } },
|
||||
set: function (this: View, length: PercentLength) {
|
||||
if (length == "auto") {
|
||||
if (length == "auto") { // tslint:disable-line
|
||||
setPixels(this.nativeView, auto);
|
||||
} else if (typeof length === "number") {
|
||||
setPixels(this.nativeView, length * layout.getDisplayDensity());
|
||||
} else if (length.unit == "dip") {
|
||||
} else if (length.unit == "dip") { // tslint:disable-line
|
||||
setPixels(this.nativeView, length.value * layout.getDisplayDensity());
|
||||
} else if (length.unit == "px") {
|
||||
} else if (length.unit == "px") { // tslint:disable-line
|
||||
setPixels(this.nativeView, length.value);
|
||||
} else if (length.unit == "%") {
|
||||
} else if (length.unit == "%") { // tslint:disable-line
|
||||
setPercent(this.nativeView, length.value);
|
||||
} else {
|
||||
throw new Error(`Unsupported PercentLength ${length}`);
|
||||
|
6
tns-core-modules/ui/core/view.d.ts
vendored
6
tns-core-modules/ui/core/view.d.ts
vendored
@ -23,8 +23,7 @@ declare module "ui/core/view" {
|
||||
import { GestureTypes, GesturesObserver, GestureEventData, TouchGestureEventData, TouchAction } from "ui/gestures";
|
||||
import { Animation, AnimationDefinition, AnimationPromise } from "ui/animation";
|
||||
import {
|
||||
ViewBase, Property, CssProperty, InheritedCssProperty, Style,
|
||||
BindingOptions, Observable, EventData
|
||||
ViewBase, Property, CssProperty, InheritedCssProperty, Style, EventData
|
||||
} from "ui/core/view-base";
|
||||
import { Background } from "ui/styling/background";
|
||||
import { Font, FontWeight, FontStyle } from "ui/styling/font";
|
||||
@ -550,7 +549,6 @@ declare module "ui/core/view" {
|
||||
|
||||
// Lifecycle events
|
||||
|
||||
|
||||
_context: any /* android.content.Context */;
|
||||
|
||||
_childIndexToNativeChildIndex(index?: number): number;
|
||||
@ -564,7 +562,6 @@ declare module "ui/core/view" {
|
||||
public _applyXmlAttribute(attribute: string, value: any): boolean;
|
||||
public eachChildView(callback: (view: View) => boolean): void;
|
||||
|
||||
|
||||
//@private
|
||||
/**
|
||||
* A property has changed on the native side directly - e.g. the user types in a TextField.
|
||||
@ -583,7 +580,6 @@ declare module "ui/core/view" {
|
||||
_addViewToNativeVisualTree(view: ViewBase, atIndex?: number): boolean;
|
||||
_removeViewFromNativeVisualTree(view: ViewBase): void;
|
||||
|
||||
|
||||
_onAttached(context: any /* android.content.Context */): void;
|
||||
_onContextChanged(): void;
|
||||
_onDetached(force?: boolean): void;
|
||||
|
@ -1,10 +1,7 @@
|
||||
import { Length, Point, CustomLayoutView as CustomLayoutViewDefinition, View as ViewDefinition } from "ui/core/view";
|
||||
import { Point, View as ViewDefinition } from "ui/core/view";
|
||||
import { ios } from "ui/styling/background";
|
||||
import {
|
||||
ViewCommon, isEnabledProperty, originXProperty, originYProperty, automationTextProperty, isUserInteractionEnabledProperty, visibilityProperty, opacityProperty, minWidthProperty, minHeightProperty,
|
||||
widthProperty, heightProperty, marginLeftProperty, marginTopProperty,
|
||||
marginRightProperty, marginBottomProperty, horizontalAlignmentProperty, verticalAlignmentProperty,
|
||||
paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty,
|
||||
ViewCommon, isEnabledProperty, originXProperty, originYProperty, automationTextProperty, isUserInteractionEnabledProperty, visibilityProperty, opacityProperty,
|
||||
rotateProperty, scaleXProperty, scaleYProperty,
|
||||
translateXProperty, translateYProperty, zIndexProperty, backgroundInternalProperty,
|
||||
clipPathProperty, layout, traceEnabled, traceWrite, traceCategories, Background, Visibility
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {
|
||||
EditableTextBase as EditableTextBaseCommon, keyboardTypeProperty,
|
||||
returnKeyTypeProperty, editableProperty, updateTextTriggerProperty,
|
||||
returnKeyTypeProperty, editableProperty,
|
||||
autocapitalizationTypeProperty, autocorrectProperty, hintProperty,
|
||||
textProperty, placeholderColorProperty, Color
|
||||
} from "./editable-text-base-common";
|
||||
|
@ -1,8 +1,7 @@
|
||||
import {
|
||||
EditableTextBase as EditableTextBaseCommon, keyboardTypeProperty,
|
||||
returnKeyTypeProperty, editableProperty, updateTextTriggerProperty,
|
||||
autocapitalizationTypeProperty, autocorrectProperty, hintProperty,
|
||||
textProperty
|
||||
returnKeyTypeProperty,
|
||||
autocapitalizationTypeProperty, autocorrectProperty
|
||||
} from "./editable-text-base-common";
|
||||
|
||||
export * from "./editable-text-base-common";
|
||||
|
@ -679,7 +679,6 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
|
||||
traceWrite(`${fragment}.onCreate(${savedInstanceState})`, traceCategories.NativeLifecycle);
|
||||
}
|
||||
|
||||
|
||||
superFunc.call(fragment, savedInstanceState);
|
||||
// There is no entry set to the fragment, so this must be destroyed fragment that was recreated by Android.
|
||||
// We should find its corresponding page in our backstack and set it manually.
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { GestureTypes as GestureTypesDefinition, GestureEventData, GesturesObserver as GesturesObserverDefinition } from "ui/gestures";
|
||||
import { GestureEventData as GestureEventData, GesturesObserver as GesturesObserverDefinition } from "ui/gestures";
|
||||
import { View } from "ui/core/view";
|
||||
|
||||
export { View, EventData, layout } from "ui/core/view";
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Image as ImageDefinition } from "ui/image";
|
||||
import { View, Property, CssProperty, InheritedCssProperty, Style, Color, isIOS, booleanConverter } from "ui/core/view";
|
||||
import { View, Property, InheritedCssProperty, Style, Color, isIOS, booleanConverter } from "ui/core/view";
|
||||
import { ImageAsset } from "image-asset";
|
||||
import { ImageSource, fromAsset, fromNativeSource, fromUrl } from "image-source";
|
||||
import { isDataURI, isFileOrResourcePath, RESOURCE_PREFIX } from "utils/utils";
|
||||
|
@ -86,7 +86,6 @@ export class Image extends ImageBase {
|
||||
|
||||
let value = this.src;
|
||||
let async = this.loadMode === ASYNC;
|
||||
let owner = new WeakRef<Image>(this);
|
||||
this._imageLoadedListener = this._imageLoadedListener || new ImageLoadedListener(new WeakRef(this));
|
||||
|
||||
this.imageSource = <any>unsetValue;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { AbsoluteLayout as AbsoluteLayoutDefinition } from "ui/layouts/absolute-layout";
|
||||
import { LayoutBase, View, Property, Length, lengthComparer, zeroLength, getLengthEffectiveValue } from "ui/layouts/layout-base";
|
||||
import { LayoutBase, View, Property, Length, zeroLength, getLengthEffectiveValue } from "ui/layouts/layout-base";
|
||||
|
||||
export * from "ui/layouts/layout-base";
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { DockLayoutBase, View, dockProperty, stretchLastChildProperty, layout } from "./dock-layout-common";
|
||||
import { DockLayoutBase, View, layout } from "./dock-layout-common";
|
||||
|
||||
export * from "./dock-layout-common";
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
import * as flexbox from "ui/layouts/flexbox-layout";
|
||||
import { LayoutBase, View, Style, Property, CssProperty, isIOS, ShorthandProperty, makeValidator, makeParser} from "ui/layouts/layout-base";
|
||||
|
||||
export * from "ui/layouts/layout-base";
|
||||
@ -276,7 +275,6 @@ flexWrapBeforeProperty1.register(View);
|
||||
const alignSelfProperty1 = new Property<View, AlignSelf>({ name: "alignSelf", defaultValue: AlignSelf.AUTO, valueConverter: AlignSelf.parse });
|
||||
alignSelfProperty1.register(View);
|
||||
|
||||
|
||||
// registerSpecialProperty("order", (instance, propertyValue) => {
|
||||
// FlexboxLayoutBase.setOrder(instance, !isNaN(+propertyValue) && +propertyValue);
|
||||
// });
|
||||
|
@ -6,8 +6,7 @@ import {
|
||||
flexShrinkProperty, FlexShrink,
|
||||
flexWrapBeforeProperty, FlexWrapBefore,
|
||||
alignSelfProperty, AlignSelf,
|
||||
FlexBasisPercent,
|
||||
flexDirectionProperty, flexWrapProperty, justifyContentProperty, alignItemsProperty, alignContentProperty
|
||||
FlexBasisPercent
|
||||
} from "./flexbox-layout-common";
|
||||
|
||||
export * from "./flexbox-layout-common";
|
||||
|
@ -1,6 +1,5 @@
|
||||
import {
|
||||
GridLayoutBase, ItemSpec, View, layout,
|
||||
rowProperty, columnProperty, rowSpanProperty, columnSpanProperty
|
||||
GridLayoutBase, ItemSpec, View, layout
|
||||
} from "./grid-layout-common";
|
||||
|
||||
export * from "./grid-layout-common";
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {
|
||||
LayoutBaseCommon, clipToBoundsProperty,
|
||||
paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty, Length, layout
|
||||
paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty, Length
|
||||
} from "./layout-base-common";
|
||||
|
||||
export * from "./layout-base-common";
|
||||
@ -25,7 +25,6 @@ export class LayoutBase extends LayoutBaseCommon {
|
||||
console.warn(`clipToBounds with value false is not supported on Android. You can use this.android.getParent().setClipChildren(false) as an alternative`);
|
||||
}
|
||||
|
||||
|
||||
//PaddingTop
|
||||
get [paddingTopProperty.native](): Length {
|
||||
return { value: org.nativescript.widgets.ViewHelper.getPaddingTop(this.nativeView), unit: "px" };
|
||||
|
1
tns-core-modules/ui/layouts/layout-base.d.ts
vendored
1
tns-core-modules/ui/layouts/layout-base.d.ts
vendored
@ -95,6 +95,5 @@
|
||||
clipToBounds: boolean;
|
||||
}
|
||||
|
||||
|
||||
export const clipToBoundsProperty: Property<LayoutBase, boolean>;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
import { StackLayoutBase, orientationProperty, View, layout, VerticalAlignment, HorizontalAlignment } from "./stack-layout-common";
|
||||
import { StackLayoutBase, View, layout, VerticalAlignment, HorizontalAlignment } from "./stack-layout-common";
|
||||
|
||||
export * from "./stack-layout-common";
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { WrapLayoutBase, View, orientationProperty, itemWidthProperty, itemHeightProperty, layout } from "./wrap-layout-common";
|
||||
import { WrapLayoutBase, View, layout } from "./wrap-layout-common";
|
||||
|
||||
export * from "./wrap-layout-common";
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ListView as ListViewDefinition, ItemsSource } from "ui/list-view";
|
||||
import { CoercibleProperty, CssProperty, Style, Bindable, EventData, Observable, View, Template, KeyedTemplate, Length, layout, Property, Color, lengthComparer } from "ui/core/view";
|
||||
import { CoercibleProperty, CssProperty, Style, Bindable, View, Template, KeyedTemplate, Length, Property, Color, lengthComparer } from "ui/core/view";
|
||||
import { parse, parseMultipleTemplates } from "ui/builder";
|
||||
import { Label } from "ui/label";
|
||||
import { ObservableArray, ChangedData } from "data/observable-array";
|
||||
@ -25,7 +25,6 @@ export abstract class ListViewBase extends View implements ListViewDefinition {
|
||||
// TODO: get rid of such hacks.
|
||||
public static knownFunctions = ["itemTemplateSelector"]; //See component-builder.ts isKnownFunction
|
||||
|
||||
|
||||
private _itemTemplateSelector: (item: any, index: number, items: any) => string;
|
||||
private _itemTemplateSelectorBindable = new Bindable();
|
||||
public _defaultTemplate: KeyedTemplate = {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { ItemEventData, ItemsSource } from "ui/list-view";
|
||||
import {
|
||||
ListViewBase, View, KeyedTemplate, Length, Property, unsetValue, Observable, Color,
|
||||
ListViewBase, View, KeyedTemplate, Length, unsetValue, Observable, Color,
|
||||
separatorColorProperty, itemTemplatesProperty
|
||||
} from "./list-view-common";
|
||||
import { StackLayout } from "ui/layouts/stack-layout";
|
||||
@ -51,7 +51,6 @@ export class ListView extends ListViewBase {
|
||||
ensureListViewAdapterClass();
|
||||
this._android.setAdapter(new ListViewAdapterClass(this));
|
||||
|
||||
let that = new WeakRef(this);
|
||||
this._itemClickListener = this._itemClickListener || new ItemClickListener(new WeakRef(this));
|
||||
this.android.setOnItemClickListener(this._itemClickListener);
|
||||
}
|
||||
|
@ -1,11 +1,10 @@
|
||||
import { ItemEventData, ItemsSource } from "ui/list-view";
|
||||
import { ItemEventData } from "ui/list-view";
|
||||
import {
|
||||
ListViewBase, View, KeyedTemplate, Length, Property, unsetValue, Observable, Color,
|
||||
ListViewBase, View, KeyedTemplate, Length, Observable, Color,
|
||||
separatorColorProperty, itemTemplatesProperty, layout, EventData
|
||||
} from "./list-view-common";
|
||||
import { StackLayout } from "ui/layouts/stack-layout";
|
||||
import { ProxyViewContainer } from "ui/proxy-view-container";
|
||||
import { LayoutBase } from "ui/layouts/layout-base";
|
||||
import { ios } from "utils/utils";
|
||||
|
||||
export * from "./list-view-common";
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Page as PageDefinition, NavigatedData, ShownModallyData } from "ui/page";
|
||||
import {
|
||||
ContentView, EventData, View, Template, KeyedTemplate, Length, backgroundColorProperty,
|
||||
ContentView, View, backgroundColorProperty,
|
||||
eachDescendant, Property, Color, isIOS, booleanConverter, resetStyleProperties
|
||||
} from "ui/content-view";
|
||||
import { Frame, topmost as topmostFrame, resolvePageFromEntry } from "ui/frame";
|
||||
@ -51,7 +51,6 @@ export class PageBase extends ContentView implements PageDefinition {
|
||||
// super.onLoaded();
|
||||
// }
|
||||
|
||||
|
||||
get navigationContext(): any {
|
||||
return this._navigationContext;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { View, PageBase, Color, actionBarHiddenProperty, enableSwipeBackNavigationProperty, statusBarStyleProperty, androidStatusBarBackgroundProperty, HorizontalAlignment, VerticalAlignment } from "./page-common";
|
||||
import { View, PageBase, Color, actionBarHiddenProperty, statusBarStyleProperty, androidStatusBarBackgroundProperty, HorizontalAlignment, VerticalAlignment } from "./page-common";
|
||||
import { ActionBar } from "ui/action-bar";
|
||||
import { GridLayout } from "ui/layouts/grid-layout";
|
||||
import { DIALOG_FRAGMENT_TAG } from "./constants";
|
||||
|
2
tns-core-modules/ui/page/page.d.ts
vendored
2
tns-core-modules/ui/page/page.d.ts
vendored
@ -2,7 +2,7 @@
|
||||
* Contains the Page class, which represents a logical unit for navigation inside a Frame.
|
||||
*/
|
||||
declare module "ui/page" {
|
||||
import { ContentView, EventData, View, Template, KeyedTemplate, Length, Property, Color } from "ui/content-view";
|
||||
import { ContentView, EventData, Property, Color } from "ui/content-view";
|
||||
import { Frame } from "ui/frame";
|
||||
import { ActionBar } from "ui/action-bar";
|
||||
import { KeyframeAnimationInfo } from "ui/animation/keyframe-animation";
|
||||
|
@ -1,12 +1,10 @@
|
||||
import {
|
||||
PageBase, View, layout, Color,
|
||||
actionBarHiddenProperty, enableSwipeBackNavigationProperty, statusBarStyleProperty,
|
||||
PageBase, View, layout,
|
||||
actionBarHiddenProperty, statusBarStyleProperty,
|
||||
traceEnabled, traceWrite, traceCategories
|
||||
} from "./page-common";
|
||||
import { ios as iosApp } from "application";
|
||||
import { device } from "platform";
|
||||
import { ActionBar } from "ui/action-bar";
|
||||
import { GridLayout } from "ui/layouts/grid-layout";
|
||||
import * as uiUtils from "ui/utils";
|
||||
|
||||
export * from "./page-common";
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { Placeholder as PlaceholderDefinition, CreateViewEventData } from "ui/placeholder"
|
||||
import { View } from "ui/core/view";
|
||||
|
||||
export class Placeholder extends PlaceholderDefinition {
|
||||
public static creatingViewEvent = "creatingView";
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { Placeholder as PlaceholderDefinition, CreateViewEventData } from "ui/placeholder"
|
||||
import { View } from "ui/core/view";
|
||||
|
||||
export class Placeholder extends PlaceholderDefinition {
|
||||
public static creatingViewEvent = "creatingView";
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {
|
||||
View, Color, ProgressBase, valueProperty, maxValueProperty,
|
||||
Color, ProgressBase, valueProperty, maxValueProperty,
|
||||
colorProperty, backgroundColorProperty, backgroundInternalProperty
|
||||
} from "./progress-common";
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {
|
||||
ProgressBase, View, Color, valueProperty, maxValueProperty,
|
||||
ProgressBase, Color, valueProperty, maxValueProperty,
|
||||
colorProperty, backgroundColorProperty, backgroundInternalProperty
|
||||
} from "./progress-common";
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Repeater as RepeaterDefinition, ItemsSource } from "ui/repeater";
|
||||
import { Label } from "ui/label";
|
||||
import { LayoutBase, CustomLayoutView, View, Template, Property, Observable ,layout } from "ui/layouts/layout-base";
|
||||
import { LayoutBase, CustomLayoutView, View, Template, Property, layout } from "ui/layouts/layout-base";
|
||||
import { StackLayout } from "ui/layouts/stack-layout";
|
||||
import { ObservableArray, ChangedData } from "data/observable-array";
|
||||
import { addWeakEventListener, removeWeakEventListener } from "ui/core/weak-event-listener";
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ScrollView as ScrollViewDefinition } from "ui/scroll-view";
|
||||
import { ContentView, EventData, Property } from "ui/content-view";
|
||||
import { ContentView, Property } from "ui/content-view";
|
||||
|
||||
export * from "ui/content-view";
|
||||
|
||||
@ -79,7 +79,6 @@ export abstract class ScrollViewBase extends ContentView implements ScrollViewDe
|
||||
public abstract scrollToHorizontalOffset(value: number, animated: boolean);
|
||||
}
|
||||
|
||||
|
||||
export const orientationProperty = new Property<ScrollViewBase, "horizontal" | "vertical">({
|
||||
name: "orientation", defaultValue: "vertical", affectsLayout: true, valueConverter: (value) => {
|
||||
if (value === "vertical") {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ScrollEventData } from "ui/scroll-view";
|
||||
import { View, layout, ScrollViewBase, orientationProperty } from "./scroll-view-common";
|
||||
import { View, layout, ScrollViewBase } from "./scroll-view-common";
|
||||
|
||||
export * from "./scroll-view-common";
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { SearchBar as SearchBarDefinition } from "ui/search-bar";
|
||||
import { View, Property, EventData, Color, isIOS } from "ui/core/view";
|
||||
import { View, Property, Color, isIOS } from "ui/core/view";
|
||||
|
||||
export * from "ui/core/view";
|
||||
|
||||
|
@ -83,7 +83,6 @@ export class SearchBar extends SearchBarBase {
|
||||
|
||||
this._android.setIconified(false);
|
||||
|
||||
var that = new WeakRef(this);
|
||||
this._queryTextListener = this._queryTextListener || new QueryTextListener(new WeakRef(this));
|
||||
this._android.setOnQueryTextListener(this._queryTextListener);
|
||||
|
||||
@ -144,7 +143,6 @@ export class SearchBar extends SearchBarBase {
|
||||
let textView = getSearchViewTextView(this._android);
|
||||
|
||||
let typeface: android.graphics.Typeface;
|
||||
let fontSize: number;
|
||||
if (value instanceof Font) {
|
||||
typeface = value.getAndroidTypeface();
|
||||
textView.setTextSize(value.fontSize);
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { SegmentedBar as SegmentedBarDefinition, SegmentedBarItem as SegmentedBarItemDefinition, SelectedIndexChangedEventData } from "ui/segmented-bar";
|
||||
import {
|
||||
ViewBase, View, AddChildFromBuilder, AddArrayFromBuilder,
|
||||
Property, CoercibleProperty, CssProperty, EventData, Color, Style
|
||||
Property, CoercibleProperty, CssProperty, Color, Style
|
||||
} from "ui/core/view";
|
||||
|
||||
export * from "ui/core/view";
|
||||
|
@ -178,7 +178,6 @@ export class SegmentedBar extends SegmentedBarBase {
|
||||
private _android: android.widget.TabHost;
|
||||
private listener: android.widget.TabHost.OnTabChangeListener;
|
||||
private tabContentFactory: android.widget.TabHost.TabContentFactory;
|
||||
private apiLevel: number;
|
||||
|
||||
public _createUI() {
|
||||
ensureTabHostClass();
|
||||
@ -222,10 +221,10 @@ export class SegmentedBar extends SegmentedBarBase {
|
||||
// this.resetNativeListener();
|
||||
}
|
||||
|
||||
private resetNativeListener() {
|
||||
this.android.setOnTabChangedListener(null);
|
||||
this.android.setOnTabChangedListener(this.listener);
|
||||
}
|
||||
// private resetNativeListener() {
|
||||
// this.android.setOnTabChangedListener(null);
|
||||
// this.android.setOnTabChangedListener(this.listener);
|
||||
// }
|
||||
|
||||
get [selectedIndexProperty.native](): number {
|
||||
return -1;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Background as BackgroundDefinition, BackgroundDrawParams } from "ui/styling/background";
|
||||
import { Color, layout, BackgroundRepeat } from "ui/core/view";
|
||||
import { Color, BackgroundRepeat } from "ui/core/view";
|
||||
import { ImageSource } from "image-source";
|
||||
import { CSSValue, parse as cssParse } from "css-value";
|
||||
export * from "ui/core/view";
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { FontBase, parseFontFamily, genericFontFamilies, parseFont, FontWeight } from "./font-common";
|
||||
import { FontBase, parseFontFamily, genericFontFamilies, FontWeight } from "./font-common";
|
||||
import { enabled as traceEnabled, write as traceWrite, categories as traceCategories, messageType as traceMessageType } from "trace";
|
||||
import * as application from "application";
|
||||
import * as fs from "file-system";
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { FontBase, parseFontFamily, genericFontFamilies, parseFont, FontStyle, FontWeight } from "./font-common";
|
||||
import { FontBase, parseFontFamily, genericFontFamilies, FontStyle, FontWeight } from "./font-common";
|
||||
import { enabled as traceEnabled, write as traceWrite, categories as traceCategories, messageType as traceMessageType } from "trace";
|
||||
import * as fs from "file-system";
|
||||
import * as utils from "utils/utils";
|
||||
@ -42,7 +42,6 @@ export class Font extends FontBase {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export const systemFontFamilies = new Set<string>();
|
||||
export const systemFonts = new Set<string>();
|
||||
|
||||
@ -311,8 +310,6 @@ export module ios {
|
||||
|
||||
const error = new interop.Reference<NSError>();
|
||||
if (!CTFontManagerRegisterGraphicsFont(font, error)) {
|
||||
|
||||
|
||||
if (traceEnabled) {
|
||||
traceWrite("Error occur while registering font: " + CFErrorCopyDescription(<NSError>error.value), traceCategories.Error, traceMessageType.error);
|
||||
}
|
||||
|
@ -5,13 +5,11 @@ import { KeyframeAnimationInfo, KeyframeAnimation } from "ui/animation/keyframe-
|
||||
import { write as traceWrite, categories as traceCategories, messageType as traceMessageType } from "trace";
|
||||
import { File, knownFolders, path } from "file-system";
|
||||
import { CssAnimationParser } from "./css-animation-parser";
|
||||
import { isFileOrResourcePath } from "utils/utils";
|
||||
|
||||
import * as application from "application";
|
||||
|
||||
const animationsSymbol: symbol = Symbol("animations");
|
||||
|
||||
|
||||
let pattern: RegExp = /('|")(.*?)\1/;
|
||||
|
||||
export class CssState {
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { Style as StyleDefinition } from "ui/styling/style";
|
||||
import { Length, PercentLength, Color, Background, Font, ViewBase, BackgroundRepeat, Visibility, HorizontalAlignment, VerticalAlignment } from "ui/core/view";
|
||||
import { Observable } from "data/observable";
|
||||
import { resetStyleProperties } from "ui/core/properties";
|
||||
|
||||
import {
|
||||
FlexDirection, FlexWrap, JustifyContent, AlignItems, AlignContent,
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Switch as SwitchDefinition } from "ui/switch";
|
||||
import { View, layout, Color, Property, colorProperty, backgroundColorProperty, backgroundInternalProperty, booleanConverter } from "ui/core/view";
|
||||
import { View, Color, Property, colorProperty, backgroundColorProperty, backgroundInternalProperty, booleanConverter } from "ui/core/view";
|
||||
|
||||
export * from "ui/core/view";
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { TabView as TabViewDefinition, TabViewItem as TabViewItemDefinition, SelectedIndexChangedEventData } from "ui/tab-view";
|
||||
import {
|
||||
View, ViewBase, Style, Property, CssProperty, CoercibleProperty,
|
||||
EventData, Color, isIOS, AddArrayFromBuilder, AddChildFromBuilder
|
||||
Color, isIOS, AddArrayFromBuilder, AddChildFromBuilder
|
||||
} from "ui/core/view";
|
||||
|
||||
export * from "ui/core/view";
|
||||
|
@ -2,7 +2,7 @@ import {
|
||||
TabViewBase, TabViewItemBase, itemsProperty, selectedIndexProperty,
|
||||
tabTextColorProperty, tabBackgroundColorProperty, selectedTabTextColorProperty,
|
||||
androidSelectedTabHighlightColorProperty, androidOffscreenTabLimitProperty,
|
||||
fontInternalProperty, traceCategory, View, colorProperty, layout, Bindable, isIOS, Color, Font, traceEnabled, traceWrite
|
||||
fontInternalProperty, traceCategory, View, colorProperty, layout, Color, Font, traceEnabled, traceWrite
|
||||
} from "./tab-view-common"
|
||||
import { textTransformProperty, TextTransform, getTransformedText } from "ui/text-base";
|
||||
import { fromFileOrResource } from "image-source";
|
||||
|
@ -1,15 +1,12 @@
|
||||
import {
|
||||
TabViewBase, TabViewItemBase, itemsProperty, selectedIndexProperty,
|
||||
tabTextColorProperty, tabBackgroundColorProperty, selectedTabTextColorProperty, iosIconRenderingModeProperty, traceCategory,
|
||||
Font, View, colorProperty, fontInternalProperty, layout, Color, traceEnabled, traceWrite, traceCategories
|
||||
tabTextColorProperty, tabBackgroundColorProperty, selectedTabTextColorProperty, iosIconRenderingModeProperty,
|
||||
Font, View, fontInternalProperty, layout, Color, traceEnabled, traceWrite, traceCategories
|
||||
} from "./tab-view-common"
|
||||
|
||||
import { textTransformProperty, TextTransform, getTransformedText } from "ui/text-base";
|
||||
import { fromFileOrResource } from "image-source";
|
||||
import { Page } from "ui/page";
|
||||
import { ios } from "utils/utils";
|
||||
|
||||
import getter = ios.getter;
|
||||
|
||||
export * from "./tab-view-common";
|
||||
|
||||
@ -451,8 +448,8 @@ export class TabView extends TabViewBase {
|
||||
if (items && items.length) {
|
||||
for (let i = 0, length = items.length; i < length; i++) {
|
||||
const item = items[i];
|
||||
if (items[i].iconSource) {
|
||||
(<TabViewItem>items[i])._update();
|
||||
if (item.iconSource) {
|
||||
(<TabViewItem>item)._update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { TextBase as TextBaseDefinition } from "ui/text-base";
|
||||
import { View, AddChildFromBuilder, Property, CssProperty, InheritedCssProperty, Style, isIOS, Observable, makeValidator, makeParser } from "ui/core/view";
|
||||
import { View, Property, CssProperty, InheritedCssProperty, Style, isIOS, Observable, makeValidator, makeParser } from "ui/core/view";
|
||||
import { PropertyChangeData } from "data/observable";
|
||||
import { FormattedString, FormattedStringView } from "text/formatted-string";
|
||||
import { addWeakEventListener, removeWeakEventListener } from "ui/core/weak-event-listener";
|
||||
@ -7,8 +7,6 @@ import { addWeakEventListener, removeWeakEventListener } from "ui/core/weak-even
|
||||
export { FormattedString };
|
||||
export * from "ui/core/view";
|
||||
|
||||
const CHILD_SPAN = "Span";
|
||||
|
||||
export abstract class TextBaseCommon extends View implements TextBaseDefinition, FormattedStringView {
|
||||
|
||||
public abstract _setFormattedTextPropertyToNative(value: FormattedString): void;
|
||||
|
@ -2,7 +2,7 @@
|
||||
TextBaseCommon, textProperty, formattedTextProperty, textAlignmentProperty, textDecorationProperty,
|
||||
textTransformProperty, letterSpacingProperty, colorProperty, fontInternalProperty, whiteSpaceProperty,
|
||||
Font, Color, FormattedString, TextDecoration, TextAlignment, TextTransform, WhiteSpace,
|
||||
paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty, Length, layout
|
||||
paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty, Length
|
||||
} from "./text-base-common";
|
||||
|
||||
export * from "./text-base-common";
|
||||
@ -54,7 +54,6 @@ export class TextBase extends TextBaseCommon {
|
||||
let textView = this._nativeView;
|
||||
|
||||
let typeface: android.graphics.Typeface;
|
||||
let fontSize: number;
|
||||
if (value instanceof Font) {
|
||||
typeface = value.getAndroidTypeface();
|
||||
textView.setTextSize(value.fontSize);
|
||||
|
@ -171,7 +171,6 @@ export function getTransformedText(text: string, textTransform: TextTransform):
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function NSStringFromNSAttributedString(source: NSAttributedString | string): NSString {
|
||||
return NSString.stringWithString(source instanceof NSAttributedString && source.string || <string>source);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { TimePickerBase, timeProperty, minuteIntervalProperty,
|
||||
import { TimePickerBase, timeProperty,
|
||||
minuteProperty, minMinuteProperty, maxMinuteProperty,
|
||||
hourProperty, minHourProperty, maxHourProperty, colorProperty } from "./time-picker-common";
|
||||
|
||||
|
@ -1,6 +1,10 @@
|
||||
import { Transition as TransitionDefinition } from "ui/transition";
|
||||
import { NavigationTransition } from "ui/frame";
|
||||
import { enabled as traceEnabled, write as traceWrite, categories as traceCategories, notifyEvent as traceNotifyEvent, isCategorySet } from "trace";
|
||||
import {
|
||||
enabled as traceEnabled,
|
||||
write as traceWrite,
|
||||
categories as traceCategories
|
||||
} from "trace";
|
||||
import * as _slideTransitionModule from "./slide-transition";
|
||||
import * as _fadeTransitionModule from "./fade-transition";
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { WebView as WebViewDefinition, LoadEventData } from "ui/web-view";
|
||||
import { View, Property, EventData } from "ui/core/view";
|
||||
import { View, Property } from "ui/core/view";
|
||||
import { isFileOrResourcePath } from "utils/utils";
|
||||
import { File, knownFolders, path } from "file-system";
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { WebViewBase, File, knownFolders, path, traceEnabled, traceWrite, traceCategories } from "./web-view-common";
|
||||
import { WebViewBase, knownFolders, traceEnabled, traceWrite, traceCategories } from "./web-view-common";
|
||||
|
||||
export * from "./web-view-common";
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { WebViewBase, File, knownFolders, path, traceWrite, traceEnabled, traceCategories } from "./web-view-common";
|
||||
import { WebViewBase, knownFolders, traceWrite, traceEnabled, traceCategories } from "./web-view-common";
|
||||
|
||||
export * from "./web-view-common";
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
import {
|
||||
enabled as traceEnabled, write as traceWrite, categories as traceCategories,
|
||||
messageType as traceMessageType, notifyEvent as traceNotifyEvent, isCategorySet
|
||||
write as traceWrite, categories as traceCategories, messageType as traceMessageType
|
||||
} from "trace";
|
||||
|
||||
export * from "./utils-common";
|
||||
|
@ -1,9 +1,7 @@
|
||||
import * as dts from "utils/utils";
|
||||
import { Color } from "color";
|
||||
import { Color } from "color";
|
||||
import * as fsModule from "file-system";
|
||||
import {
|
||||
enabled as traceEnabled, write as traceWrite, categories as traceCategories,
|
||||
messageType as traceMessageType, notifyEvent as traceNotifyEvent, isCategorySet
|
||||
write as traceWrite, categories as traceCategories, messageType as traceMessageType
|
||||
} from "trace";
|
||||
|
||||
export * from "./utils-common";
|
||||
|
Reference in New Issue
Block a user