mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-26 03:01:51 +08:00
GridUnitType enum + fixes
This commit is contained in:
@ -1,38 +1,38 @@
|
||||
import * as buttonModule from "ui/button";
|
||||
import * as pageModule from "ui/page";
|
||||
import * as gridLayoutModule from "ui/layouts/grid-layout";
|
||||
import * as model from "./myview";
|
||||
import * as model from "./myview";
|
||||
import { Button } from "ui/button";
|
||||
import { Page } from "ui/page";
|
||||
import { GridLayout, ItemSpec, GridUnitType } from "ui/layouts/grid-layout";
|
||||
|
||||
export function onLoaded(args: { eventName: string, object: any }) {
|
||||
var page = <pageModule.Page>args.object;
|
||||
var page = <Page>args.object;
|
||||
page.bindingContext = new model.ViewModel();
|
||||
}
|
||||
|
||||
export function onAddRowColumn(args: { eventName: string, object: any }) {
|
||||
var layout = <gridLayoutModule.GridLayout>args.object.parent.parent;
|
||||
var row = new gridLayoutModule.ItemSpec(1, gridLayoutModule.GridUnitType.auto);
|
||||
var column = new gridLayoutModule.ItemSpec(1, gridLayoutModule.GridUnitType.auto);
|
||||
var layout = <GridLayout>args.object.parent.parent;
|
||||
var row = new ItemSpec(1, GridUnitType.AUTO);
|
||||
var column = new ItemSpec(1, GridUnitType.AUTO);
|
||||
layout.addRow(row);
|
||||
layout.addColumn(column);
|
||||
|
||||
var btn0 = new buttonModule.Button();
|
||||
var btn1 = new buttonModule.Button();
|
||||
var btn0 = new Button();
|
||||
var btn1 = new Button();
|
||||
btn0.id = "b0";
|
||||
btn1.id = "b1";
|
||||
btn0.text = "b0";
|
||||
btn1.text = "b1";
|
||||
layout.addChild(btn0);
|
||||
layout.addChild(btn1);
|
||||
gridLayoutModule.GridLayout.setRow(btn0, 0);
|
||||
gridLayoutModule.GridLayout.setColumn(btn0, 4);
|
||||
gridLayoutModule.GridLayout.setRow(btn1, 4);
|
||||
gridLayoutModule.GridLayout.setColumn(btn1, 0);
|
||||
gridLayoutModule.GridLayout.setColumnSpan(btn1, 2);
|
||||
gridLayoutModule.GridLayout.setRowSpan(btn0, 3);
|
||||
GridLayout.setRow(btn0, 0);
|
||||
GridLayout.setColumn(btn0, 4);
|
||||
GridLayout.setRow(btn1, 4);
|
||||
GridLayout.setColumn(btn1, 0);
|
||||
GridLayout.setColumnSpan(btn1, 2);
|
||||
GridLayout.setRowSpan(btn0, 3);
|
||||
}
|
||||
|
||||
export function onRemoveRowColumn(args: { eventName: string, object: any }) {
|
||||
var layout = <gridLayoutModule.GridLayout>args.object.parent.parent;
|
||||
var layout = <GridLayout>args.object.parent.parent;
|
||||
var itemSpecs, count;
|
||||
itemSpecs = layout.getRows();
|
||||
count = itemSpecs.length;
|
||||
|
@ -1,38 +1,38 @@
|
||||
import * as buttonModule from "ui/button";
|
||||
import * as pageModule from "ui/page";
|
||||
import * as gridLayoutModule from "ui/layouts/grid-layout";
|
||||
import * as model from "./myview";
|
||||
import * as model from "./myview";
|
||||
import { Button } from "ui/button";
|
||||
import { Page } from "ui/page";
|
||||
import { GridLayout, ItemSpec, GridUnitType } from "ui/layouts/grid-layout";
|
||||
|
||||
export function onLoaded(args: { eventName: string, object: any }) {
|
||||
var page = <pageModule.Page>args.object;
|
||||
var page = <Page>args.object;
|
||||
page.bindingContext = new model.ViewModel();
|
||||
}
|
||||
|
||||
export function onAddRowColumn(args: { eventName: string, object: any }) {
|
||||
var layout = <gridLayoutModule.GridLayout>args.object.parent.parent;
|
||||
var row = new gridLayoutModule.ItemSpec(1, gridLayoutModule.GridUnitType.auto);
|
||||
var column = new gridLayoutModule.ItemSpec(1, gridLayoutModule.GridUnitType.auto);
|
||||
var layout = <GridLayout>args.object.parent.parent;
|
||||
var row = new ItemSpec(1, GridUnitType.AUTO);
|
||||
var column = new ItemSpec(1, GridUnitType.AUTO);
|
||||
layout.addRow(row);
|
||||
layout.addColumn(column);
|
||||
|
||||
var btn0 = new buttonModule.Button();
|
||||
var btn1 = new buttonModule.Button();
|
||||
var btn0 = new Button();
|
||||
var btn1 = new Button();
|
||||
btn0.id = "b0";
|
||||
btn1.id = "b1";
|
||||
btn0.text = "b0";
|
||||
btn1.text = "b1";
|
||||
layout.addChild(btn0);
|
||||
layout.addChild(btn1);
|
||||
gridLayoutModule.GridLayout.setRow(btn0, 0);
|
||||
gridLayoutModule.GridLayout.setColumn(btn0, 4);
|
||||
gridLayoutModule.GridLayout.setRow(btn1, 4);
|
||||
gridLayoutModule.GridLayout.setColumn(btn1, 0);
|
||||
gridLayoutModule.GridLayout.setColumnSpan(btn1, 2);
|
||||
gridLayoutModule.GridLayout.setRowSpan(btn0, 3);
|
||||
GridLayout.setRow(btn0, 0);
|
||||
GridLayout.setColumn(btn0, 4);
|
||||
GridLayout.setRow(btn1, 4);
|
||||
GridLayout.setColumn(btn1, 0);
|
||||
GridLayout.setColumnSpan(btn1, 2);
|
||||
GridLayout.setRowSpan(btn0, 3);
|
||||
}
|
||||
|
||||
export function onRemoveRowColumn(args: { eventName: string, object: any }) {
|
||||
var layout = <gridLayoutModule.GridLayout>args.object.parent.parent;
|
||||
var layout = <GridLayout>args.object.parent.parent;
|
||||
var itemSpecs, count;
|
||||
itemSpecs = layout.getRows();
|
||||
count = itemSpecs.length;
|
||||
|
@ -1,10 +1,9 @@
|
||||
import * as color from "color";
|
||||
import * as page from "ui/page";
|
||||
import * as style from "ui/styling/style";
|
||||
import * as view from "ui/core/view";
|
||||
import { Color } from "color";
|
||||
import { Page } from "ui/page";
|
||||
import { View, unsetValue } from "ui/core/view";
|
||||
|
||||
export function applyTap(args) {
|
||||
let page = <page.Page>(<view.View>args.object).page;
|
||||
let page = <Page>(<View>args.object).page;
|
||||
|
||||
reset(page);
|
||||
|
||||
@ -13,17 +12,17 @@ export function applyTap(args) {
|
||||
}
|
||||
|
||||
export function applyTapOnStyledActionBar(args) {
|
||||
let page = <page.Page>(<view.View>args.object).page;
|
||||
let page = <Page>(<View>args.object).page;
|
||||
|
||||
reset(page);
|
||||
|
||||
page.actionBar.backgroundColor = new color.Color("#5DFC0A");
|
||||
page.actionBar.backgroundColor = new Color("#5DFC0A");
|
||||
var css = "#test-element { " + args.object.tag + " }";
|
||||
page.css = css;
|
||||
}
|
||||
|
||||
export function applyTapWithHiddenActionBar(args) {
|
||||
let page = <page.Page>(<view.View>args.object).page;
|
||||
let page = <Page>(<View>args.object).page;
|
||||
|
||||
reset(page);
|
||||
|
||||
@ -33,7 +32,7 @@ export function applyTapWithHiddenActionBar(args) {
|
||||
}
|
||||
|
||||
export function applyTapWithSpan(args) {
|
||||
let page = <page.Page>(<view.View>args.object).page;
|
||||
let page = <Page>(<View>args.object).page;
|
||||
|
||||
reset(page);
|
||||
|
||||
@ -43,18 +42,18 @@ export function applyTapWithSpan(args) {
|
||||
}
|
||||
|
||||
export function applyTapOnStyledActionBarAndSpan(args) {
|
||||
let page = <page.Page>(<view.View>args.object).page;
|
||||
let page = <Page>(<View>args.object).page;
|
||||
|
||||
reset(page);
|
||||
|
||||
page.backgroundSpanUnderStatusBar = true;
|
||||
page.actionBar.backgroundColor = new color.Color("#E0115F");
|
||||
page.actionBar.backgroundColor = new Color("#E0115F");
|
||||
var css = "#test-element { " + args.object.tag + " }";
|
||||
page.css = css;
|
||||
}
|
||||
|
||||
export function applyTapWithActionBarHiddenAndSpan(args) {
|
||||
let page = <page.Page>(<view.View>args.object).page;
|
||||
let page = <Page>(<View>args.object).page;
|
||||
|
||||
reset(page);
|
||||
|
||||
@ -64,7 +63,7 @@ export function applyTapWithActionBarHiddenAndSpan(args) {
|
||||
page.css = css;
|
||||
}
|
||||
|
||||
function reset(page: page.Page) {
|
||||
function reset(page: Page) {
|
||||
page.css = "";
|
||||
page.actionBarHidden = false;
|
||||
page.backgroundSpanUnderStatusBar = false;
|
||||
|
@ -7,7 +7,7 @@ import { TextView } from "ui/text-view";
|
||||
var view: View;
|
||||
export function navigatingTo(args: EventData) {
|
||||
var page = <Page>args.object;
|
||||
view = page.getViewById("target");
|
||||
view = <View>page.getViewById("target");
|
||||
}
|
||||
|
||||
export function onPan(data: PanGestureEventData) {
|
||||
|
Reference in New Issue
Block a user