/*! * * Wijmo Library 5.20251.40 * https://developer.mescius.com/wijmo * * Copyright(c) MESCIUS inc. All rights reserved. * * Licensed under the End-User License Agreement For MESCIUS Wijmo Software. * us.sales@mescius.com * https://developer.mescius.com/wijmo/licensing * */ /** * {@module wijmo.knockout.base} * Contains KnockoutJS bindings for the Wijmo controls. * * The bindings allow you to add Wijmo controls to * KnockoutJS * applications using simple markup in HTML pages. * * To add a Wijmo control to a certain place in a page's markup, add the <div> * element and define a binding for the control in the data-bind attribute. * The binding name corresponds to the control name with a wj prefix. For example, the {@link wjInputNumber} * binding represents the Wijmo {@link InputNumber} control. The binding value is an object literal containing * properties corresponding to the control's read-write property and event names, with their values defining * the corresponding control property values and event handlers. * * The following markup creates a Wijmo InputNumber control with the value property bound to the * view model's theValue property, the step property set to 1 and the inputType property set to 'text': * *
<div data-bind="wjInputNumber: { value: theValue, step: 1, inputType: 'text' }"></div>* *
<wj-input-number value="theValue" step="1" input-type="'text'"></wj-input-number>* * Note that attribute values should be defined using exactly the same JavaScript expressions syntax as you use in * data-bind definitions. The Wijmo for Knockout preprocessor converts such elements to the conventional data-bind form, * see the Custom elements preprocessor topic for more details. * *
<!-- HTML --> * <div data-bind="wjInputNumber: { value: theValue, step: 1, valueChanged: valueChangedEH }"></div> * * //View Model * this.valueChangedEH = function (data, sender, args) { * alert('The new value is: ' + sender.value); * }* * The same control defined using the custom element syntax: * *
<wj-input-number value="theValue" step="1" value-changed="valueChangedEH"></wj-input-number>* *
<!-- HTML --> * <div data-bind="wjInputNumber: { value: theValue }"></div> * * //View Model * this.theValue = ko.observable();* *
<div data-bind="wjFlexChart: { itemsSource: data, bindingX: 'country' }"> * <div data-bind="wjFlexChartAxis: { wjProperty: 'axisX', title: chartProps.titleX }"></div> * <div data-bind="wjFlexChartAxis: { wjProperty: 'axisY', title: chartProps.titleY }"></div> * <div data-bind="wjFlexChartSeries: { name: 'Sales', binding: 'sales' }"></div> * <div data-bind="wjFlexChartSeries: { name: 'Downloads', binding: 'downloads' }"></div> * </div>* * The same control defined using the custom element syntax: * *
<wj-flex-chart items-source="data" binding-x="'country'"> * <wj-flex-chart-axis wj-property="'axisX'" title="chartProps.titleX"></wj-flex-chart-axis> * <wj-flex-chart-axis wj-property="'axisY'" title="chartProps.titleY"></wj-flex-chart-axis> * <wj-flex-chart-series name="'Sales'" binding"'sales'"></wj-flex-chart-series> * <wj-flex-chart-series name="'Downloads'" binding"'downloads'"></wj-flex-chart-series> * </wj-flex-chart>* *
<!-- HTML --> * <div data-bind="'wjFlexGrid': { itemsSource: data, control: flex }"></div> * <button data-bind="click: moveToNext">Next</button> * * //View Model * this.flex = ko.observable(); * this.moveToNext = function () { * this.flex().collectionView.moveCurrentToNext(); * }* *
<!-- HTML --> * <div data-bind="'wjFlexGrid': { itemsSource: dataArray, initialized: flexInitialized }"> * <div data-bind="wjFlexGridColumn: { binding: 'sales', format: 'n2' }"></div> * <div data-bind="wjFlexGridColumn: { binding: 'downloads', format: 'n2' }"></div> * </div> * * //View Model * this.flexInitialized = function (data, sender, args) { * var columns = sender.columns; * for (var i = 0; i < columns.length; i++) { * if (columns[i].dataType = wijmo.DataType.Number) { * columns[i].format = 'n0’; * } * } * }* *
<script src="scripts/wijmo.js"></script> * <script src="scripts/wijmo.input.js"></script> * <script> * wijmo.disableKnockoutTags = true; * </script> * <script src="scripts/wijmo.knockout.js"></script>* * Note that in this case you can use only the conventional data-bind syntax for adding Wijmo controls to the page * markup; the Wijmo custom elements are not recognized. */ /** * */ export declare var ___keepComment: any; import { ControlMetaFactory, PropertyType, EventDescBase, ComplexPropDescBase, PropDescBase, MetaDataBase } from 'wijmo/wijmo.meta'; export declare class MetaFactory extends ControlMetaFactory { static CreateProp(propertyName: string, propertyType: PropertyType, changeEvent?: string, enumType?: any, isNativeControlProperty?: boolean, priority?: number): PropDesc; static CreateEvent(eventName: string, isPropChanged?: boolean): EventDesc; static CreateComplexProp(propertyName: string, isArray: boolean, ownsObject?: boolean): ComplexPropDesc; static findProp(propName: string, props: PropDesc[]): PropDesc; static findEvent(eventName: string, events: EventDesc[]): EventDesc; static findComplexProp(propName: string, props: ComplexPropDesc[]): ComplexPropDesc; } export interface IUpdateControlHandler { (link: any, propDesc: PropDesc, control: any, unconvertedValue: any, convertedValue: any): boolean; } export declare class PropDesc extends PropDescBase { updateControl: IUpdateControlHandler; } export declare class EventDesc extends EventDescBase { } export declare class ComplexPropDesc extends ComplexPropDescBase { } export declare class WjBinding { static _wjContextProp: string; static _parPropAttr: string; static _controlPropAttr: string; static _initPropAttr: string; static _initEventAttr: string; _metaData: MetaDataBase; init: any; update: any; ensureMetaData(): void; _initialize(): void; _getControlConstructor(): any; _getMetaDataId(): any; _createControl(element: any): any; _createWijmoContext(): WjContext; _isChild(): boolean; _isParentInitializer(): boolean; _isParentReferencer(): boolean; private _initImpl; private _updateImpl; } export declare class WjContext { element: any; valueAccessor: any; allBindings: any; viewModel: any; bindingContext: any; control: any; wjBinding: WjBinding; parentWjContext: WjContext; private _parentPropDesc; private _isInitialized; private static _debugId; constructor(wjBinding: WjBinding); init(element: any, valueAccessor: () => any, allBindings: any, viewModel: any, bindingContext: any): any; update(element: any, valueAccessor: () => any, allBindings: any, viewModel: any, bindingContext: any): void; _createControl(): any; _initControl(): void; _childrenInitialized(): void; private _addEventHandler; private static _isUpdatingSource; private static _pendingSourceUpdates; _updateSource(): void; private _isUpdatingControl; private _isSourceDirty; private _oldSourceValues; private _updateControl; private _castValueToType; _safeUpdateSrcAttr(attrName: string, value: any): void; _safeNotifySrcAttr(attrName: string): void; private _isChild; private _isParentInitializer; private _isParentReferencer; private _getParentProp; private _getParentReferenceProperty; private _useParentObj; private _isParentArray; private _parentInCtor; } export declare class WjTagsPreprocessor { private static _getSpecialProps; private static _specialProps; private static _dataBindAttr; private static _wjTagPrefix; private _foreignProc; register(): void; preprocessNode(node: any): any; private _delegate; private _isWjTag; private _isWjProp; }