mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
No more ambient modules for tns-core-modules/* subpackages.
- Use path mappings in tsconfig.json to resolve module typings - Only use ambient mobules for global API's - Move single-file modules to a subdir with the same name so that we can provide a hand-written typing next to it (via package.json) - Delete all mentions of tns-core-modules.d.ts - Delete reference d.ts assembly build steps. Not needed anymore. - HACK! Use a <reference> for global typings in application.d.ts to avoid publishing a separate @types/tns-core-modules package. - Rename declarations.d.ts to tns-core-modules.d.ts to preserve JS project mappings in references.d.ts (the only place we use those)
This commit is contained in:
committed by
Hristo Deshev
parent
1af8c6ca8e
commit
b45cbe929b
@@ -3,15 +3,6 @@ import { LayoutBase, View, Property, Length, zeroLength } from "ui/layouts/layou
|
||||
|
||||
export * from "ui/layouts/layout-base";
|
||||
|
||||
declare module "ui/core/view" {
|
||||
interface View {
|
||||
left: Length;
|
||||
top: Length;
|
||||
effectiveLeft: number;
|
||||
effectiveTop: number;
|
||||
}
|
||||
}
|
||||
|
||||
View.prototype.effectiveLeft = 0;
|
||||
View.prototype.effectiveTop = 0;
|
||||
|
||||
@@ -74,4 +65,4 @@ export const topProperty = new Property<View, Length>({
|
||||
}
|
||||
}, valueConverter: (v) => Length.parse(v)
|
||||
});
|
||||
topProperty.register(View);
|
||||
topProperty.register(View);
|
||||
|
||||
@@ -1,38 +1,36 @@
|
||||
declare module "ui/layouts/absolute-layout" {
|
||||
import { LayoutBase, View, Property, Length } from "ui/layouts/layout-base";
|
||||
import { LayoutBase, View, Property, Length } from "ui/layouts/layout-base";
|
||||
|
||||
/**
|
||||
* A layout that lets you specify exact locations (left/top coordinates) of its children.
|
||||
*/
|
||||
export class AbsoluteLayout extends LayoutBase {
|
||||
/**
|
||||
* Gets the value of the Left property from a given View.
|
||||
*/
|
||||
static getLeft(view: View): Length;
|
||||
|
||||
/**
|
||||
* A layout that lets you specify exact locations (left/top coordinates) of its children.
|
||||
* Sets the value of the Left property from a given View.
|
||||
*/
|
||||
class AbsoluteLayout extends LayoutBase {
|
||||
/**
|
||||
* Gets the value of the Left property from a given View.
|
||||
*/
|
||||
static getLeft(view: View): Length;
|
||||
|
||||
/**
|
||||
* Sets the value of the Left property from a given View.
|
||||
*/
|
||||
static setLeft(view: View, value: Length): void;
|
||||
|
||||
/**
|
||||
* Gets the value of the Top property from a given View.
|
||||
*/
|
||||
static getTop(view: View): Length;
|
||||
|
||||
/**
|
||||
* Sets the value of the Top property from a given View.
|
||||
*/
|
||||
static setTop(view: View, value: Length): void;
|
||||
}
|
||||
static setLeft(view: View, value: Length): void;
|
||||
|
||||
/**
|
||||
* Represents the observable property backing the left property.
|
||||
* Gets the value of the Top property from a given View.
|
||||
*/
|
||||
export const leftProperty: Property<View, Length>;
|
||||
static getTop(view: View): Length;
|
||||
|
||||
/**
|
||||
* Represents the observable property backing the top property.
|
||||
* Sets the value of the Top property from a given View.
|
||||
*/
|
||||
export const topProperty: Property<View, Length>;
|
||||
}
|
||||
static setTop(view: View, value: Length): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the observable property backing the left property.
|
||||
*/
|
||||
export const leftProperty: Property<View, Length>;
|
||||
|
||||
/**
|
||||
* Represents the observable property backing the top property.
|
||||
*/
|
||||
export const topProperty: Property<View, Length>;
|
||||
|
||||
@@ -1,2 +1,5 @@
|
||||
{ "name" : "absolute-layout",
|
||||
"main" : "absolute-layout" }
|
||||
{
|
||||
"name" : "absolute-layout",
|
||||
"main" : "absolute-layout",
|
||||
"types" : "absolute-layout.d.ts"
|
||||
}
|
||||
|
||||
@@ -10,12 +10,6 @@ function validateArgs(element: View): View {
|
||||
|
||||
export * from "ui/layouts/layout-base";
|
||||
|
||||
declare module "ui/core/view" {
|
||||
interface View {
|
||||
dock: "left" | "top" | "right" | "bottom";
|
||||
}
|
||||
}
|
||||
|
||||
export class DockLayoutBase extends LayoutBase implements DockLayoutDefinition {
|
||||
|
||||
public static getDock(element: View): "left" | "top" | "right" | "bottom" {
|
||||
@@ -54,4 +48,4 @@ dockProperty.register(View);
|
||||
export const stretchLastChildProperty = new Property<DockLayoutBase, boolean>({
|
||||
name: "stretchLastChild", defaultValue: true, affectsLayout: isIOS, valueConverter: booleanConverter
|
||||
});
|
||||
stretchLastChildProperty.register(DockLayoutBase);
|
||||
stretchLastChildProperty.register(DockLayoutBase);
|
||||
|
||||
@@ -1,34 +1,32 @@
|
||||
declare module "ui/layouts/dock-layout" {
|
||||
import { LayoutBase, View, Property } from "ui/layouts/layout-base";
|
||||
import { LayoutBase, View, Property } from "ui/layouts/layout-base";
|
||||
|
||||
/**
|
||||
* A Layout that arranges its children at its outer edges, and allows its last child to take up the remaining space.
|
||||
*/
|
||||
export class DockLayout extends LayoutBase {
|
||||
/**
|
||||
* Gets the value of the Left property from a given View.
|
||||
*/
|
||||
static getDock(view: View): string;
|
||||
|
||||
/**
|
||||
* A Layout that arranges its children at its outer edges, and allows its last child to take up the remaining space.
|
||||
* Sets the value of the Left property from a given View.
|
||||
*/
|
||||
class DockLayout extends LayoutBase {
|
||||
/**
|
||||
* Gets the value of the Left property from a given View.
|
||||
*/
|
||||
static getDock(view: View): string;
|
||||
|
||||
/**
|
||||
* Sets the value of the Left property from a given View.
|
||||
*/
|
||||
static setDock(view: View, value: string): void;
|
||||
|
||||
/**
|
||||
* Gets or sets a value that indicates whether the last child element within a DockLayout stretches to fill the remaining available space.
|
||||
* The default value is true.
|
||||
*/
|
||||
stretchLastChild: boolean;
|
||||
}
|
||||
static setDock(view: View, value: string): void;
|
||||
|
||||
/**
|
||||
* Represents the observable property backing the dock property.
|
||||
* Gets or sets a value that indicates whether the last child element within a DockLayout stretches to fill the remaining available space.
|
||||
* The default value is true.
|
||||
*/
|
||||
export const dockProperty: Property<DockLayout, "left" | "top" | "right" | "bottom">;
|
||||
stretchLastChild: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the observable property backing the stretchLastChild property of each DockLayout instance.
|
||||
*/
|
||||
export const stretchLastChildProperty: Property<DockLayout, boolean>;
|
||||
}
|
||||
/**
|
||||
* Represents the observable property backing the dock property.
|
||||
*/
|
||||
export const dockProperty: Property<DockLayout, "left" | "top" | "right" | "bottom">;
|
||||
|
||||
/**
|
||||
* Represents the observable property backing the stretchLastChild property of each DockLayout instance.
|
||||
*/
|
||||
export const stretchLastChildProperty: Property<DockLayout, boolean>;
|
||||
|
||||
@@ -1,2 +1,5 @@
|
||||
{ "name" : "dock-layout",
|
||||
"main" : "dock-layout" }
|
||||
{
|
||||
"name" : "dock-layout",
|
||||
"main" : "dock-layout",
|
||||
"types" : "dock-layout.d.ts"
|
||||
}
|
||||
|
||||
@@ -2,31 +2,12 @@ import { LayoutBase, View, Style, CssProperty, isIOS, ShorthandProperty, makeVal
|
||||
|
||||
export * from "ui/layouts/layout-base";
|
||||
|
||||
// declare module "ui/layouts/flexbox-layout" {
|
||||
// export function _onNativeOrderPropertyChanged(view: View, newValue: number): void;
|
||||
// export function _onNativeFlexGrowPropertyChanged(view: View, newValue: number): void;
|
||||
// export function _onNativeFlexShrinkPropertyChanged(view: View, newValue: number): void;
|
||||
// export function _onNativeAlignSelfPropertyChanged(view: View, newValue: AlignSelf): void;
|
||||
// export function _onNativeFlexWrapBeforePropertyChanged(view: View, newValue: boolean): void;
|
||||
// }
|
||||
|
||||
export type Basis = "auto" | number;
|
||||
|
||||
export const ORDER_DEFAULT = 1;
|
||||
export const FLEX_GROW_DEFAULT = 0.0;
|
||||
export const FLEX_SHRINK_DEFAULT = 1.0;
|
||||
|
||||
// function makeValidator<T>(...values: T[]): (value: any) => value is T {
|
||||
// const set = new Set(values);
|
||||
// return (value: any): value is T => set.has(value);
|
||||
// }
|
||||
// function makeParser<T>(isValid: (value: any) => boolean, def: T): (value: any) => T {
|
||||
// return value => {
|
||||
// const lower = value && value.toLowerCase();
|
||||
// return isValid(lower) ? lower : def;
|
||||
// }
|
||||
// }
|
||||
|
||||
export type FlexDirection = "row" | "row-reverse" | "column" | "column-reverse";
|
||||
export namespace FlexDirection {
|
||||
export const ROW: "row" = "row";
|
||||
|
||||
@@ -1,173 +1,136 @@
|
||||
declare module "ui/styling/style" {
|
||||
import {
|
||||
FlexDirection, FlexWrap, JustifyContent, AlignItems, AlignContent,
|
||||
Order, FlexGrow, FlexShrink, FlexWrapBefore, AlignSelf
|
||||
} from "ui/layouts/flexbox-layout"
|
||||
|
||||
interface Style {
|
||||
flexDirection: FlexDirection;
|
||||
flexWrap: FlexWrap;
|
||||
justifyContent: JustifyContent;
|
||||
alignItems: AlignItems;
|
||||
alignContent: AlignContent;
|
||||
order: Order;
|
||||
flexGrow: FlexGrow;
|
||||
flexShrink: FlexShrink;
|
||||
flexWrapBefore: FlexWrapBefore;
|
||||
alignSelf: AlignSelf;
|
||||
}
|
||||
import { LayoutBase, View, Style, CssProperty } from "ui/layouts/layout-base";
|
||||
|
||||
export type FlexDirection = "row" | "row-reverse" | "column" | "column-reverse";
|
||||
export namespace FlexDirection {
|
||||
export const ROW: "row";
|
||||
export const ROW_REVERSE: "row-reverse";
|
||||
export const COLUMN: "column";
|
||||
export const COLUMN_REVERSE: "column-reverse";
|
||||
export function isValid(value: any): boolean;
|
||||
export function parse(value: string): FlexDirection;
|
||||
}
|
||||
|
||||
declare module "ui/core/view" {
|
||||
import {
|
||||
Order, FlexGrow, FlexShrink, FlexWrapBefore, AlignSelf
|
||||
} from "ui/layouts/flexbox-layout"
|
||||
|
||||
interface View {
|
||||
order: Order;
|
||||
flexGrow: FlexGrow;
|
||||
flexShrink: FlexShrink;
|
||||
flexWrapBefore: FlexWrapBefore;
|
||||
alignSelf: AlignSelf;
|
||||
}
|
||||
export type FlexWrap = "nowrap" | "wrap" | "wrap-reverse";
|
||||
export namespace FlexWrap {
|
||||
export const NOWRAP: "nowrap";
|
||||
export const WRAP: "wrap";
|
||||
export const WRAP_REVERSE: "wrap-reverse";
|
||||
export function isValid(value: any): boolean;
|
||||
export function parse(value: string): FlexWrap;
|
||||
}
|
||||
|
||||
declare module "ui/layouts/flexbox-layout" {
|
||||
export type JustifyContent = "flex-start" | "flex-end" | "center" | "space-between" | "space-around";
|
||||
export namespace JustifyContent {
|
||||
export const FLEX_START: "flex-start";
|
||||
export const FLEX_END: "flex-end";
|
||||
export const CENTER: "center";
|
||||
export const SPACE_BETWEEN: "space-between";
|
||||
export const SPACE_AROUND: "space-around";
|
||||
export function isValid(value: any): boolean;
|
||||
export function parse(value: string): JustifyContent;
|
||||
}
|
||||
|
||||
import { LayoutBase, View, Style, CssProperty } from "ui/layouts/layout-base";
|
||||
export type AlignItems = "flex-start" | "flex-end" | "center" | "baseline" | "stretch";
|
||||
export namespace AlignItems {
|
||||
export const FLEX_START: "flex-start";
|
||||
export const FLEX_END: "flex-end";
|
||||
export const CENTER: "center";
|
||||
export const BASELINE: "baseline";
|
||||
export const STRETCH: "stretch";
|
||||
export function isValid(value: any): boolean;
|
||||
export function parse(value: string): AlignItems;
|
||||
}
|
||||
|
||||
export type FlexDirection = "row" | "row-reverse" | "column" | "column-reverse";
|
||||
export namespace FlexDirection {
|
||||
export const ROW: "row";
|
||||
export const ROW_REVERSE: "row-reverse";
|
||||
export const COLUMN: "column";
|
||||
export const COLUMN_REVERSE: "column-reverse";
|
||||
export function isValid(value: any): boolean;
|
||||
export function parse(value: string): FlexDirection;
|
||||
}
|
||||
export type AlignContent = "flex-start" | "flex-end" | "center" | "space-between" | "space-around" | "stretch";
|
||||
export namespace AlignContent {
|
||||
export const FLEX_START: "flex-start";
|
||||
export const FLEX_END: "flex-end";
|
||||
export const CENTER: "center";
|
||||
export const SPACE_BETWEEN: "space-between";
|
||||
export const SPACE_AROUND: "space-around";
|
||||
export const STRETCH: "stretch";
|
||||
export function isValid(value: any): boolean;
|
||||
export function parse(value: string): AlignContent;
|
||||
}
|
||||
|
||||
export type FlexWrap = "nowrap" | "wrap" | "wrap-reverse";
|
||||
export namespace FlexWrap {
|
||||
export const NOWRAP: "nowrap";
|
||||
export const WRAP: "wrap";
|
||||
export const WRAP_REVERSE: "wrap-reverse";
|
||||
export function isValid(value: any): boolean;
|
||||
export function parse(value: string): FlexWrap;
|
||||
}
|
||||
/**
|
||||
* A flex order integer.
|
||||
*/
|
||||
export type Order = number;
|
||||
export namespace Order {
|
||||
export function isValid(value: any): boolean;
|
||||
export function parse(value: string): Order;
|
||||
}
|
||||
|
||||
export type JustifyContent = "flex-start" | "flex-end" | "center" | "space-between" | "space-around";
|
||||
export namespace JustifyContent {
|
||||
export const FLEX_START: "flex-start";
|
||||
export const FLEX_END: "flex-end";
|
||||
export const CENTER: "center";
|
||||
export const SPACE_BETWEEN: "space-between";
|
||||
export const SPACE_AROUND: "space-around";
|
||||
export function isValid(value: any): boolean;
|
||||
export function parse(value: string): JustifyContent;
|
||||
}
|
||||
/**
|
||||
* A flex-grow number. Negative values are invalid.
|
||||
*/
|
||||
export type FlexGrow = number;
|
||||
export namespace FlexGrow {
|
||||
export function isValid(value: any): boolean;
|
||||
export function parse(value: string): FlexGrow;
|
||||
}
|
||||
|
||||
export type AlignItems = "flex-start" | "flex-end" | "center" | "baseline" | "stretch";
|
||||
export namespace AlignItems {
|
||||
export const FLEX_START: "flex-start";
|
||||
export const FLEX_END: "flex-end";
|
||||
export const CENTER: "center";
|
||||
export const BASELINE: "baseline";
|
||||
export const STRETCH: "stretch";
|
||||
export function isValid(value: any): boolean;
|
||||
export function parse(value: string): AlignItems;
|
||||
}
|
||||
/**
|
||||
* A flex-shrink number. Negative values are invalid.
|
||||
*/
|
||||
export type FlexShrink = number;
|
||||
export namespace FlexShrink {
|
||||
export function isValid(value: any): boolean;
|
||||
export function parse(value: string): FlexShrink;
|
||||
}
|
||||
|
||||
export type AlignContent = "flex-start" | "flex-end" | "center" | "space-between" | "space-around" | "stretch";
|
||||
export namespace AlignContent {
|
||||
export const FLEX_START: "flex-start";
|
||||
export const FLEX_END: "flex-end";
|
||||
export const CENTER: "center";
|
||||
export const SPACE_BETWEEN: "space-between";
|
||||
export const SPACE_AROUND: "space-around";
|
||||
export const STRETCH: "stretch";
|
||||
export function isValid(value: any): boolean;
|
||||
export function parse(value: string): AlignContent;
|
||||
}
|
||||
/**
|
||||
* A flex-wrap-before value. True, false or their string presentations "true" or "false".
|
||||
*/
|
||||
export type FlexWrapBefore = boolean;
|
||||
export namespace FlexWrapBefore {
|
||||
export function isValid(value: any): boolean;
|
||||
export function parse(value: string): FlexWrapBefore;
|
||||
}
|
||||
|
||||
/**
|
||||
* A flex order integer.
|
||||
*/
|
||||
export type Order = number;
|
||||
export namespace Order {
|
||||
export function isValid(value: any): boolean;
|
||||
export function parse(value: string): Order;
|
||||
}
|
||||
export type AlignSelf = "auto" | AlignItems;
|
||||
export namespace AlignSelf {
|
||||
export const AUTO: "auto";
|
||||
export const FLEX_START: "flex-start";
|
||||
export const FLEX_END: "flex-end";
|
||||
export const CENTER: "center";
|
||||
export const BASELINE: "baseline";
|
||||
export const STRETCH: "stretch";
|
||||
export function isValid(value: any): boolean;
|
||||
export function parse(value: string): AlignSelf;
|
||||
}
|
||||
|
||||
/**
|
||||
* A flex-grow number. Negative values are invalid.
|
||||
*/
|
||||
export type FlexGrow = number;
|
||||
export namespace FlexGrow {
|
||||
export function isValid(value: any): boolean;
|
||||
export function parse(value: string): FlexGrow;
|
||||
}
|
||||
export class FlexboxLayout extends LayoutBase {
|
||||
public flexDirection: FlexDirection;
|
||||
public flexWrap: FlexWrap;
|
||||
public justifyContent: JustifyContent;
|
||||
public alignItems: AlignItems;
|
||||
public alignContent: AlignContent;
|
||||
|
||||
/**
|
||||
* A flex-shrink number. Negative values are invalid.
|
||||
*/
|
||||
export type FlexShrink = number;
|
||||
export namespace FlexShrink {
|
||||
export function isValid(value: any): boolean;
|
||||
export function parse(value: string): FlexShrink;
|
||||
}
|
||||
public static setOrder(view: View, order: number);
|
||||
public static getOrder(view: View): number;
|
||||
|
||||
/**
|
||||
* A flex-wrap-before value. True, false or their string presentations "true" or "false".
|
||||
*/
|
||||
export type FlexWrapBefore = boolean;
|
||||
export namespace FlexWrapBefore {
|
||||
export function isValid(value: any): boolean;
|
||||
export function parse(value: string): FlexWrapBefore;
|
||||
}
|
||||
public static setFlexGrow(view: View, grow: number);
|
||||
public static getFlexGrow(view: View);
|
||||
|
||||
export type AlignSelf = "auto" | AlignItems;
|
||||
export namespace AlignSelf {
|
||||
export const AUTO: "auto";
|
||||
export const FLEX_START: "flex-start";
|
||||
export const FLEX_END: "flex-end";
|
||||
export const CENTER: "center";
|
||||
export const BASELINE: "baseline";
|
||||
export const STRETCH: "stretch";
|
||||
export function isValid(value: any): boolean;
|
||||
export function parse(value: string): AlignSelf;
|
||||
}
|
||||
public static setFlexShrink(view: View, shrink: number);
|
||||
public static getFlexShrink(view: View): number;
|
||||
|
||||
export class FlexboxLayout extends LayoutBase {
|
||||
public flexDirection: FlexDirection;
|
||||
public flexWrap: FlexWrap;
|
||||
public justifyContent: JustifyContent;
|
||||
public alignItems: AlignItems;
|
||||
public alignContent: AlignContent;
|
||||
public static setAlignSelf(view: View, align: AlignSelf);
|
||||
public static getAlignSelf(view: View): AlignSelf;
|
||||
|
||||
public static setOrder(view: View, order: number);
|
||||
public static getOrder(view: View): number;
|
||||
public static setFlexWrapBefore(view: View, wrap: boolean);
|
||||
public static getFlexWrapBefore(view: View): boolean;
|
||||
}
|
||||
|
||||
public static setFlexGrow(view: View, grow: number);
|
||||
public static getFlexGrow(view: View);
|
||||
export const flexDirectionProperty: CssProperty<Style, FlexDirection>;
|
||||
export const flexWrapProperty: CssProperty<Style, FlexWrap>;
|
||||
export const justifyContentProperty: CssProperty<Style, JustifyContent>;
|
||||
export const alignItemsProperty: CssProperty<Style, AlignItems>;
|
||||
|
||||
public static setFlexShrink(view: View, shrink: number);
|
||||
public static getFlexShrink(view: View): number;
|
||||
|
||||
public static setAlignSelf(view: View, align: AlignSelf);
|
||||
public static getAlignSelf(view: View): AlignSelf;
|
||||
|
||||
public static setFlexWrapBefore(view: View, wrap: boolean);
|
||||
public static getFlexWrapBefore(view: View): boolean;
|
||||
}
|
||||
|
||||
export const flexDirectionProperty: CssProperty<Style, FlexDirection>;
|
||||
export const flexWrapProperty: CssProperty<Style, FlexWrap>;
|
||||
export const justifyContentProperty: CssProperty<Style, JustifyContent>;
|
||||
export const alignItemsProperty: CssProperty<Style, AlignItems>;
|
||||
|
||||
export const orderProperty: CssProperty<Style, Order>;
|
||||
export const flexGrowProperty: CssProperty<Style, FlexGrow>;
|
||||
export const flexShrinkProperty: CssProperty<Style, FlexShrink>;
|
||||
export const flexWrapBeforeProperty: CssProperty<Style, FlexWrapBefore>;
|
||||
export const alignSelfProperty: CssProperty<Style, AlignSelf>;
|
||||
}
|
||||
export const orderProperty: CssProperty<Style, Order>;
|
||||
export const flexGrowProperty: CssProperty<Style, FlexGrow>;
|
||||
export const flexShrinkProperty: CssProperty<Style, FlexShrink>;
|
||||
export const flexWrapBeforeProperty: CssProperty<Style, FlexWrapBefore>;
|
||||
export const alignSelfProperty: CssProperty<Style, AlignSelf>;
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
//@private
|
||||
declare module "ui/layouts/flex-box" {
|
||||
import {View} from "ui/core/view";
|
||||
export function _setAndroidLayoutParams(lp: any /* org.nativescript.widgets.FlexboxLayout.LayoutParams */, view: View);
|
||||
}
|
||||
//@endprivate
|
||||
@@ -1,2 +1,5 @@
|
||||
{ "name" : "flexbox-layout",
|
||||
"main" : "flexbox-layout" }
|
||||
{
|
||||
"name" : "flexbox-layout",
|
||||
"main" : "flexbox-layout",
|
||||
"types" : "flexbox-layout.d.ts"
|
||||
}
|
||||
|
||||
@@ -10,15 +10,6 @@ function validateArgs(element: View): View {
|
||||
return element;
|
||||
}
|
||||
|
||||
declare module "ui/core/view" {
|
||||
interface View {
|
||||
row: number;
|
||||
col: number;
|
||||
rowSpan: number;
|
||||
colSpan: number;
|
||||
}
|
||||
}
|
||||
|
||||
View.prototype.row = 0;
|
||||
View.prototype.col = 0;
|
||||
View.prototype.rowSpan = 1;
|
||||
|
||||
@@ -1,167 +1,165 @@
|
||||
declare module "ui/layouts/grid-layout" {
|
||||
import { LayoutBase, Property, View } from "ui/layouts/layout-base";
|
||||
import { LayoutBase, Property, View } from "ui/layouts/layout-base";
|
||||
|
||||
/**
|
||||
* Defines row/column specific properties that apply to GridLayout elements.
|
||||
*/
|
||||
export class ItemSpec {
|
||||
|
||||
constructor();
|
||||
constructor(value: number, type: GridUnitType);
|
||||
|
||||
/**
|
||||
* Defines row/column specific properties that apply to GridLayout elements.
|
||||
* Gets the actual length of an ItemSpec.
|
||||
*/
|
||||
export class ItemSpec {
|
||||
|
||||
constructor();
|
||||
constructor(value: number, type: GridUnitType);
|
||||
|
||||
/**
|
||||
* Gets the actual length of an ItemSpec.
|
||||
*/
|
||||
actualLength: number;
|
||||
|
||||
/**
|
||||
* Returns unit type of this ItemSpec instance.
|
||||
*/
|
||||
gridUnitType: GridUnitType;
|
||||
|
||||
/**
|
||||
* Returns true if this ItemSpec instance holds
|
||||
* an absolute (pixel) value.
|
||||
*/
|
||||
isAbsolute: boolean;
|
||||
|
||||
/**
|
||||
* Returns true if this GridLength instance is
|
||||
* automatic (not specified).
|
||||
*/
|
||||
isAuto: boolean;
|
||||
|
||||
/**
|
||||
* Returns true if this ItemSpec instance holds weighted propertion
|
||||
* of available space.
|
||||
*/
|
||||
isStar: boolean;
|
||||
|
||||
/**
|
||||
* Returns value part of this ItemSpec instance.
|
||||
*/
|
||||
value: number;
|
||||
}
|
||||
actualLength: number;
|
||||
|
||||
/**
|
||||
* Defines a rectangular layout area that consists of columns and rows.
|
||||
* Returns unit type of this ItemSpec instance.
|
||||
*/
|
||||
export class GridLayout extends LayoutBase {
|
||||
gridUnitType: GridUnitType;
|
||||
|
||||
/**
|
||||
* Gets the value of the Column attached property from a given View.
|
||||
*/
|
||||
static getColumn(view: View): number;
|
||||
/**
|
||||
* Returns true if this ItemSpec instance holds
|
||||
* an absolute (pixel) value.
|
||||
*/
|
||||
isAbsolute: boolean;
|
||||
|
||||
/**
|
||||
* Sets the value of the Column attached property to a given View.
|
||||
*/
|
||||
static setColumn(view: View, value: number): void;
|
||||
/**
|
||||
* Returns true if this GridLength instance is
|
||||
* automatic (not specified).
|
||||
*/
|
||||
isAuto: boolean;
|
||||
|
||||
/**
|
||||
* Gets the value of the ColumnSpan attached property from a given View.
|
||||
*/
|
||||
static getColumnSpan(view: View): number;
|
||||
/**
|
||||
* Returns true if this ItemSpec instance holds weighted propertion
|
||||
* of available space.
|
||||
*/
|
||||
isStar: boolean;
|
||||
|
||||
/**
|
||||
* Sets the value of the ColumnSpan attached property to a given View.
|
||||
*/
|
||||
static setColumnSpan(view: View, value: number): void;
|
||||
/**
|
||||
* Returns value part of this ItemSpec instance.
|
||||
*/
|
||||
value: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the Row attached property from a given View.
|
||||
*/
|
||||
static getRow(view: View): number;
|
||||
|
||||
/**
|
||||
* Sets the value of the Row attached property to a given View.
|
||||
*/
|
||||
static setRow(view: View, value: number): void;
|
||||
|
||||
/**
|
||||
* Gets the value of the RowSpan attached property from a given View.
|
||||
*/
|
||||
static getRowSpan(view: View): number;
|
||||
|
||||
/**
|
||||
* Sets the value of the RowSpan attached property to a given View.
|
||||
*/
|
||||
static setRowSpan(view: View, value: number): void;
|
||||
|
||||
/**
|
||||
* Adds a column specification to a GridLayout.
|
||||
*/
|
||||
public addColumn(itemSpec: ItemSpec): void;
|
||||
|
||||
/**
|
||||
* Adds a row specification to a GridLayout.
|
||||
*/
|
||||
public addRow(itemSpec: ItemSpec): void;
|
||||
|
||||
/**
|
||||
* Removes a column specification from a GridLayout.
|
||||
*/
|
||||
public removeColumn(itemSpec: ItemSpec): void;
|
||||
|
||||
/**
|
||||
* Removes all columns specification from a GridLayout.
|
||||
*/
|
||||
public removeColumns(): void;
|
||||
|
||||
/**
|
||||
* Removes a row specification from a GridLayout.
|
||||
*/
|
||||
public removeRow(itemSpec: ItemSpec): void;
|
||||
|
||||
/**
|
||||
* Removes all rows specification from a GridLayout.
|
||||
*/
|
||||
public removeRows(): void;
|
||||
|
||||
/**
|
||||
* Gets array of column specifications defined on this instance of GridLayout.
|
||||
*/
|
||||
public getColumns(): Array<ItemSpec>;
|
||||
|
||||
/**
|
||||
* Gets array of row specifications defined on this instance of GridLayout.
|
||||
*/
|
||||
public getRows(): Array<ItemSpec>;
|
||||
|
||||
//@private
|
||||
public _onRowAdded(itemSpec: ItemSpec): void;
|
||||
public _onColumnAdded(itemSpec: ItemSpec): void;
|
||||
public _onRowRemoved(itemSpec: ItemSpec, index: number): void;
|
||||
public _onColumnRemoved(itemSpec: ItemSpec, index: number): void;
|
||||
//@endprivate
|
||||
}
|
||||
/**
|
||||
* Defines a rectangular layout area that consists of columns and rows.
|
||||
*/
|
||||
export class GridLayout extends LayoutBase {
|
||||
|
||||
/**
|
||||
* Represents the observable property backing the column property.
|
||||
* Gets the value of the Column attached property from a given View.
|
||||
*/
|
||||
export const columnProperty: Property<GridLayout, number>;
|
||||
static getColumn(view: View): number;
|
||||
|
||||
/**
|
||||
* Represents the observable property backing the columnSpan property.
|
||||
* Sets the value of the Column attached property to a given View.
|
||||
*/
|
||||
export const columnSpanProperty: Property<GridLayout, number>;
|
||||
static setColumn(view: View, value: number): void;
|
||||
|
||||
/**
|
||||
* Represents the observable property backing the row property.
|
||||
* Gets the value of the ColumnSpan attached property from a given View.
|
||||
*/
|
||||
export const rowProperty: Property<GridLayout, number>;
|
||||
static getColumnSpan(view: View): number;
|
||||
|
||||
/**
|
||||
* Represents the observable property backing the rowSpan property.
|
||||
* Sets the value of the ColumnSpan attached property to a given View.
|
||||
*/
|
||||
export const rowSpanProperty: Property<GridLayout, number>;
|
||||
static setColumnSpan(view: View, value: number): void;
|
||||
|
||||
export type GridUnitType = "pixel" | "star" | "auto";
|
||||
export namespace GridUnitType {
|
||||
export const PIXEL: "pixel";
|
||||
export const STAR: "star";
|
||||
export const AUTO: "auto";
|
||||
export function isValid(value: any): boolean;
|
||||
export function parse(value: string): GridUnitType;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Gets the value of the Row attached property from a given View.
|
||||
*/
|
||||
static getRow(view: View): number;
|
||||
|
||||
/**
|
||||
* Sets the value of the Row attached property to a given View.
|
||||
*/
|
||||
static setRow(view: View, value: number): void;
|
||||
|
||||
/**
|
||||
* Gets the value of the RowSpan attached property from a given View.
|
||||
*/
|
||||
static getRowSpan(view: View): number;
|
||||
|
||||
/**
|
||||
* Sets the value of the RowSpan attached property to a given View.
|
||||
*/
|
||||
static setRowSpan(view: View, value: number): void;
|
||||
|
||||
/**
|
||||
* Adds a column specification to a GridLayout.
|
||||
*/
|
||||
public addColumn(itemSpec: ItemSpec): void;
|
||||
|
||||
/**
|
||||
* Adds a row specification to a GridLayout.
|
||||
*/
|
||||
public addRow(itemSpec: ItemSpec): void;
|
||||
|
||||
/**
|
||||
* Removes a column specification from a GridLayout.
|
||||
*/
|
||||
public removeColumn(itemSpec: ItemSpec): void;
|
||||
|
||||
/**
|
||||
* Removes all columns specification from a GridLayout.
|
||||
*/
|
||||
public removeColumns(): void;
|
||||
|
||||
/**
|
||||
* Removes a row specification from a GridLayout.
|
||||
*/
|
||||
public removeRow(itemSpec: ItemSpec): void;
|
||||
|
||||
/**
|
||||
* Removes all rows specification from a GridLayout.
|
||||
*/
|
||||
public removeRows(): void;
|
||||
|
||||
/**
|
||||
* Gets array of column specifications defined on this instance of GridLayout.
|
||||
*/
|
||||
public getColumns(): Array<ItemSpec>;
|
||||
|
||||
/**
|
||||
* Gets array of row specifications defined on this instance of GridLayout.
|
||||
*/
|
||||
public getRows(): Array<ItemSpec>;
|
||||
|
||||
//@private
|
||||
public _onRowAdded(itemSpec: ItemSpec): void;
|
||||
public _onColumnAdded(itemSpec: ItemSpec): void;
|
||||
public _onRowRemoved(itemSpec: ItemSpec, index: number): void;
|
||||
public _onColumnRemoved(itemSpec: ItemSpec, index: number): void;
|
||||
//@endprivate
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the observable property backing the column property.
|
||||
*/
|
||||
export const columnProperty: Property<GridLayout, number>;
|
||||
|
||||
/**
|
||||
* Represents the observable property backing the columnSpan property.
|
||||
*/
|
||||
export const columnSpanProperty: Property<GridLayout, number>;
|
||||
|
||||
/**
|
||||
* Represents the observable property backing the row property.
|
||||
*/
|
||||
export const rowProperty: Property<GridLayout, number>;
|
||||
|
||||
/**
|
||||
* Represents the observable property backing the rowSpan property.
|
||||
*/
|
||||
export const rowSpanProperty: Property<GridLayout, number>;
|
||||
|
||||
export type GridUnitType = "pixel" | "star" | "auto";
|
||||
export namespace GridUnitType {
|
||||
export const PIXEL: "pixel";
|
||||
export const STAR: "star";
|
||||
export const AUTO: "auto";
|
||||
export function isValid(value: any): boolean;
|
||||
export function parse(value: string): GridUnitType;
|
||||
}
|
||||
|
||||
@@ -1,2 +1,5 @@
|
||||
{ "name" : "grid-layout",
|
||||
"main" : "grid-layout" }
|
||||
{
|
||||
"name" : "grid-layout",
|
||||
"main" : "grid-layout",
|
||||
"types" : "grid-layout.d.ts"
|
||||
}
|
||||
|
||||
158
tns-core-modules/ui/layouts/layout-base.d.ts
vendored
158
tns-core-modules/ui/layouts/layout-base.d.ts
vendored
@@ -1,99 +1,97 @@
|
||||
declare module "ui/layouts/layout-base" {
|
||||
import { View, CustomLayoutView, Property, Length } from "ui/core/view";
|
||||
import { View, CustomLayoutView, Property, Length } from "ui/core/view";
|
||||
|
||||
export * from "ui/core/view";
|
||||
|
||||
export * from "ui/core/view";
|
||||
|
||||
/**
|
||||
* Base class for all views that supports children positioning.
|
||||
*/
|
||||
export class LayoutBase extends CustomLayoutView {
|
||||
/**
|
||||
* Base class for all views that supports children positioning.
|
||||
* Returns the number of children in this Layout.
|
||||
*/
|
||||
export class LayoutBase extends CustomLayoutView {
|
||||
/**
|
||||
* Returns the number of children in this Layout.
|
||||
*/
|
||||
getChildrenCount(): number;
|
||||
getChildrenCount(): number;
|
||||
|
||||
/**
|
||||
* Returns the view at the specified position.
|
||||
* @param index The position at which to get the child from.
|
||||
*/
|
||||
getChildAt(index: number): View;
|
||||
/**
|
||||
* Returns the view at the specified position.
|
||||
* @param index The position at which to get the child from.
|
||||
*/
|
||||
getChildAt(index: number): View;
|
||||
|
||||
/**
|
||||
* Returns the position of the child view
|
||||
* @param child The child view that we are looking for.
|
||||
*/
|
||||
getChildIndex(child: View): number;
|
||||
/**
|
||||
* Returns the position of the child view
|
||||
* @param child The child view that we are looking for.
|
||||
*/
|
||||
getChildIndex(child: View): number;
|
||||
|
||||
/**
|
||||
* Adds the view to children array.
|
||||
* @param view The view to be added to the end of the children array.
|
||||
*/
|
||||
addChild(view: View): void;
|
||||
/**
|
||||
* Adds the view to children array.
|
||||
* @param view The view to be added to the end of the children array.
|
||||
*/
|
||||
addChild(view: View): void;
|
||||
|
||||
/**
|
||||
* Inserts the view to children array at the specified index.
|
||||
* @param view The view to be added to the end of the children array.
|
||||
* @param atIndex The insertion index.
|
||||
*/
|
||||
insertChild(child: View, atIndex: number): void;
|
||||
/**
|
||||
* Inserts the view to children array at the specified index.
|
||||
* @param view The view to be added to the end of the children array.
|
||||
* @param atIndex The insertion index.
|
||||
*/
|
||||
insertChild(child: View, atIndex: number): void;
|
||||
|
||||
/**
|
||||
* Removes the specified view from the children array.
|
||||
* @param view The view to remove from the children array.
|
||||
*/
|
||||
removeChild(view: View): void;
|
||||
/**
|
||||
* Removes the specified view from the children array.
|
||||
* @param view The view to remove from the children array.
|
||||
*/
|
||||
removeChild(view: View): void;
|
||||
|
||||
/**
|
||||
* Removes all views in this layout.
|
||||
*/
|
||||
removeChildren(): void;
|
||||
/**
|
||||
* Removes all views in this layout.
|
||||
*/
|
||||
removeChildren(): void;
|
||||
|
||||
/**
|
||||
* INTERNAL. Used by the layout system.
|
||||
*/
|
||||
_registerLayoutChild(child: View): void;
|
||||
/**
|
||||
* INTERNAL. Used by the layout system.
|
||||
*/
|
||||
_registerLayoutChild(child: View): void;
|
||||
|
||||
/**
|
||||
* INTERNAL. Used by the layout system.
|
||||
*/
|
||||
_unregisterLayoutChild(child: View): void;
|
||||
/**
|
||||
* INTERNAL. Used by the layout system.
|
||||
*/
|
||||
_unregisterLayoutChild(child: View): void;
|
||||
|
||||
/**
|
||||
* Calls the callback for each child that should be laid out.
|
||||
* @param callback The callback
|
||||
*/
|
||||
eachLayoutChild(callback: (child: View, isLast: boolean) => void): void;
|
||||
/**
|
||||
* Calls the callback for each child that should be laid out.
|
||||
* @param callback The callback
|
||||
*/
|
||||
eachLayoutChild(callback: (child: View, isLast: boolean) => void): void;
|
||||
|
||||
/**
|
||||
* Gets or sets padding style property.
|
||||
*/
|
||||
padding: string | Length;
|
||||
/**
|
||||
* Gets or sets padding style property.
|
||||
*/
|
||||
padding: string | Length;
|
||||
|
||||
/**
|
||||
* Specify the bottom padding of this layout.
|
||||
*/
|
||||
paddingBottom: Length;
|
||||
/**
|
||||
* Specify the bottom padding of this layout.
|
||||
*/
|
||||
paddingBottom: Length;
|
||||
|
||||
/**
|
||||
* Specify the left padding of this layout.
|
||||
*/
|
||||
paddingLeft: Length;
|
||||
/**
|
||||
* Specify the left padding of this layout.
|
||||
*/
|
||||
paddingLeft: Length;
|
||||
|
||||
/**
|
||||
* Specify the right padding of this layout.
|
||||
*/
|
||||
paddingRight: Length;
|
||||
/**
|
||||
* Specify the right padding of this layout.
|
||||
*/
|
||||
paddingRight: Length;
|
||||
|
||||
/**
|
||||
* Specify the top padding of this layout.
|
||||
*/
|
||||
paddingTop: Length;
|
||||
/**
|
||||
* Specify the top padding of this layout.
|
||||
*/
|
||||
paddingTop: Length;
|
||||
|
||||
/**
|
||||
* Gets or sets a value indicating whether to clip the content of this layout.
|
||||
*/
|
||||
clipToBounds: boolean;
|
||||
}
|
||||
/**
|
||||
* Gets or sets a value indicating whether to clip the content of this layout.
|
||||
*/
|
||||
clipToBounds: boolean;
|
||||
}
|
||||
|
||||
export const clipToBoundsProperty: Property<LayoutBase, boolean>;
|
||||
}
|
||||
export const clipToBoundsProperty: Property<LayoutBase, boolean>;
|
||||
|
||||
14
tns-core-modules/ui/layouts/layout.d.ts
vendored
14
tns-core-modules/ui/layouts/layout.d.ts
vendored
@@ -1,10 +1,8 @@
|
||||
declare module "ui/layouts/layout" {
|
||||
import { LayoutBase } from "ui/layouts/layout-base";
|
||||
import { LayoutBase } from "ui/layouts/layout-base";
|
||||
|
||||
/**
|
||||
* Base class for all views that supports children positioning in cross platform manner.
|
||||
*/
|
||||
export class Layout extends LayoutBase {
|
||||
//
|
||||
}
|
||||
/**
|
||||
* Base class for all views that supports children positioning in cross platform manner.
|
||||
*/
|
||||
export class Layout extends LayoutBase {
|
||||
//
|
||||
}
|
||||
|
||||
@@ -1,2 +1,5 @@
|
||||
{ "name" : "stack-layout",
|
||||
"main" : "stack-layout" }
|
||||
{
|
||||
"name" : "stack-layout",
|
||||
"main" : "stack-layout",
|
||||
"types" : "stack-layout.d.ts"
|
||||
}
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
declare module "ui/layouts/stack-layout" {
|
||||
import { LayoutBase, Property } from "ui/layouts/layout-base";
|
||||
import { LayoutBase, Property } from "ui/layouts/layout-base";
|
||||
|
||||
/**
|
||||
* A Layout that arranges its children horizontally or vertically. The direction can be set by orientation property.
|
||||
*/
|
||||
export class StackLayout extends LayoutBase {
|
||||
/**
|
||||
* A Layout that arranges its children horizontally or vertically. The direction can be set by orientation property.
|
||||
* Gets or sets if layout should be horizontal or vertical.
|
||||
* The default value is vertical.
|
||||
*/
|
||||
class StackLayout extends LayoutBase {
|
||||
/**
|
||||
* Gets or sets if layout should be horizontal or vertical.
|
||||
* The default value is vertical.
|
||||
*/
|
||||
orientation: "horizontal" | "vertical";
|
||||
}
|
||||
orientation: "horizontal" | "vertical";
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the observable property backing the orientation property of each StackLayout instance.
|
||||
*/
|
||||
export const orientationProperty: Property<StackLayout, "horizontal" | "vertical">;
|
||||
}
|
||||
/**
|
||||
* Represents the observable property backing the orientation property of each StackLayout instance.
|
||||
*/
|
||||
export const orientationProperty: Property<StackLayout, "horizontal" | "vertical">;
|
||||
|
||||
@@ -1,2 +1,5 @@
|
||||
{ "name" : "wrap-layout",
|
||||
"main" : "wrap-layout" }
|
||||
{
|
||||
"name" : "wrap-layout",
|
||||
"main" : "wrap-layout",
|
||||
"types" : "wrap-layout.d.ts"
|
||||
}
|
||||
|
||||
@@ -1,43 +1,41 @@
|
||||
declare module "ui/layouts/wrap-layout" {
|
||||
import { LayoutBase, Property, Length } from "ui/layouts/layout-base";
|
||||
import { LayoutBase, Property, Length } from "ui/layouts/layout-base";
|
||||
|
||||
/**
|
||||
* WrapLayout position children in rows or columns depending on orientation property
|
||||
* until space is filled and then wraps them on new row or column.
|
||||
*/
|
||||
export class WrapLayout extends LayoutBase {
|
||||
|
||||
/**
|
||||
* WrapLayout position children in rows or columns depending on orientation property
|
||||
* until space is filled and then wraps them on new row or column.
|
||||
* Gets or sets the flow direction. Default value is horizontal.
|
||||
* If orientation is horizontal items are arranged in rows, else items are arranged in columns.
|
||||
*/
|
||||
class WrapLayout extends LayoutBase {
|
||||
|
||||
/**
|
||||
* Gets or sets the flow direction. Default value is horizontal.
|
||||
* If orientation is horizontal items are arranged in rows, else items are arranged in columns.
|
||||
*/
|
||||
orientation: "horizontal" | "vertical";
|
||||
|
||||
/**
|
||||
* Gets or sets the width used to measure and layout each child.
|
||||
* Default value is Number.NaN which does not restrict children.
|
||||
*/
|
||||
itemWidth: Length;
|
||||
|
||||
/**
|
||||
* Gets or sets the height used to measure and layout each child.
|
||||
* Default value is Number.NaN which does not restrict children.
|
||||
*/
|
||||
itemHeight: Length;
|
||||
}
|
||||
orientation: "horizontal" | "vertical";
|
||||
|
||||
/**
|
||||
* Represents the observable property backing the orientation property of each WrapLayout instance.
|
||||
* Gets or sets the width used to measure and layout each child.
|
||||
* Default value is Number.NaN which does not restrict children.
|
||||
*/
|
||||
export const orientationProperty: Property<WrapLayout, "horizontal" | "vertical">;
|
||||
|
||||
/**
|
||||
* Represents the observable property backing the itemWidth property of each WrapLayout instance.
|
||||
*/
|
||||
export const itemWidthProperty: Property<WrapLayout, Length>;
|
||||
itemWidth: Length;
|
||||
|
||||
/**
|
||||
* Represents the observable property backing the itemHeight property of each WrapLayout instance.
|
||||
* Gets or sets the height used to measure and layout each child.
|
||||
* Default value is Number.NaN which does not restrict children.
|
||||
*/
|
||||
export const itemHeightProperty: Property<WrapLayout, Length>;
|
||||
}
|
||||
itemHeight: Length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the observable property backing the orientation property of each WrapLayout instance.
|
||||
*/
|
||||
export const orientationProperty: Property<WrapLayout, "horizontal" | "vertical">;
|
||||
|
||||
/**
|
||||
* Represents the observable property backing the itemWidth property of each WrapLayout instance.
|
||||
*/
|
||||
export const itemWidthProperty: Property<WrapLayout, Length>;
|
||||
|
||||
/**
|
||||
* Represents the observable property backing the itemHeight property of each WrapLayout instance.
|
||||
*/
|
||||
export const itemHeightProperty: Property<WrapLayout, Length>;
|
||||
|
||||
Reference in New Issue
Block a user