1 | import { ViewBase } from '../view-base';
|
2 | import { PropertyChangeData } from '../../../data/observable';
|
3 | /**
|
4 | * The options object used in the Bindable.bind method.
|
5 | */
|
6 | export interface BindingOptions {
|
7 | /**
|
8 | * The property name of the source object (typically the ViewModel) to bind to.
|
9 | */
|
10 | sourceProperty: string;
|
11 | /**
|
12 | * The property name of the target object (that is the Bindable instance) to bind the source property to.
|
13 | */
|
14 | targetProperty: string;
|
15 | /**
|
16 | * True to establish a two-way binding, false otherwise. A two-way binding will synchronize both the source and the target property values regardless of which one initiated the change.
|
17 | */
|
18 | twoWay?: boolean;
|
19 | /**
|
20 | * An expression used for calculations (convertions) based on the value of the property.
|
21 | */
|
22 | expression?: string;
|
23 | }
|
24 | /**
|
25 | * An interface which defines methods need to create binding value converter.
|
26 | */
|
27 | export interface ValueConverter {
|
28 | /**
|
29 | * A method that will be executed when a value (of the binding property) should be converted to the observable model.
|
30 | * For example: user types in a text field, but our business logic requires to store data in a different manner (e.g. in lower case).
|
31 | * @param params - An array of parameters where first element is the value of the property and next elements are parameters send to converter.
|
32 | */
|
33 | toModel: (...params: any[]) => any;
|
34 | /**
|
35 | * A method that will be executed when a value should be converted to the UI view. For example we have a date object which should be displayed to the end user in a specific date format.
|
36 | * @param params - An array of parameters where first element is the value of the property and next elements are parameters send to converter.
|
37 | */
|
38 | toView: (...params: any[]) => any;
|
39 | }
|
40 | export declare function getEventOrGestureName(name: string): string;
|
41 | export declare function isGesture(eventOrGestureName: string): boolean;
|
42 | export declare function isEventOrGesture(name: string, view: ViewBase): boolean;
|
43 | export declare class Binding {
|
44 | private source;
|
45 | target: WeakRef<ViewBase>;
|
46 | private sourceOptions;
|
47 | private targetOptions;
|
48 | private sourceProperties;
|
49 | private propertyChangeListeners;
|
50 | updating: boolean;
|
51 | sourceIsBindingContext: boolean;
|
52 | options: BindingOptions;
|
53 | constructor(target: ViewBase, options: BindingOptions);
|
54 | private onTargetPropertyChanged;
|
55 | loadedHandlerVisualTreeBinding(args: any): void;
|
56 | clearSource(): void;
|
57 | private sourceAsObject;
|
58 | private bindingContextChanged;
|
59 | bind(source: any): void;
|
60 | private update;
|
61 | unbind(): void;
|
62 | private resolveObjectsAndProperties;
|
63 | private addPropertyChangeListeners;
|
64 | private prepareExpressionForUpdate;
|
65 | private updateTwoWay;
|
66 | private _getExpressionValue;
|
67 | onSourcePropertyChanged(data: PropertyChangeData): void;
|
68 | private prepareContextForExpression;
|
69 | private getSourcePropertyValue;
|
70 | clearBinding(): void;
|
71 | private updateTarget;
|
72 | private updateSource;
|
73 | private getParentView;
|
74 | private resolveOptions;
|
75 | private updateOptions;
|
76 | }
|