mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
BackgroundRepeat enum
This commit is contained in:
@@ -6,7 +6,7 @@ import { Background } from "ui/styling/background";
|
||||
import {
|
||||
ViewBase, getEventOrGestureName, Observable, EventData, Style,
|
||||
Property, InheritedProperty, CssProperty, ShorthandProperty, InheritedCssProperty,
|
||||
gestureFromString, isIOS, traceEnabled, traceWrite, traceCategories, traceNotifyEvent, printUnregisteredProperties
|
||||
gestureFromString, isIOS, traceEnabled, traceWrite, traceCategories, traceNotifyEvent, 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";
|
||||
@@ -1464,8 +1464,18 @@ export const backgroundColorProperty = new CssProperty<Style, Color>({
|
||||
});
|
||||
backgroundColorProperty.register(Style);
|
||||
|
||||
export const backgroundRepeatProperty = new CssProperty<Style, string>({
|
||||
name: "backgroundRepeat", cssName: "background-repeat", valueChanged: (target, newValue) => {
|
||||
export type BackgroundRepeat = "repeat" | "repeat-x" | "repeat-y" | "no-repeat";
|
||||
export namespace BackgroundRepeat {
|
||||
export const REPEAT: "repeat" = "repeat";
|
||||
export const REPEAT_X: "repeat-x" = "repeat-x";
|
||||
export const REPEAT_Y: "repeat-y" = "repeat-y";
|
||||
export const NO_REPEAT: "no-repeat" = "no-repeat";
|
||||
export const isValid = makeValidator<BackgroundRepeat>(REPEAT, REPEAT_X, REPEAT_Y, NO_REPEAT);
|
||||
export const parse = makeParser(isValid, undefined);
|
||||
}
|
||||
|
||||
export const backgroundRepeatProperty = new CssProperty<Style, BackgroundRepeat>({
|
||||
name: "backgroundRepeat", cssName: "background-repeat", valueConverter: BackgroundRepeat.parse, valueChanged: (target, newValue) => {
|
||||
let background = target.backgroundInternal;
|
||||
target.backgroundInternal = background.withRepeat(newValue);
|
||||
}
|
||||
|
||||
12
tns-core-modules/ui/core/view.d.ts
vendored
12
tns-core-modules/ui/core/view.d.ts
vendored
@@ -712,7 +712,7 @@ declare module "ui/core/view" {
|
||||
|
||||
export const backgroundColorProperty: CssProperty<Style, Color>;
|
||||
export const backgroundImageProperty: CssProperty<Style, string>;
|
||||
export const backgroundRepeatProperty: CssProperty<Style, string>;
|
||||
export const backgroundRepeatProperty: CssProperty<Style, BackgroundRepeat>;
|
||||
export const backgroundSizeProperty: CssProperty<Style, string>;
|
||||
export const backgroundPositionProperty: CssProperty<Style, string>;
|
||||
|
||||
@@ -764,4 +764,14 @@ declare module "ui/core/view" {
|
||||
|
||||
export const backgroundInternalProperty: CssProperty<Style, Background>;
|
||||
export const fontInternalProperty: InheritedCssProperty<Style, Font>;
|
||||
|
||||
export type BackgroundRepeat = "repeat" | "repeat-x" | "repeat-y" | "no-repeat";
|
||||
export namespace BackgroundRepeat {
|
||||
export const REPEAT: "repeat";
|
||||
export const REPEAT_X: "repeat-x";
|
||||
export const REPEAT_Y: "repeat-y";
|
||||
export const NO_REPEAT: "no-repeat";
|
||||
export function isValid(value: any): boolean;
|
||||
export function parse(value: string): BackgroundRepeat;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user