@ms-atlas-module/datastudio-datafactory 0.1.36
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.
Potentially problematic release.
This version of @ms-atlas-module/datastudio-datafactory might be problematic. Click here for more details.
- package/_generated/ClientResources.js +1549 -0
- package/_generated/Framework.js +97 -0
- package/_generated/Svg.js +201 -0
- package/bootstrapper/BreadcrumbsKnockoutBinding.js +25 -0
- package/bootstrapper/CSS/Callout.css +43 -0
- package/bootstrapper/CSS/Common.css +22 -0
- package/bootstrapper/CSS/FormFields.css +133 -0
- package/bootstrapper/CSS/InlineBlock.css +34 -0
- package/bootstrapper/CSS/ParameterGroups.css +77 -0
- package/bootstrapper/CSS/Pivot.css +25 -0
- package/bootstrapper/CSS/Wizard.css +197 -0
- package/bootstrapper/CalloutBinding.js +52 -0
- package/bootstrapper/CollapsibleKnockoutBinding.js +70 -0
- package/bootstrapper/CopyBinding.js +150 -0
- package/bootstrapper/FilterFlyoutKnockoutBinding.js +114 -0
- package/bootstrapper/FormFields.js +397 -0
- package/bootstrapper/InlineBlockBinding.js +69 -0
- package/bootstrapper/JQueryUIBindings.js +152 -0
- package/bootstrapper/KnockoutBindings.js +635 -0
- package/bootstrapper/LoadingBinding.js +54 -0
- package/bootstrapper/MonacoEditorKnockoutBinding.js +67 -0
- package/bootstrapper/ParameterGroupsBinding.js +289 -0
- package/bootstrapper/PivotKnockoutBinding.js +61 -0
- package/bootstrapper/StatusCalendarFlyoutKnockoutBinding.js +398 -0
- package/bootstrapper/StatusCalendarKnockoutBinding.js +107 -0
- package/bootstrapper/TelemetryKnockoutBinding.js +68 -0
- package/bootstrapper/WinJSButtonKnockoutBinding.js +72 -0
- package/bootstrapper/WinJSKnockoutBindings.js +49 -0
- package/bootstrapper/WizardBinding.js +611 -0
- package/bootstrapper/startup.js +29 -0
- package/libs/VivaGraphControl/Content/CSS/Graph.css +157 -0
- package/libs/VivaGraphControl/Content/CSS/LightTheme.css +699 -0
- package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Base/Base.TriggerableLifetimeManager.js +190 -0
- package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Base/Base.js +647 -0
- package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Base/Image.js +113 -0
- package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Base/KnockoutExtensions.js +1064 -0
- package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/DockedBalloon.js +18 -0
- package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/Animation.js +192 -0
- package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/Commands/MoveNodes.js +83 -0
- package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/Geometry.js +167 -0
- package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/GraphEntityViewModel.js +260 -0
- package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/GraphViewModel.js +338 -0
- package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/GraphWidget.Constants.js +178 -0
- package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/GraphWidget.js +5190 -0
- package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/MouseCapture.js +148 -0
- package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/SvgUtils.js +164 -0
- package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Util/Detection.js +658 -0
- package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Util/Resize.js +241 -0
- package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Util/Util.Private.js +236 -0
- package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Util/Util.js +905 -0
- package/libs/WinJS/WinJs.min.js +61909 -0
- package/libs/WinJS/ui-light.css +8500 -0
- package/package.json +15 -0
- package/scripts/AppContext.js +262 -0
- package/scripts/ExposureControl.js +11 -0
- package/scripts/Framework/Model/ActivityWindowCache.js +390 -0
- package/scripts/Framework/Model/ArmDataFactoryCache.js +77 -0
- package/scripts/Framework/Model/Contracts/Activity.js +83 -0
- package/scripts/Framework/Model/Contracts/ActivityWindow.js +185 -0
- package/scripts/Framework/Model/Contracts/BaseEncodable.js +106 -0
- package/scripts/Framework/Model/Contracts/Common.js +19 -0
- package/scripts/Framework/Model/Contracts/DataArtifact.js +100 -0
- package/scripts/Framework/Model/Contracts/Diagram.js +9 -0
- package/scripts/Framework/Model/Contracts/Encodable.js +113 -0
- package/scripts/Framework/Model/Contracts/Gateway.js +98 -0
- package/scripts/Framework/Model/Contracts/LinkedService.js +200 -0
- package/scripts/Framework/Model/Contracts/Pipeline.js +197 -0
- package/scripts/Framework/Model/DataCache.js +105 -0
- package/scripts/Framework/Model/DataFactoryCache.js +24 -0
- package/scripts/Framework/Model/Filter.js +186 -0
- package/scripts/Framework/Model/Helpers/ActivityWindowHelper.js +185 -0
- package/scripts/Framework/Model/MonitoringView.js +40 -0
- package/scripts/Framework/Shared/Constants.js +27 -0
- package/scripts/Framework/Shared/DataConstants.js +61 -0
- package/scripts/Framework/Shared/Disposable.js +53 -0
- package/scripts/Framework/Shared/IconResources.js +59 -0
- package/scripts/Framework/Shared/Resources/IbizaSvgs.js +241 -0
- package/scripts/Framework/Shared/TypeDeclarations.js +4 -0
- package/scripts/Framework/Telemetry/Telemetry.js +78 -0
- package/scripts/Framework/UI/Breadcrumbs.js +84 -0
- package/scripts/Framework/UI/Command.js +231 -0
- package/scripts/Framework/UI/ContextMenu.js +80 -0
- package/scripts/Framework/UI/Loader.js +11 -0
- package/scripts/Framework/UI/Menu.js +65 -0
- package/scripts/Framework/UI/PanelMessage.js +25 -0
- package/scripts/Framework/UI/Refresh.js +70 -0
- package/scripts/Framework/UI/Spinner.js +61 -0
- package/scripts/Framework/UI/StatusCalendar.js +1070 -0
- package/scripts/Framework/UI/Toolbar.js +84 -0
- package/scripts/Framework/Util/Datetime.js +258 -0
- package/scripts/Framework/Util/Log.js +10 -0
- package/scripts/Framework/Util/ResourceIdUtil.js +56 -0
- package/scripts/Framework/Util/Security.js +73 -0
- package/scripts/Framework/Util/Util.js +332 -0
- package/scripts/Framework/Views/HoverFlyout.js +92 -0
- package/scripts/Handlers/ErrorHandler.js +176 -0
- package/scripts/Handlers/MessageHandler.js +115 -0
- package/scripts/Handlers/MonitoringViewHandler.js +199 -0
- package/scripts/Handlers/RoutingHandler.js +364 -0
- package/scripts/Handlers/WinJSHandlers.js +265 -0
- package/scripts/MonitoringViewContext.js +75 -0
- package/scripts/Services/AzureInsightsService.js +162 -0
- package/scripts/Services/AzureResourceManagerService.js +869 -0
- package/scripts/Services/BaseService.js +232 -0
- package/scripts/Services/DataFactoryService.js +204 -0
- package/scripts/Services/HDInsightArmService.js +59 -0
- package/scripts/ViewContext.js +9 -0
- package/stylesheets/main.css +1042 -0
- package/views/Edit/DateTimeFilterViewModel.js +211 -0
- package/views/Edit/FilterViewModel.js +131 -0
- package/views/Shared/ProvisioningState.js +11 -0
|
@@ -0,0 +1,647 @@
|
|
|
1
|
+
/// <reference path="../../../Definitions/jquery.d.ts" />
|
|
2
|
+
/// <reference path="../../../Definitions/knockout.d.ts" />
|
|
3
|
+
/// <reference path="../../../Definitions/knockout.extensionstypes.d.ts" />
|
|
4
|
+
/// <reference path="../../../Definitions/knockout.projections.d.ts" />
|
|
5
|
+
/// <reference path="../../../Definitions/html5.d.ts" />
|
|
6
|
+
/// <reference path="../../../Definitions/d3.d.ts" />
|
|
7
|
+
/// <amd-dependency path="Viva.Controls/Controls/Base/KnockoutExtensions" />
|
|
8
|
+
define([
|
|
9
|
+
"require",
|
|
10
|
+
"exports",
|
|
11
|
+
"../../Base/Base.TriggerableLifetimeManager",
|
|
12
|
+
"../../Util/Util",
|
|
13
|
+
"Viva.Controls/Controls/Base/KnockoutExtensions",
|
|
14
|
+
], function (require, exports, TriggerableLifetimeManagerBase, Util) {
|
|
15
|
+
var Main;
|
|
16
|
+
(function (Main) {
|
|
17
|
+
"use strict";
|
|
18
|
+
var widgetClass = "azc-control",
|
|
19
|
+
widgetDisabledClass = "azc-control-disabled",
|
|
20
|
+
widgetLoadingClass = "azc-control-loading";
|
|
21
|
+
var ViewModel = (function () {
|
|
22
|
+
function ViewModel() {
|
|
23
|
+
/**
|
|
24
|
+
* Indicates if the widget is currently disabled.
|
|
25
|
+
*/
|
|
26
|
+
this.disabled = ko.observable(false);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Populates the view model from a key/value pairs object.
|
|
30
|
+
* The keys should map to properties on the view model.
|
|
31
|
+
* The values are applied to the corresponding keys.
|
|
32
|
+
*
|
|
33
|
+
* @param object An un-typed object with values to populate on the view model.
|
|
34
|
+
*/
|
|
35
|
+
ViewModel.prototype.populateFromObject = function (object) {
|
|
36
|
+
ViewModel.copyObject(object, this);
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Deep copies all the properties of the source object to the destination object.
|
|
40
|
+
* All properties in destination that are not in the source should remain intact.
|
|
41
|
+
* Functions are copied by reference.
|
|
42
|
+
*
|
|
43
|
+
* @param source The object whose properties need to be copied.
|
|
44
|
+
* @param destination The destination object.
|
|
45
|
+
*/
|
|
46
|
+
ViewModel.copyObject = function (source, destination) {
|
|
47
|
+
ViewModel._copyObject(source, destination, [], []);
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Deep copies all the properties of the source object to the destination object.
|
|
51
|
+
* All properties in destination that are not in the source should remain intact.
|
|
52
|
+
* Functions are copied by reference.
|
|
53
|
+
*
|
|
54
|
+
* We need to ensure that properties that point to one of their ancestors doesn't cause a infinite loop.
|
|
55
|
+
* To that end, we pass in the sourceAncestors and destination ancestors and check against that.
|
|
56
|
+
*
|
|
57
|
+
* @param source The object whose properties need to be copied.
|
|
58
|
+
* @param destination The destination object.
|
|
59
|
+
* @param sourceAncestors The ancestors of the source object used to prevent circular linked list causing an infinite loop.
|
|
60
|
+
* @param destinationAncestors The ancestors of the destination object corresponding to the sourceAncestors to assign to circular linked list.
|
|
61
|
+
*/
|
|
62
|
+
ViewModel._copyObject = function (
|
|
63
|
+
source,
|
|
64
|
+
destination,
|
|
65
|
+
sourceAncestors,
|
|
66
|
+
destinationAncestors
|
|
67
|
+
) {
|
|
68
|
+
// cast the objects to StringMap<any> for the purposes of copying
|
|
69
|
+
var sourceMap = source,
|
|
70
|
+
destMap = destination,
|
|
71
|
+
sourceIndex,
|
|
72
|
+
key,
|
|
73
|
+
sourceProp;
|
|
74
|
+
sourceAncestors.push(source);
|
|
75
|
+
destinationAncestors.push(destination);
|
|
76
|
+
for (key in sourceMap) {
|
|
77
|
+
if (sourceMap.hasOwnProperty(key)) {
|
|
78
|
+
sourceProp = sourceMap[key];
|
|
79
|
+
if (sourceProp !== undefined) {
|
|
80
|
+
if (Array.isArray(sourceProp)) {
|
|
81
|
+
// currently we shallow copy arrays
|
|
82
|
+
destMap[key] = sourceProp;
|
|
83
|
+
} else if (sourceProp instanceof Date) {
|
|
84
|
+
destMap[key] = sourceProp;
|
|
85
|
+
} else if (
|
|
86
|
+
typeof sourceProp === "object" &&
|
|
87
|
+
sourceProp !== null
|
|
88
|
+
) {
|
|
89
|
+
sourceIndex = sourceAncestors.indexOf(sourceProp);
|
|
90
|
+
if (sourceIndex >= 0) {
|
|
91
|
+
// the property points to an ancestor, so we copy the corresponding destination ancestor.
|
|
92
|
+
destMap[key] = destinationAncestors[sourceIndex];
|
|
93
|
+
} else {
|
|
94
|
+
if (!destMap[key]) {
|
|
95
|
+
// the property doesn't exist in destination, so we create an anonymous object
|
|
96
|
+
destMap[key] = {};
|
|
97
|
+
}
|
|
98
|
+
// deep copy the properties of source[key] to destination[key]
|
|
99
|
+
ViewModel._copyObject(
|
|
100
|
+
sourceProp,
|
|
101
|
+
destMap[key],
|
|
102
|
+
sourceAncestors,
|
|
103
|
+
destinationAncestors
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
} else {
|
|
107
|
+
// functions(including observables) and value types
|
|
108
|
+
destMap[key] = sourceProp;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
return ViewModel;
|
|
115
|
+
})();
|
|
116
|
+
Main.ViewModel = ViewModel;
|
|
117
|
+
var Widget = (function () {
|
|
118
|
+
function Widget(element, options, createOptions) {
|
|
119
|
+
var _this = this;
|
|
120
|
+
this._isLoading = ko.observable(false);
|
|
121
|
+
// Declare whether this control support the canFocus/setFocus
|
|
122
|
+
this._supportsFocus = ko.observable(false);
|
|
123
|
+
// Mark a list of element as data-focusfirst when the container have the focus.
|
|
124
|
+
// Only set this when the desired focus order is different than the browser default DOM tab order.
|
|
125
|
+
this._markFocusFirstElements = ko.observable();
|
|
126
|
+
// To avoid recursive destroy been called. We keep array of DestroyID.
|
|
127
|
+
this._destroyIds = [];
|
|
128
|
+
this._dataFocusableCallback = ko.observable();
|
|
129
|
+
this._loading = 0;
|
|
130
|
+
if (!element || element.length === 0) {
|
|
131
|
+
throw new Error(
|
|
132
|
+
"You must specify an element to associate a widget to it. Your element is either null or an empty collection."
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
this._lifetimeManager =
|
|
136
|
+
new TriggerableLifetimeManagerBase.TriggerableLifetimeManager();
|
|
137
|
+
this._disposablesLifetimeManager =
|
|
138
|
+
this._lifetimeManager.createChildLifetime();
|
|
139
|
+
this._createOptions = $.extend(
|
|
140
|
+
{ viewModelType: ViewModel, knockoutBinding: false },
|
|
141
|
+
createOptions
|
|
142
|
+
);
|
|
143
|
+
Widget.setupCleanData();
|
|
144
|
+
this.element = $(element[0])
|
|
145
|
+
.addClass(widgetClass)
|
|
146
|
+
.attr(Util.Constants.dataControlAttribute, "true");
|
|
147
|
+
if (!this.element.data(Widget._widgetTypesDataKey)) {
|
|
148
|
+
this.element.data(Widget._widgetTypesDataKey, []);
|
|
149
|
+
}
|
|
150
|
+
this.element.data(Widget._widgetTypesDataKey).push(this);
|
|
151
|
+
if (options instanceof this._createOptions.viewModelType) {
|
|
152
|
+
this._options = options;
|
|
153
|
+
} else {
|
|
154
|
+
this._options = new this._createOptions.viewModelType();
|
|
155
|
+
this._options.populateFromObject(options);
|
|
156
|
+
}
|
|
157
|
+
this._addDisposablesToCleanUp(
|
|
158
|
+
ko.computed(function () {
|
|
159
|
+
_this
|
|
160
|
+
.widget()
|
|
161
|
+
.toggleClass(widgetDisabledClass, _this.options.disabled());
|
|
162
|
+
})
|
|
163
|
+
);
|
|
164
|
+
this._addDisposablesToCleanUp(
|
|
165
|
+
ko.computed(function () {
|
|
166
|
+
var isLoading = _this._isLoading();
|
|
167
|
+
_this.widget().toggleClass(widgetLoadingClass, isLoading);
|
|
168
|
+
})
|
|
169
|
+
);
|
|
170
|
+
this._addDisposablesToCleanUp(
|
|
171
|
+
ko.computed(function () {
|
|
172
|
+
var callback = _this._dataFocusableCallback();
|
|
173
|
+
if (Util.isNullOrUndefined(callback)) {
|
|
174
|
+
_this.element.removeAttr(Util.Constants.dataCanFocusAttribute);
|
|
175
|
+
delete _this.element[0][Util.Constants.dataCanFocusAttribute];
|
|
176
|
+
} else {
|
|
177
|
+
_this.element.attr(Util.Constants.dataCanFocusAttribute, "true");
|
|
178
|
+
_this.element[0][Util.Constants.dataCanFocusAttribute] =
|
|
179
|
+
function () {
|
|
180
|
+
return callback.apply(_this, [_this.element, _this]);
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
})
|
|
184
|
+
);
|
|
185
|
+
this._addDisposablesToCleanUp(
|
|
186
|
+
ko.computed(function () {
|
|
187
|
+
var supportFocus = _this._supportsFocus(),
|
|
188
|
+
dataFocusableCallback = _this._dataFocusableCallback.peek();
|
|
189
|
+
if (supportFocus) {
|
|
190
|
+
if (dataFocusableCallback !== _this._setFocus) {
|
|
191
|
+
_this._dataFocusableCallback(_this._setFocus);
|
|
192
|
+
}
|
|
193
|
+
} else {
|
|
194
|
+
if (!Util.isNullOrUndefined(dataFocusableCallback)) {
|
|
195
|
+
_this._dataFocusableCallback(null);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
})
|
|
199
|
+
);
|
|
200
|
+
this._addDisposablesToCleanUp(
|
|
201
|
+
ko.computed(function () {
|
|
202
|
+
var callback = _this._markFocusFirstElements();
|
|
203
|
+
var newElement = callback ? callback() : null;
|
|
204
|
+
if (_this._prevElement) {
|
|
205
|
+
$(_this._prevElement).removeAttr(
|
|
206
|
+
Util.Constants.dataFocusFirstAttribute
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
if (newElement) {
|
|
210
|
+
$(newElement).attr(
|
|
211
|
+
Util.Constants.dataFocusFirstAttribute,
|
|
212
|
+
"true"
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
_this._prevElement = newElement;
|
|
216
|
+
})
|
|
217
|
+
);
|
|
218
|
+
this._initializeSubscriptions(this.options);
|
|
219
|
+
// Add the widget to the active tracking context if there is one
|
|
220
|
+
if (Widget._trackingContexts.length) {
|
|
221
|
+
var context =
|
|
222
|
+
Widget._trackingContexts[Widget._trackingContexts.length - 1];
|
|
223
|
+
context.push(this);
|
|
224
|
+
}
|
|
225
|
+
this._registerDispose();
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* _checkExistsOrRegisterDestroyId. This is utility function for the destroy method to avoid recursive
|
|
229
|
+
*
|
|
230
|
+
* @param destroyId Unique identifier for the destroy to identify itself. In the javascript inheritance, this.destroy is always the same.
|
|
231
|
+
* But super.dispose is unique since super is function scope. Typically, use super.dispose as id. For root object, use null as Id.
|
|
232
|
+
* @return whether this destroyMethod is already on the executed. If true, mean it is already been executed.
|
|
233
|
+
*/
|
|
234
|
+
Widget.prototype._checkExistsOrRegisterDestroyId = function (destroyId) {
|
|
235
|
+
return Util.existsOrRegisterId(this._destroyIds, destroyId);
|
|
236
|
+
};
|
|
237
|
+
/**
|
|
238
|
+
* See interface.
|
|
239
|
+
*/
|
|
240
|
+
Widget.prototype.isDisposed = function () {
|
|
241
|
+
return this._destroyIds.length > 0;
|
|
242
|
+
};
|
|
243
|
+
/**
|
|
244
|
+
* See interface.
|
|
245
|
+
*/
|
|
246
|
+
Widget.prototype.dispose = function () {
|
|
247
|
+
if (this._checkExistsOrRegisterDestroyId(null)) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
var widgetTypes = this.element.data(Widget._widgetTypesDataKey);
|
|
251
|
+
if (this._disposeCallback) {
|
|
252
|
+
this._unregisterDispose();
|
|
253
|
+
this._disposeCallback = null;
|
|
254
|
+
}
|
|
255
|
+
// remove the register callback from the element.
|
|
256
|
+
this._supportsFocus(false);
|
|
257
|
+
this._disposeSubscriptions();
|
|
258
|
+
if (this._lifetimeManager) {
|
|
259
|
+
this._lifetimeManager.dispose();
|
|
260
|
+
this._lifetimeManager = null;
|
|
261
|
+
}
|
|
262
|
+
this.element
|
|
263
|
+
.removeClass(widgetClass)
|
|
264
|
+
.removeClass(widgetDisabledClass)
|
|
265
|
+
.removeAttr(Util.Constants.dataControlAttribute);
|
|
266
|
+
if (widgetTypes) {
|
|
267
|
+
widgetTypes.splice(widgetTypes.indexOf(this), 1);
|
|
268
|
+
if (widgetTypes.length === 0) {
|
|
269
|
+
this.element.removeData(Widget._widgetTypesDataKey);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
// Remove the widget from the active tracking context if there is one
|
|
273
|
+
if (Widget._trackingContexts.length) {
|
|
274
|
+
var context =
|
|
275
|
+
Widget._trackingContexts[Widget._trackingContexts.length - 1],
|
|
276
|
+
index = context.indexOf(this);
|
|
277
|
+
context.splice(index, 1);
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
Object.defineProperty(Widget.prototype, "lifetimeManager", {
|
|
281
|
+
/**
|
|
282
|
+
* See interface.
|
|
283
|
+
*/
|
|
284
|
+
get: function () {
|
|
285
|
+
return this._lifetimeManager;
|
|
286
|
+
},
|
|
287
|
+
enumerable: true,
|
|
288
|
+
configurable: true,
|
|
289
|
+
});
|
|
290
|
+
Object.defineProperty(Widget.prototype, "options", {
|
|
291
|
+
/**
|
|
292
|
+
* See interface.
|
|
293
|
+
*/
|
|
294
|
+
get: function () {
|
|
295
|
+
return this._options;
|
|
296
|
+
},
|
|
297
|
+
enumerable: true,
|
|
298
|
+
configurable: true,
|
|
299
|
+
});
|
|
300
|
+
/**
|
|
301
|
+
* Gets the binding handler instance for the specified widget type.
|
|
302
|
+
*
|
|
303
|
+
* @param widgetType The prototype for initializing the portal control.
|
|
304
|
+
* @param initOptions This initialization options for the widget binding.
|
|
305
|
+
* @return Binding handler instance for initializing the portal control.
|
|
306
|
+
*/
|
|
307
|
+
Widget.getBindingHandler = function (widgetType, initOptions) {
|
|
308
|
+
initOptions = initOptions || { controlsDescendantBindings: true };
|
|
309
|
+
return {
|
|
310
|
+
init: function (
|
|
311
|
+
element,
|
|
312
|
+
valueAccessor,
|
|
313
|
+
allBindingsAccessor,
|
|
314
|
+
viewModel,
|
|
315
|
+
bindingContext
|
|
316
|
+
) {
|
|
317
|
+
return initOptions;
|
|
318
|
+
},
|
|
319
|
+
update: function (
|
|
320
|
+
element,
|
|
321
|
+
valueAccessor,
|
|
322
|
+
allBindingsAccessor,
|
|
323
|
+
viewModel,
|
|
324
|
+
bindingContext
|
|
325
|
+
) {
|
|
326
|
+
// Establish a single dependency on value if observable
|
|
327
|
+
var value = ko.utils.unwrapObservable(valueAccessor());
|
|
328
|
+
// Ignore construct/destroy dependencies for the widget binding
|
|
329
|
+
// that could be introduced by the widget reading an observable property.
|
|
330
|
+
ko.utils.ignoreDependencies(function () {
|
|
331
|
+
var widget = Widget.getWidget($(element), widgetType);
|
|
332
|
+
// Destroy the widget if previously created on an observable view model
|
|
333
|
+
if (widget !== null) {
|
|
334
|
+
widget.dispose();
|
|
335
|
+
}
|
|
336
|
+
// Create the widget if there is a view model or options provided by the value accessor.
|
|
337
|
+
// Null options is not allowed when binding but can be done with direct widget instantiation.
|
|
338
|
+
if (value) {
|
|
339
|
+
widget = new widgetType($(element), value, {
|
|
340
|
+
knockoutBinding: true,
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
},
|
|
345
|
+
};
|
|
346
|
+
};
|
|
347
|
+
/**
|
|
348
|
+
* Retrieves the first widget instance of the requested type on the element, or null if none found.
|
|
349
|
+
*
|
|
350
|
+
* @param element The JQuery element to search on.
|
|
351
|
+
* @param type The widget type to perform the search for.
|
|
352
|
+
* @return The first widget instance found on the element, optionally filtered by type.
|
|
353
|
+
*/
|
|
354
|
+
Widget.getWidget = function (element, type) {
|
|
355
|
+
var widgetsArray = Widget.getWidgets(element, type);
|
|
356
|
+
if (widgetsArray) {
|
|
357
|
+
return widgetsArray[0] || null;
|
|
358
|
+
}
|
|
359
|
+
return null;
|
|
360
|
+
};
|
|
361
|
+
/**
|
|
362
|
+
* Retrieves the widget instances applied to an element, filtered with an optional type.
|
|
363
|
+
*
|
|
364
|
+
* @param element The JQuery element to search on.
|
|
365
|
+
* @param type An optional widget type to filter with.
|
|
366
|
+
* @return All the widget instances found on the element, optionally filtered by type.
|
|
367
|
+
*/
|
|
368
|
+
Widget.getWidgets = function (element, type) {
|
|
369
|
+
var widgetsArray = element.data(Widget._widgetTypesDataKey) || [];
|
|
370
|
+
if (type) {
|
|
371
|
+
return widgetsArray.filter(function (value, index, array) {
|
|
372
|
+
return value instanceof type;
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
return widgetsArray;
|
|
376
|
+
};
|
|
377
|
+
/**
|
|
378
|
+
* See interface.
|
|
379
|
+
*/
|
|
380
|
+
Widget.prototype.widget = function () {
|
|
381
|
+
return this.element;
|
|
382
|
+
};
|
|
383
|
+
/**
|
|
384
|
+
* Starts tracking widgets as they are created and disposed.
|
|
385
|
+
*
|
|
386
|
+
* @param context Array to hold the actively tracked widgets.
|
|
387
|
+
*/
|
|
388
|
+
Widget.beginTracking = function (context) {
|
|
389
|
+
if (context === void 0) {
|
|
390
|
+
context = [];
|
|
391
|
+
}
|
|
392
|
+
Widget._trackingContexts.push(context);
|
|
393
|
+
};
|
|
394
|
+
/**
|
|
395
|
+
* Stops tracking widgets as they are created and disposed.
|
|
396
|
+
*
|
|
397
|
+
* @return The context array holding the active widgets that were tracked.
|
|
398
|
+
*/
|
|
399
|
+
Widget.endTracking = function () {
|
|
400
|
+
return Widget._trackingContexts.pop();
|
|
401
|
+
};
|
|
402
|
+
/**
|
|
403
|
+
* Toggles display:none until this._loading reference count reaches zero. This is a performance optimization to avoid browsers from rendering until the DOM finish updating.
|
|
404
|
+
* By default, we wrap bind() method with _delayRendering(true) and _delayRendering(false) to avoid the browsers from rendering until the DOM has finished updating by Knockout.
|
|
405
|
+
*
|
|
406
|
+
* @param delay True to increase ref count of this._loading to indicate the section needs to be wrapped into diaplay:none to optimize for the performance.
|
|
407
|
+
* False to decrease of ref count of this._loading to indicate exiting of prior _delayRendering(true).
|
|
408
|
+
*/
|
|
409
|
+
Widget.prototype._delayRendering = function (delay) {
|
|
410
|
+
if (delay) {
|
|
411
|
+
this._loading++;
|
|
412
|
+
if (this._loading === 1) {
|
|
413
|
+
this._isLoading(true);
|
|
414
|
+
}
|
|
415
|
+
} else {
|
|
416
|
+
if (this._loading > 0) {
|
|
417
|
+
this._loading--;
|
|
418
|
+
if (this._loading === 0) {
|
|
419
|
+
this._isLoading(false);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
Object.defineProperty(Widget.prototype, "_subscriptions", {
|
|
425
|
+
get: function () {
|
|
426
|
+
return this._subscriptionsLifetimeManager;
|
|
427
|
+
},
|
|
428
|
+
enumerable: true,
|
|
429
|
+
configurable: true,
|
|
430
|
+
});
|
|
431
|
+
Object.defineProperty(Widget.prototype, "_disposables", {
|
|
432
|
+
// test only access
|
|
433
|
+
get: function () {
|
|
434
|
+
return this._disposablesLifetimeManager;
|
|
435
|
+
},
|
|
436
|
+
enumerable: true,
|
|
437
|
+
configurable: true,
|
|
438
|
+
});
|
|
439
|
+
/**
|
|
440
|
+
* Can this control be focused.
|
|
441
|
+
*
|
|
442
|
+
* @return Whether this element can be set focus on.
|
|
443
|
+
*/
|
|
444
|
+
Widget.prototype._canSetFocus = function () {
|
|
445
|
+
if (
|
|
446
|
+
this.element.attr(Util.Constants.dataCanFocusAttribute) &&
|
|
447
|
+
!this.options.disabled.peek() &&
|
|
448
|
+
this.element.is(":visible") &&
|
|
449
|
+
!this.element.is(":disabled")
|
|
450
|
+
) {
|
|
451
|
+
return true;
|
|
452
|
+
}
|
|
453
|
+
return false;
|
|
454
|
+
};
|
|
455
|
+
/**
|
|
456
|
+
* Simple helper for _setFocus function. It will call focus on the returned Element.
|
|
457
|
+
*
|
|
458
|
+
* @return The element to set focus on.
|
|
459
|
+
*/
|
|
460
|
+
Widget.prototype._getElementToFocus = function () {
|
|
461
|
+
return this.widget()[0];
|
|
462
|
+
};
|
|
463
|
+
/**
|
|
464
|
+
* Default implementation of setFocus for this widget when this._supportFocus(true).
|
|
465
|
+
*
|
|
466
|
+
* @param elem The element of the control that has _supportFocus(true).
|
|
467
|
+
* @param widget This widget.
|
|
468
|
+
* @return Whether it successfully sets the focus on the item.
|
|
469
|
+
*/
|
|
470
|
+
Widget.prototype._setFocus = function (elem, widget) {
|
|
471
|
+
if (this._canSetFocus()) {
|
|
472
|
+
var element = this._getElementToFocus();
|
|
473
|
+
if (element) {
|
|
474
|
+
element.focus();
|
|
475
|
+
return true;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
return false;
|
|
479
|
+
};
|
|
480
|
+
/**
|
|
481
|
+
* Calls knockout to bind the descendant nodes to the view model.
|
|
482
|
+
*
|
|
483
|
+
* @param extraViewModel Extra view model you can attach to the Knockout view model.
|
|
484
|
+
*/
|
|
485
|
+
Widget.prototype._bindDescendants = function (extraViewModel) {
|
|
486
|
+
var vm = { data: this.options, func: this },
|
|
487
|
+
finalVm = extraViewModel ? $.extend(null, vm, extraViewModel) : vm;
|
|
488
|
+
try {
|
|
489
|
+
this._delayRendering(true);
|
|
490
|
+
ko.applyBindingsToDescendants(finalVm, this.element[0]);
|
|
491
|
+
} finally {
|
|
492
|
+
this._delayRendering(false);
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
/**
|
|
496
|
+
* Calls Knockout to clean up all descendent bindings.
|
|
497
|
+
*/
|
|
498
|
+
Widget.prototype._cleanDescendants = function () {
|
|
499
|
+
ko.utils.cleanDescendantNodes(this.element);
|
|
500
|
+
};
|
|
501
|
+
/**
|
|
502
|
+
* Triggers an event on the widget associated element.
|
|
503
|
+
*
|
|
504
|
+
* @param type A string indicating the type of event to create.
|
|
505
|
+
* @param event An optional JQueryEventObject containing data for this event.
|
|
506
|
+
* @param data An optional object containing data for the event.
|
|
507
|
+
* @param target An optional target for the event instead of the widget element.
|
|
508
|
+
* @return A boolean indicating if the event should be propagated or not.
|
|
509
|
+
*/
|
|
510
|
+
Widget.prototype._trigger = function (type, event, data, target) {
|
|
511
|
+
var callback = this.options[type];
|
|
512
|
+
data = data || {};
|
|
513
|
+
event = event || $.Event(type);
|
|
514
|
+
event.type = type;
|
|
515
|
+
event.target = target || this.element[0];
|
|
516
|
+
this.element.trigger(event, data);
|
|
517
|
+
return !(
|
|
518
|
+
($.isFunction(callback) &&
|
|
519
|
+
callback.apply(this.element[0], [event].concat(data)) === false) ||
|
|
520
|
+
event.isDefaultPrevented()
|
|
521
|
+
);
|
|
522
|
+
};
|
|
523
|
+
/**
|
|
524
|
+
* Helper method allowing you to unsubscribe from previously subscribed functions.
|
|
525
|
+
* This method should not be overridden.
|
|
526
|
+
*/
|
|
527
|
+
Widget.prototype._disposeSubscriptions = function () {
|
|
528
|
+
if (this._subscriptionsLifetimeManager) {
|
|
529
|
+
this._subscriptionsLifetimeManager.dispose();
|
|
530
|
+
this._subscriptionsLifetimeManager = null;
|
|
531
|
+
}
|
|
532
|
+
};
|
|
533
|
+
/**
|
|
534
|
+
* Helper method allowing you to clean up resources related the the HTMLElement.
|
|
535
|
+
* This method should not be overridden.
|
|
536
|
+
*
|
|
537
|
+
* @param cssClasses Optional css classes to remove from the HTMLElement.
|
|
538
|
+
*/
|
|
539
|
+
Widget.prototype._cleanElement = function () {
|
|
540
|
+
var cssClasses = [];
|
|
541
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
542
|
+
cssClasses[_i - 0] = arguments[_i];
|
|
543
|
+
}
|
|
544
|
+
// If the control did a _bindDecendants on the element it will need to clean descendants.
|
|
545
|
+
this._cleanDescendants();
|
|
546
|
+
if (cssClasses.length > 0) {
|
|
547
|
+
this.element.removeClass(cssClasses.join(" "));
|
|
548
|
+
}
|
|
549
|
+
this.element.empty();
|
|
550
|
+
};
|
|
551
|
+
/**
|
|
552
|
+
* Helper method allowing you to subscribe to knockout objects.
|
|
553
|
+
*
|
|
554
|
+
* @param viewModel The ViewModel.
|
|
555
|
+
*/
|
|
556
|
+
Widget.prototype._initializeSubscriptions = function (viewModel) {
|
|
557
|
+
this._disposeSubscriptions();
|
|
558
|
+
this._subscriptionsLifetimeManager =
|
|
559
|
+
this.lifetimeManager.createChildLifetime();
|
|
560
|
+
};
|
|
561
|
+
/**
|
|
562
|
+
* Indicates if the UI is currently in RTL mode.
|
|
563
|
+
*
|
|
564
|
+
* @return true if RTL is enabled.
|
|
565
|
+
*/
|
|
566
|
+
Widget.prototype._isRtl = function () {
|
|
567
|
+
return $("html").attr("dir") === "rtl";
|
|
568
|
+
};
|
|
569
|
+
/**
|
|
570
|
+
* Placeholder to add additional logic after widget is initialized.
|
|
571
|
+
* Inherited classes can override this method to add custom logic which requires widget to be in the initialized state.
|
|
572
|
+
*/
|
|
573
|
+
Widget.prototype._afterCreate = function () {};
|
|
574
|
+
Widget.prototype._addDisposablesToCleanUp = function (disposable) {
|
|
575
|
+
this._disposablesLifetimeManager.registerForDispose(disposable);
|
|
576
|
+
};
|
|
577
|
+
/**
|
|
578
|
+
* Registers an appropriate callback to notify the widget to dispose.
|
|
579
|
+
*/
|
|
580
|
+
Widget.prototype._registerDispose = function () {
|
|
581
|
+
var _this = this;
|
|
582
|
+
if (this._createOptions.knockoutBinding) {
|
|
583
|
+
ko.utils.domNodeDisposal.addDisposeCallback(
|
|
584
|
+
this.element[0],
|
|
585
|
+
(this._disposeCallback = function (node) {
|
|
586
|
+
_this.dispose();
|
|
587
|
+
})
|
|
588
|
+
);
|
|
589
|
+
} else {
|
|
590
|
+
this.element.on(
|
|
591
|
+
Widget._widgetRemoveEvent,
|
|
592
|
+
(this._disposeCallback = function (evt) {
|
|
593
|
+
if (evt.target === _this.element[0] && !_this._destroyTriggered) {
|
|
594
|
+
_this._destroyTriggered = true;
|
|
595
|
+
_this.dispose();
|
|
596
|
+
}
|
|
597
|
+
})
|
|
598
|
+
);
|
|
599
|
+
}
|
|
600
|
+
};
|
|
601
|
+
/**
|
|
602
|
+
* Unregisters the dispose callback when it is no longer needed.
|
|
603
|
+
*/
|
|
604
|
+
Widget.prototype._unregisterDispose = function () {
|
|
605
|
+
if (this._createOptions.knockoutBinding) {
|
|
606
|
+
ko.utils.domNodeDisposal.removeDisposeCallback(
|
|
607
|
+
this.element[0],
|
|
608
|
+
this._disposeCallback
|
|
609
|
+
);
|
|
610
|
+
} else {
|
|
611
|
+
this.element.off(Widget._widgetRemoveEvent, this._disposeCallback);
|
|
612
|
+
}
|
|
613
|
+
};
|
|
614
|
+
/**
|
|
615
|
+
* Registers the cleanData with jQuery.
|
|
616
|
+
*/
|
|
617
|
+
Widget.setupCleanData = function () {
|
|
618
|
+
if (!Widget._cleanData) {
|
|
619
|
+
Widget._cleanData = $.cleanData;
|
|
620
|
+
$.cleanData = function (elements) {
|
|
621
|
+
var elementHasData;
|
|
622
|
+
for (
|
|
623
|
+
var i = 0, elem;
|
|
624
|
+
(elem = elements[i]) !== null && elem !== undefined;
|
|
625
|
+
i++
|
|
626
|
+
) {
|
|
627
|
+
if ($.hasData(elem)) {
|
|
628
|
+
$(elem).triggerHandler(Widget._widgetRemoveEvent);
|
|
629
|
+
elementHasData = true;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
if (elementHasData) {
|
|
633
|
+
Widget._cleanData.call($, elements);
|
|
634
|
+
}
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
};
|
|
638
|
+
Widget._widgetTypesDataKey = "azcWidgetTypes";
|
|
639
|
+
Widget._widgetEventNamespace = ".azcWidget";
|
|
640
|
+
Widget._widgetRemoveEvent = "remove" + Widget._widgetEventNamespace;
|
|
641
|
+
Widget._trackingContexts = [];
|
|
642
|
+
return Widget;
|
|
643
|
+
})();
|
|
644
|
+
Main.Widget = Widget;
|
|
645
|
+
})(Main || (Main = {}));
|
|
646
|
+
return Main;
|
|
647
|
+
});
|