@mescius/wijmo.knockout.base 5.20232.939
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COMMERCIAL-LICENSE.html +485 -0
- package/README.md +363 -0
- package/es2015-commonjs.js +14 -0
- package/es2015-esm.js +14 -0
- package/es5-esm.js +14 -0
- package/index.d.ts +303 -0
- package/index.js +14 -0
- package/package.json +71 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
*
|
|
3
|
+
* Wijmo Library 5.20232.939
|
|
4
|
+
* https://developer.mescius.com/wijmo
|
|
5
|
+
*
|
|
6
|
+
* Copyright(c) MESCIUS inc. All rights reserved.
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the End-User License Agreement For MESCIUS Wijmo Software.
|
|
9
|
+
* us.sales@mescius.com
|
|
10
|
+
* https://developer.mescius.com/wijmo/licensing
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* {@module wijmo.knockout.base}
|
|
15
|
+
* Contains KnockoutJS bindings for the Wijmo controls.
|
|
16
|
+
*
|
|
17
|
+
* The bindings allow you to add Wijmo controls to
|
|
18
|
+
* <a href="http://knockoutjs.com/" target="_blank">KnockoutJS</a>
|
|
19
|
+
* applications using simple markup in HTML pages.
|
|
20
|
+
*
|
|
21
|
+
* To add a Wijmo control to a certain place in a page's markup, add the <b><div></b>
|
|
22
|
+
* element and define a binding for the control in the <b>data-bind</b> attribute.
|
|
23
|
+
* The binding name corresponds to the control name with a wj prefix. For example, the {@link wjInputNumber}
|
|
24
|
+
* binding represents the Wijmo {@link InputNumber} control. The binding value is an object literal containing
|
|
25
|
+
* properties corresponding to the control's read-write property and event names, with their values defining
|
|
26
|
+
* the corresponding control property values and event handlers.
|
|
27
|
+
*
|
|
28
|
+
* The following markup creates a Wijmo <b>InputNumber</b> control with the <b>value</b> property bound to the
|
|
29
|
+
* view model's <b>theValue</b> property, the <b>step</b> property set to 1 and the <b>inputType</b> property set to 'text':
|
|
30
|
+
*
|
|
31
|
+
* <pre><div data-bind="wjInputNumber: { value: theValue, step: 1, inputType: 'text' }"></div></pre>
|
|
32
|
+
*
|
|
33
|
+
* <h3>Custom elements</h3>
|
|
34
|
+
* As an alternative to the standard Knockout binding syntax, the Wijmo for Knockout provides a possibility to declare controls
|
|
35
|
+
* in the page markup as custom elements, where the tag name corresponds to the control binding name and the attribute names
|
|
36
|
+
* correspond to the control property names. The element and parameter names must be formatted as lower-case with dashes instead
|
|
37
|
+
* of camel-case. The control in the example above can be defined as follows using the custom element syntax:
|
|
38
|
+
*
|
|
39
|
+
* <pre><wj-input-number value="theValue" step="1" input-type="'text'"></wj-input-number></pre>
|
|
40
|
+
*
|
|
41
|
+
* Note that attribute values should be defined using exactly the same JavaScript expressions syntax as you use in
|
|
42
|
+
* data-bind definitions. The Wijmo for Knockout preprocessor converts such elements to the conventional data-bind form,
|
|
43
|
+
* see the <b>Custom elements preprocessor</b> topic for more details.
|
|
44
|
+
*
|
|
45
|
+
* <h3>Binding to control properties</h3>
|
|
46
|
+
* Wijmo binding for KnockoutJS supports binding to any read-write properties on the control. You can assign any
|
|
47
|
+
* valid KnockoutJS expressions (e.g. constants, view model observable properties, or complex expressions) to the
|
|
48
|
+
* property.
|
|
49
|
+
*
|
|
50
|
+
* Note that binding expression should resolve (after calling <b>ko.unwrap(expression)</b> on it) to a pure
|
|
51
|
+
* JavaScript value understandable by the corresponding Wijmo JavaScript control. This in particular means
|
|
52
|
+
* that you can’t bind the <b>itemsSource</b> property of Wijmo controls to a Knockout <b>observableArray</b>,
|
|
53
|
+
* or to array whose items’ properties are Knockout <b>observable</b>(s).
|
|
54
|
+
*
|
|
55
|
+
* Most of the properties provide one-way binding, which means that changes in the bound observable view model
|
|
56
|
+
* property cause changes in the control property that the observable is bound to, but not vice versa.
|
|
57
|
+
* But some properties support two-way binding, which means that changes made in the control property are
|
|
58
|
+
* propagated back to an observable bound to the control property as well. Two-way bindings are used for properties
|
|
59
|
+
* that can be changed by the control itself, by user interaction with the control,
|
|
60
|
+
* or by other occurences. For example, the InputNumber control provides two-way binding for the
|
|
61
|
+
* <b>value</b> and <b>text</b> properties, which are changed by the control while a user is typing a new value.
|
|
62
|
+
* The rest of the InputNumber properties operate in the one-way binding mode.
|
|
63
|
+
*
|
|
64
|
+
* <h3>Binding to control events</h3>
|
|
65
|
+
* To attach a handler to a control event, specify the event name as a property of the object literal defining
|
|
66
|
+
* the control binding, and the function to call on this event as a value of this property.
|
|
67
|
+
* Wijmo bindings follow the same rules for defining an event handler as used for the intrinsic KnockoutJS bindings
|
|
68
|
+
* like <b>click</b> and <b>event</b>. The event handler receives the following set of parameters, in the specified order:
|
|
69
|
+
* <ul>
|
|
70
|
+
* <li><b>data:</b> The current model value, the same as for native KnockoutJS bindings like <b>click</b> and <b>event</b>. </li>
|
|
71
|
+
* <li><b>sender:</b> The sender of the event. </li>
|
|
72
|
+
* <li><b>args:</b> The event arguments. </li>
|
|
73
|
+
* </ul>
|
|
74
|
+
*
|
|
75
|
+
* The following example creates an <b>InputNumber</b> control and adds an event handler for the <b>valueChanged</b>
|
|
76
|
+
* event showing a dialog with a new control value.
|
|
77
|
+
*
|
|
78
|
+
* <pre><!-- HTML -->
|
|
79
|
+
* <div data-bind="wjInputNumber: { value: theValue, step: 1, valueChanged: valueChangedEH }"></div>
|
|
80
|
+
*
|
|
81
|
+
* //View Model
|
|
82
|
+
* this.valueChangedEH = function (data, sender, args) {
|
|
83
|
+
* alert('The new value is: ' + sender.value);
|
|
84
|
+
* }</pre>
|
|
85
|
+
*
|
|
86
|
+
* The same control defined using the custom element syntax:
|
|
87
|
+
*
|
|
88
|
+
* <pre><wj-input-number value="theValue" step="1" value-changed="valueChangedEH"></wj-input-number></pre>
|
|
89
|
+
*
|
|
90
|
+
* <h3>Binding to undefined observables</h3>
|
|
91
|
+
* View model observable properties assigned to an <i>undefined</i> value get special treatment by Wijmo
|
|
92
|
+
* bindings during the initialization phase. For example, if you create an observable as ko.observable(undefined)
|
|
93
|
+
* or ko.observable() and bind it to a control property, Wijmo does not assign a value to the control. Instead,
|
|
94
|
+
* for properties supporting two-way bindings, this is the way to initialize the observable with the control's
|
|
95
|
+
* default value, because after initialization the control binding updates bound observables with the control
|
|
96
|
+
* values of such properties. Note that an observable with a <i>null</i> value, e.g. ko.observable(null), gets
|
|
97
|
+
* the usual treatment and assigns null to the control property that it is bound to. After the primary
|
|
98
|
+
* initialization has finished, observables with undefined values go back to getting the usual treatment from
|
|
99
|
+
* Wijmo, and assign the control property with undefined.
|
|
100
|
+
*
|
|
101
|
+
* In the example below, the <b>value</b> property of the <b>InputNumber</b> control has its default value of 0
|
|
102
|
+
* after initialization, and this same value is assigned to the view model <b>theValue</b> property:
|
|
103
|
+
* <pre><!-- HTML -->
|
|
104
|
+
* <div data-bind="wjInputNumber: { value: theValue }"></div>
|
|
105
|
+
*
|
|
106
|
+
* //View Model
|
|
107
|
+
* this.theValue = ko.observable();</pre>
|
|
108
|
+
*
|
|
109
|
+
* <h3>Defining complex and array properties</h3>
|
|
110
|
+
* Some Wijmo controls have properties that contain an array or a complex object. For example, the
|
|
111
|
+
* {@link FlexChart} control exposes <b>axisX</b> and <b>axisY</b> properties that represent an {@link Axis} object;
|
|
112
|
+
* and the <b>series</b> property is an array of {@link Series} objects. Wijmo provides special
|
|
113
|
+
* bindings for such types that we add to child elements of the control element. If the control exposes
|
|
114
|
+
* multiple properties of the same complex type, then the <b>wjProperty</b> property of the complex
|
|
115
|
+
* type binding specifies which control property it defines.
|
|
116
|
+
*
|
|
117
|
+
* The following example shows the markup used to create a <b>FlexChart</b> with <b>axisX</b> and <b>axisY</b>
|
|
118
|
+
* properties and two series objects defined:
|
|
119
|
+
*
|
|
120
|
+
* <pre><div data-bind="wjFlexChart: { itemsSource: data, bindingX: 'country' }">
|
|
121
|
+
* <div data-bind="wjFlexChartAxis: { wjProperty: 'axisX', title: chartProps.titleX }"></div>
|
|
122
|
+
* <div data-bind="wjFlexChartAxis: { wjProperty: 'axisY', title: chartProps.titleY }"></div>
|
|
123
|
+
* <div data-bind="wjFlexChartSeries: { name: 'Sales', binding: 'sales' }"></div>
|
|
124
|
+
* <div data-bind="wjFlexChartSeries: { name: 'Downloads', binding: 'downloads' }"></div>
|
|
125
|
+
* </div></pre>
|
|
126
|
+
*
|
|
127
|
+
* The same control defined using the custom element syntax:
|
|
128
|
+
*
|
|
129
|
+
* <pre><wj-flex-chart items-source="data" binding-x="'country'">
|
|
130
|
+
* <wj-flex-chart-axis wj-property="'axisX'" title="chartProps.titleX"></wj-flex-chart-axis>
|
|
131
|
+
* <wj-flex-chart-axis wj-property="'axisY'" title="chartProps.titleY"></wj-flex-chart-axis>
|
|
132
|
+
* <wj-flex-chart-series name="'Sales'" binding"'sales'"></wj-flex-chart-series>
|
|
133
|
+
* <wj-flex-chart-series name="'Downloads'" binding"'downloads'"></wj-flex-chart-series>
|
|
134
|
+
* </wj-flex-chart></pre>
|
|
135
|
+
*
|
|
136
|
+
* <h3>The <b>control</b> property </h3>
|
|
137
|
+
* Each Wijmo control binding exposes a <b>control</b> property that references the Wijmo control instance created
|
|
138
|
+
* by the binding. This allows you to reference the control in view model code or in other bindings.
|
|
139
|
+
*
|
|
140
|
+
* For example, the following markup creates a {@link FlexGrid} control whose reference is stored in the <b>flex</b>
|
|
141
|
+
* observable property of a view model and is used in the button click event handler to move to the next grid record:
|
|
142
|
+
*
|
|
143
|
+
* <pre><!-- HTML -->
|
|
144
|
+
* <div data-bind="'wjFlexGrid': { itemsSource: data, control: flex }"></div>
|
|
145
|
+
* <button data-bind="click: moveToNext">Next</button>
|
|
146
|
+
*
|
|
147
|
+
* //View Model
|
|
148
|
+
* this.flex = ko.observable();
|
|
149
|
+
* this.moveToNext = function () {
|
|
150
|
+
* this.flex().collectionView.moveCurrentToNext();
|
|
151
|
+
* }</pre>
|
|
152
|
+
*
|
|
153
|
+
* <h3>The <b>initialized</b> event</h3>
|
|
154
|
+
* Each Wijmo control binding exposes an <b>initialized</b> event and a Boolean <b>isInitialized</b>
|
|
155
|
+
* property. The event occurs right after the binding creates the control and fully initializes it
|
|
156
|
+
* with the values specified in the binding attributes. For bindings containing child bindings, for
|
|
157
|
+
* example, a <b>wjFlexGrid</b> with child <b>wjFlexGridColumn</b> bindings, this also means that
|
|
158
|
+
* child bindings have fully initialized and have been applied to the control represented by the
|
|
159
|
+
* parent binding. The isInitialized property is set to true right before triggering the initialized
|
|
160
|
+
* event. You can bind a view model observable property to the binding’s <b>isInitialized</b> property
|
|
161
|
+
* to access its value.
|
|
162
|
+
*
|
|
163
|
+
* The following example adjusts FlexGridColumn formatting after the control fully initializes with its
|
|
164
|
+
* bindings, which guarantees that these formats are not overwritten with formats defined in the bindings:
|
|
165
|
+
*
|
|
166
|
+
* <pre><!-- HTML -->
|
|
167
|
+
* <div data-bind="'wjFlexGrid': { itemsSource: dataArray, initialized: flexInitialized }">
|
|
168
|
+
* <div data-bind="wjFlexGridColumn: { binding: 'sales', format: 'n2' }"></div>
|
|
169
|
+
* <div data-bind="wjFlexGridColumn: { binding: 'downloads', format: 'n2' }"></div>
|
|
170
|
+
* </div>
|
|
171
|
+
*
|
|
172
|
+
* //View Model
|
|
173
|
+
* this.flexInitialized = function (data, sender, args) {
|
|
174
|
+
* var columns = sender.columns;
|
|
175
|
+
* for (var i = 0; i < columns.length; i++) {
|
|
176
|
+
* if (columns[i].dataType = wijmo.DataType.Number) {
|
|
177
|
+
* columns[i].format = 'n0’;
|
|
178
|
+
* }
|
|
179
|
+
* }
|
|
180
|
+
* }</pre>
|
|
181
|
+
*
|
|
182
|
+
* <h3 id="custom_elem_preproc">Custom elements preprocessor</h3>
|
|
183
|
+
* The Wijmo Knockout preprocessor uses the standard Knockout <a target="_blank"
|
|
184
|
+
* href="http://knockoutjs.com/documentation/binding-preprocessing.html">ko.bindingProvider.instance.preprocessNode</a>
|
|
185
|
+
* API. This may cause problems in cases where other custom preprocessors are used on the same page, because Knockout
|
|
186
|
+
* offers a single instance property for attaching a preprocessor function, and the next registering preprocessor
|
|
187
|
+
* removes the registration of the previous one.
|
|
188
|
+
*
|
|
189
|
+
* To honor another attached preprocessor, the Wijmo Knockout preprocessor stores the currently registered preprocessor
|
|
190
|
+
* during initialization and delegates the work to it in cases where another processing node is not recognized
|
|
191
|
+
* as a Wijmo control element, thus organizing a preprocessor stack. But if you register another preprocessor
|
|
192
|
+
* after the Wijmo for Knockout preprocessor (that is, after the <script> reference to the <b>wijmo.knockout.js</b>
|
|
193
|
+
* module is executed) then you need to ensure that the other preprocessor behaves in a similar way;
|
|
194
|
+
* otherwise, the Wijmo Knockout preprocessor is disabled.
|
|
195
|
+
*
|
|
196
|
+
* If you prefer to disable the Wijmo Knockout preprocessor, set the <b>wijmo.disableKnockoutTags</b> property
|
|
197
|
+
* to false before the <b>wijmo.knockout.js</b> module reference and after the references to the core Wijmo
|
|
198
|
+
* modules, for example:
|
|
199
|
+
*
|
|
200
|
+
* <pre><script src="scripts/wijmo.js"></script>
|
|
201
|
+
* <script src="scripts/wijmo.input.js"></script>
|
|
202
|
+
* <script>
|
|
203
|
+
* wijmo.disableKnockoutTags = true;
|
|
204
|
+
* </script>
|
|
205
|
+
* <script src="scripts/wijmo.knockout.js"></script></pre>
|
|
206
|
+
*
|
|
207
|
+
* Note that in this case you can use only the conventional data-bind syntax for adding Wijmo controls to the page
|
|
208
|
+
* markup; the Wijmo custom elements are not recognized.
|
|
209
|
+
*/
|
|
210
|
+
/**
|
|
211
|
+
*
|
|
212
|
+
*/
|
|
213
|
+
export declare var ___keepComment: any;
|
|
214
|
+
import { ControlMetaFactory, PropertyType, EventDescBase, ComplexPropDescBase, PropDescBase, MetaDataBase } from '@grapecity/wijmo.meta';
|
|
215
|
+
export declare class MetaFactory extends ControlMetaFactory {
|
|
216
|
+
static CreateProp(propertyName: string, propertyType: PropertyType, changeEvent?: string, enumType?: any, isNativeControlProperty?: boolean, priority?: number): PropDesc;
|
|
217
|
+
static CreateEvent(eventName: string, isPropChanged?: boolean): EventDesc;
|
|
218
|
+
static CreateComplexProp(propertyName: string, isArray: boolean, ownsObject?: boolean): ComplexPropDesc;
|
|
219
|
+
static findProp(propName: string, props: PropDesc[]): PropDesc;
|
|
220
|
+
static findEvent(eventName: string, events: EventDesc[]): EventDesc;
|
|
221
|
+
static findComplexProp(propName: string, props: ComplexPropDesc[]): ComplexPropDesc;
|
|
222
|
+
}
|
|
223
|
+
export interface IUpdateControlHandler {
|
|
224
|
+
(link: any, propDesc: PropDesc, control: any, unconvertedValue: any, convertedValue: any): boolean;
|
|
225
|
+
}
|
|
226
|
+
export declare class PropDesc extends PropDescBase {
|
|
227
|
+
updateControl: IUpdateControlHandler;
|
|
228
|
+
}
|
|
229
|
+
export declare class EventDesc extends EventDescBase {
|
|
230
|
+
}
|
|
231
|
+
export declare class ComplexPropDesc extends ComplexPropDescBase {
|
|
232
|
+
}
|
|
233
|
+
export declare class WjBinding {
|
|
234
|
+
static _wjContextProp: string;
|
|
235
|
+
static _parPropAttr: string;
|
|
236
|
+
static _controlPropAttr: string;
|
|
237
|
+
static _initPropAttr: string;
|
|
238
|
+
static _initEventAttr: string;
|
|
239
|
+
_metaData: MetaDataBase;
|
|
240
|
+
init: any;
|
|
241
|
+
update: any;
|
|
242
|
+
ensureMetaData(): void;
|
|
243
|
+
_initialize(): void;
|
|
244
|
+
_getControlConstructor(): any;
|
|
245
|
+
_getMetaDataId(): any;
|
|
246
|
+
_createControl(element: any): any;
|
|
247
|
+
_createWijmoContext(): WjContext;
|
|
248
|
+
_isChild(): boolean;
|
|
249
|
+
_isParentInitializer(): boolean;
|
|
250
|
+
_isParentReferencer(): boolean;
|
|
251
|
+
private _initImpl;
|
|
252
|
+
private _updateImpl;
|
|
253
|
+
}
|
|
254
|
+
export declare class WjContext {
|
|
255
|
+
element: any;
|
|
256
|
+
valueAccessor: any;
|
|
257
|
+
allBindings: any;
|
|
258
|
+
viewModel: any;
|
|
259
|
+
bindingContext: any;
|
|
260
|
+
control: any;
|
|
261
|
+
wjBinding: WjBinding;
|
|
262
|
+
parentWjContext: WjContext;
|
|
263
|
+
private _parentPropDesc;
|
|
264
|
+
private _isInitialized;
|
|
265
|
+
private static _debugId;
|
|
266
|
+
constructor(wjBinding: WjBinding);
|
|
267
|
+
init(element: any, valueAccessor: () => any, allBindings: any, viewModel: any, bindingContext: any): any;
|
|
268
|
+
update(element: any, valueAccessor: () => any, allBindings: any, viewModel: any, bindingContext: any): void;
|
|
269
|
+
_createControl(): any;
|
|
270
|
+
_initControl(): void;
|
|
271
|
+
_childrenInitialized(): void;
|
|
272
|
+
private _addEventHandler;
|
|
273
|
+
private static _isUpdatingSource;
|
|
274
|
+
private static _pendingSourceUpdates;
|
|
275
|
+
_updateSource(): void;
|
|
276
|
+
private _isUpdatingControl;
|
|
277
|
+
private _isSourceDirty;
|
|
278
|
+
private _oldSourceValues;
|
|
279
|
+
private _updateControl;
|
|
280
|
+
private _castValueToType;
|
|
281
|
+
_safeUpdateSrcAttr(attrName: string, value: any): void;
|
|
282
|
+
_safeNotifySrcAttr(attrName: string): void;
|
|
283
|
+
private _isChild;
|
|
284
|
+
private _isParentInitializer;
|
|
285
|
+
private _isParentReferencer;
|
|
286
|
+
private _getParentProp;
|
|
287
|
+
private _getParentReferenceProperty;
|
|
288
|
+
private _useParentObj;
|
|
289
|
+
private _isParentArray;
|
|
290
|
+
private _parentInCtor;
|
|
291
|
+
}
|
|
292
|
+
export declare class WjTagsPreprocessor {
|
|
293
|
+
private static _getSpecialProps;
|
|
294
|
+
private static _specialProps;
|
|
295
|
+
private static _dataBindAttr;
|
|
296
|
+
private static _wjTagPrefix;
|
|
297
|
+
private _foreignProc;
|
|
298
|
+
register(): void;
|
|
299
|
+
preprocessNode(node: any): any;
|
|
300
|
+
private _delegate;
|
|
301
|
+
private _isWjTag;
|
|
302
|
+
private _isWjProp;
|
|
303
|
+
}
|
package/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
*
|
|
3
|
+
* Wijmo Library 5.20232.939
|
|
4
|
+
* https://developer.mescius.com/wijmo
|
|
5
|
+
*
|
|
6
|
+
* Copyright(c) MESCIUS inc. All rights reserved.
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the End-User License Agreement For MESCIUS Wijmo Software.
|
|
9
|
+
* us.sales@mescius.com
|
|
10
|
+
* https://developer.mescius.com/wijmo/licensing
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(t,e){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};return function(t,e){extendStatics(t,e);function __(){this.constructor=t}t.prototype=null===e?Object.create(e):(__.prototype=e.prototype,new __)}}(),__importStar=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);e.default=t;return e};Object.defineProperty(exports,"__esModule",{value:!0});var wijmo_meta_1=require("@mescius/wijmo.meta"),mKo=__importStar(require("knockout")),MetaFactory=function(t){__extends(MetaFactory,t);function MetaFactory(){return null!==t&&t.apply(this,arguments)||this}MetaFactory.CreateProp=function(t,e,r,n,o,i){return new PropDesc(t,e,r,n,o,i)};MetaFactory.CreateEvent=function(t,e){return new EventDesc(t,e)};MetaFactory.CreateComplexProp=function(t,e,r){return new ComplexPropDesc(t,e,r)};MetaFactory.findProp=function(t,e){return wijmo_meta_1.ControlMetaFactory.findProp(t,e)};MetaFactory.findEvent=function(t,e){return wijmo_meta_1.ControlMetaFactory.findEvent(t,e)};MetaFactory.findComplexProp=function(t,e){return wijmo_meta_1.ControlMetaFactory.findComplexProp(t,e)};return MetaFactory}(wijmo_meta_1.ControlMetaFactory);exports.MetaFactory=MetaFactory;var PropDesc=function(t){__extends(PropDesc,t);function PropDesc(){return null!==t&&t.apply(this,arguments)||this}return PropDesc}(wijmo_meta_1.PropDescBase);exports.PropDesc=PropDesc;var EventDesc=function(t){__extends(EventDesc,t);function EventDesc(){return null!==t&&t.apply(this,arguments)||this}return EventDesc}(wijmo_meta_1.EventDescBase);exports.EventDesc=EventDesc;var ComplexPropDesc=function(t){__extends(ComplexPropDesc,t);function ComplexPropDesc(){return null!==t&&t.apply(this,arguments)||this}return ComplexPropDesc}(wijmo_meta_1.ComplexPropDescBase);exports.ComplexPropDesc=ComplexPropDesc;var wjKo=mKo,WjBinding=function(){function WjBinding(){this.init=function(t,e,r,n,o){this.ensureMetaData();return this._initImpl(t,e,r,n,o)}.bind(this);this.update=function(t,e,r,n,o){this._updateImpl(t,e,r,n,o)}.bind(this);this._updateImpl=function(t,e,r,n,o){t[WjBinding._wjContextProp].update(t,e,r,n,o)}}WjBinding.prototype.ensureMetaData=function(){if(!this._metaData){this._metaData=MetaFactory.getMetaData(this._getMetaDataId());this._initialize();this._metaData.prepare()}};WjBinding.prototype._initialize=function(){};WjBinding.prototype._getControlConstructor=function(){return null};WjBinding.prototype._getMetaDataId=function(){return this._getControlConstructor()};WjBinding.prototype._createControl=function(t){return new(this._getControlConstructor())(t)};WjBinding.prototype._createWijmoContext=function(){return new WjContext(this)};WjBinding.prototype._isChild=function(){return this._isParentInitializer()||this._isParentReferencer()};WjBinding.prototype._isParentInitializer=function(){return null!=this._metaData.parentProperty};WjBinding.prototype._isParentReferencer=function(){return null!=this._metaData.parentReferenceProperty};WjBinding.prototype._initImpl=function(t,e,r,n,o){var i=this._createWijmoContext();t[WjBinding._wjContextProp]=i;i.element=t;this._isChild()&&(i.parentWjContext=t.parentElement[WjBinding._wjContextProp]);i.valueAccessor=e;i.allBindings=r;i.viewModel=n;i.bindingContext=o;return i.init(t,e,r,n,o)};WjBinding._wjContextProp="__wjKoContext";WjBinding._parPropAttr="wjProperty";WjBinding._controlPropAttr="control";WjBinding._initPropAttr="isInitialized";WjBinding._initEventAttr="initialized";return WjBinding}();exports.WjBinding=WjBinding;var WjContext=function(){function WjContext(t){this._isInitialized=!1;this._isUpdatingControl=!1;this._isSourceDirty=!1;this._oldSourceValues={};this.wjBinding=t}WjContext.prototype.init=function(t,e,r,n,o){var i=e(),a=(this.wjBinding._metaData.props,this.wjBinding._metaData.events);if(this._isChild()){var s=i[WjBinding._parPropAttr],p=this.wjBinding._metaData,c=s&&wjKo.unwrap(s)||p.parentProperty;this._parentPropDesc=MetaFactory.findComplexProp(c,this.parentWjContext.wjBinding._metaData.complexProps)||new ComplexPropDesc(c,p.isParentPropertyArray,p.ownsObject)}this._initControl();this._safeUpdateSrcAttr(WjBinding._controlPropAttr,this.control);wjKo.applyBindingsToDescendants(o,t);this._childrenInitialized();for(var u in a)this._addEventHandler(a[u]);this._updateControl(e);this._safeNotifySrcAttr(WjBinding._controlPropAttr);this._updateSource();this._isInitialized=!0;this._safeUpdateSrcAttr(WjBinding._initPropAttr,!0);var _=i[WjBinding._initEventAttr];_&&wjKo.unwrap(_)(this.bindingContext.$data,this.control,void 0);return{controlsDescendantBindings:!0}};WjContext.prototype.update=function(t,e,r,n,o){this.valueAccessor=e;this._updateControl(e)};WjContext.prototype._createControl=function(){return this.wjBinding._createControl(this._parentInCtor()?this.parentWjContext.control:this.element)};WjContext.prototype._initControl=function(){if(this._isChild()){this.element.style.display="none";var t=this._getParentProp(),e=this.parentWjContext.control;if(this._useParentObj())this.control=e[t];else{var r=this.control=this._createControl();this._isParentInitializer()&&(this._isParentArray()?e[t].push(r):e[t]=r);this._isParentReferencer()&&!this._parentInCtor()&&(r[this._getParentReferenceProperty()]=e)}}else this.control=this._createControl()};WjContext.prototype._childrenInitialized=function(){};WjContext.prototype._addEventHandler=function(t){var e=this;this.control[t.eventName].addHandler((function(r,n){e._isInitialized&&e._updateSource();var o=e.valueAccessor()[t.eventName];o&&wjKo.unwrap(o)(e.bindingContext.$data,r,n)}),this)};WjContext.prototype._updateSource=function(){WjContext._isUpdatingSource=!0;try{var t=this.wjBinding._metaData.props;for(var e in t){var r=t[e],n=r.propertyName;r.shouldUpdateSource&&r.isNativeControlProperty&&this._safeUpdateSrcAttr(n,this.control[n])}}finally{WjContext._isUpdatingSource=!1;for(;WjContext._pendingSourceUpdates.length>0;){WjContext._pendingSourceUpdates.shift()._updateControl()}}};WjContext.prototype._updateControl=function(t){void 0===t&&(t=this.valueAccessor);var e=t(),r=this.wjBinding._metaData.props;if(WjContext._isUpdatingSource){WjContext._pendingSourceUpdates.indexOf(this)<0&&WjContext._pendingSourceUpdates.push(this);for(var n in r)wjKo.unwrap(e[r[n].propertyName])}else try{var o=[],i=[];for(var n in r){var a=e[c=(s=r[n]).propertyName];if(void 0!==a){if((p=wjKo.unwrap(a))!==this._oldSourceValues[c]||s.changeEvent&&p!==this.control[c]){this._oldSourceValues[c]=p;o.push(p);i.push(s)}}}for(var n in o){var s=i[n],p=wjKo.unwrap(e[s.propertyName]),c=s.propertyName;if(void 0!==p||this._isInitialized){var u=this._castValueToType(p,s);s.updateControl&&s.updateControl(this,s,this.control,p,u)||!s.isNativeControlProperty||this.control[c]!=u&&(this.control[c]=u)}}}finally{}};WjContext.prototype._castValueToType=function(t,e){return e.castValueToType(t)};WjContext.prototype._safeUpdateSrcAttr=function(t,e){var r=this.valueAccessor()[t];if(wjKo.isWritableObservable(r)){e!=wjKo.unwrap(r)&&r(e)}};WjContext.prototype._safeNotifySrcAttr=function(t){var e=this.valueAccessor()[t];wjKo.isWritableObservable(e)&&e.valueHasMutated&&e.valueHasMutated()};WjContext.prototype._isChild=function(){return this.wjBinding._isChild()};WjContext.prototype._isParentInitializer=function(){return this.wjBinding._isParentInitializer()};WjContext.prototype._isParentReferencer=function(){return this.wjBinding._isParentReferencer()};WjContext.prototype._getParentProp=function(){return this._isParentInitializer()?this._parentPropDesc.propertyName:void 0};WjContext.prototype._getParentReferenceProperty=function(){return this.wjBinding._metaData.parentReferenceProperty};WjContext.prototype._useParentObj=function(){return!this._isParentReferencer()&&this._isParentInitializer()&&!this._parentPropDesc.isArray&&!this._parentPropDesc.ownsObject};WjContext.prototype._isParentArray=function(){return this._parentPropDesc.isArray};WjContext.prototype._parentInCtor=function(){return this._isParentReferencer()&&""==this._getParentReferenceProperty()};WjContext._debugId=0;WjContext._isUpdatingSource=!1;WjContext._pendingSourceUpdates=[];return WjContext}();exports.WjContext=WjContext;var WjTagsPreprocessor=function(){function WjTagsPreprocessor(){}WjTagsPreprocessor._getSpecialProps=function(){var t={},e=WjBinding;t[e._controlPropAttr]=!0;t[e._parPropAttr]=!0;return t};WjTagsPreprocessor.prototype.register=function(){this._foreignProc=wjKo.bindingProvider.instance.preprocessNode;wjKo.bindingProvider.instance.preprocessNode=this.preprocessNode.bind(this)};WjTagsPreprocessor.prototype.preprocessNode=function(t){var e=WjTagsPreprocessor._dataBindAttr;if(1!=t.nodeType||!this._isWjTag(t.tagName))return this._delegate(t);var r=MetaFactory.toCamelCase(t.tagName),n=wjKo.bindingHandlers[r];if(!n)return this._delegate(t);n.ensureMetaData();for(var o,i="",a=t.attributes,s=document.createElement("div"),p=0;p<a.length;p++){var c=a[p];if(c.name.toLowerCase()!=e){var u=MetaFactory.toCamelCase(c.name);if(this._isWjProp(u,n._metaData)){i&&(i+=",");i+=u+":"+c.value}else s.setAttribute(c.name,c.value)}else o=c}i=r+":{"+i+"}";o&&o.value&&o.value.trim()&&(i+=","+o.value);s.setAttribute(e,i);for(;t.firstChild;)s.appendChild(t.firstChild);t.parentNode.replaceChild(s,t);return[s]};WjTagsPreprocessor.prototype._delegate=function(t){return this._foreignProc?this._foreignProc(t):void 0};WjTagsPreprocessor.prototype._isWjTag=function(t){var e=WjTagsPreprocessor._wjTagPrefix;return t&&t.length>e.length&&t.substr(0,e.length).toLowerCase()===e};WjTagsPreprocessor.prototype._isWjProp=function(t,e){return WjTagsPreprocessor._specialProps[t]||MetaFactory.findProp(t,e.props)||MetaFactory.findEvent(t,e.events)};WjTagsPreprocessor._specialProps=WjTagsPreprocessor._getSpecialProps();WjTagsPreprocessor._dataBindAttr="data-bind";WjTagsPreprocessor._wjTagPrefix="wj-";return WjTagsPreprocessor}();exports.WjTagsPreprocessor=WjTagsPreprocessor;window.wijmo.disableKnockoutTags||(new WjTagsPreprocessor).register();
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mescius/wijmo.knockout.base",
|
|
3
|
+
"version": "5.20232.939",
|
|
4
|
+
"description": "UI library for pure JS, Angular, React, Vue and more...",
|
|
5
|
+
"author": "MESCIUS inc",
|
|
6
|
+
"license": "Commercial",
|
|
7
|
+
"main": "./index.js",
|
|
8
|
+
"types": "./index.d.ts",
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@mescius/wijmo": "5.20232.939",
|
|
11
|
+
"@mescius/wijmo.meta": "5.20232.939",
|
|
12
|
+
"@mescius/wijmo.input": "5.20232.939",
|
|
13
|
+
"@mescius/wijmo.chart": "5.20232.939",
|
|
14
|
+
"@mescius/wijmo.chart.analytics": "5.20232.939",
|
|
15
|
+
"@mescius/wijmo.chart.animation": "5.20232.939",
|
|
16
|
+
"@mescius/wijmo.chart.annotation": "5.20232.939",
|
|
17
|
+
"@mescius/wijmo.chart.finance": "5.20232.939",
|
|
18
|
+
"@mescius/wijmo.chart.finance.analytics": "5.20232.939",
|
|
19
|
+
"@mescius/wijmo.chart.hierarchical": "5.20232.939",
|
|
20
|
+
"@mescius/wijmo.chart.interaction": "5.20232.939",
|
|
21
|
+
"@mescius/wijmo.chart.radar": "5.20232.939",
|
|
22
|
+
"@mescius/wijmo.chart.render": "5.20232.939",
|
|
23
|
+
"@mescius/wijmo.gauge": "5.20232.939",
|
|
24
|
+
"@mescius/wijmo.grid": "5.20232.939",
|
|
25
|
+
"@mescius/wijmo.grid.detail": "5.20232.939",
|
|
26
|
+
"@mescius/wijmo.grid.filter": "5.20232.939",
|
|
27
|
+
"@mescius/wijmo.grid.grouppanel": "5.20232.939",
|
|
28
|
+
"@mescius/wijmo.grid.multirow": "5.20232.939",
|
|
29
|
+
"@mescius/wijmo.grid.pdf": "5.20232.939",
|
|
30
|
+
"@mescius/wijmo.grid.sheet": "5.20232.939",
|
|
31
|
+
"@mescius/wijmo.grid.xlsx": "5.20232.939",
|
|
32
|
+
"@mescius/wijmo.nav": "5.20232.939",
|
|
33
|
+
"@mescius/wijmo.odata": "5.20232.939",
|
|
34
|
+
"@mescius/wijmo.olap": "5.20232.939",
|
|
35
|
+
"@mescius/wijmo.pdf": "5.20232.939",
|
|
36
|
+
"@mescius/wijmo.viewer": "5.20232.939",
|
|
37
|
+
"@mescius/wijmo.xlsx": "5.20232.939"
|
|
38
|
+
},
|
|
39
|
+
"homepage": "https://developer.mescius.com/wijmo",
|
|
40
|
+
"bugs": {
|
|
41
|
+
"url": "https://developer.mescius.com/forums/wijmo"
|
|
42
|
+
},
|
|
43
|
+
"keywords": [
|
|
44
|
+
"control",
|
|
45
|
+
"component",
|
|
46
|
+
"ui",
|
|
47
|
+
"control library",
|
|
48
|
+
"component library",
|
|
49
|
+
"ui library",
|
|
50
|
+
"control-library",
|
|
51
|
+
"component-library",
|
|
52
|
+
"ui-library",
|
|
53
|
+
"grid",
|
|
54
|
+
"data grid",
|
|
55
|
+
"data-grid",
|
|
56
|
+
"datagrid",
|
|
57
|
+
"angular grid",
|
|
58
|
+
"react grid",
|
|
59
|
+
"vue grid",
|
|
60
|
+
"angular-grid",
|
|
61
|
+
"react-grid",
|
|
62
|
+
"vue-grid"
|
|
63
|
+
],
|
|
64
|
+
"module": "./es5-esm.js",
|
|
65
|
+
"esm5": "./es5-esm.js",
|
|
66
|
+
"wj-esm5": "./es5-esm.js",
|
|
67
|
+
"es2015Cjs": "./es2015-commonjs.js",
|
|
68
|
+
"wj-es2015Cjs": "./es2015-commonjs.js",
|
|
69
|
+
"esm2015": "./es2015-esm.js",
|
|
70
|
+
"wj-esm2015": "./es2015-esm.js"
|
|
71
|
+
}
|