@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.

Files changed (111) hide show
  1. package/_generated/ClientResources.js +1549 -0
  2. package/_generated/Framework.js +97 -0
  3. package/_generated/Svg.js +201 -0
  4. package/bootstrapper/BreadcrumbsKnockoutBinding.js +25 -0
  5. package/bootstrapper/CSS/Callout.css +43 -0
  6. package/bootstrapper/CSS/Common.css +22 -0
  7. package/bootstrapper/CSS/FormFields.css +133 -0
  8. package/bootstrapper/CSS/InlineBlock.css +34 -0
  9. package/bootstrapper/CSS/ParameterGroups.css +77 -0
  10. package/bootstrapper/CSS/Pivot.css +25 -0
  11. package/bootstrapper/CSS/Wizard.css +197 -0
  12. package/bootstrapper/CalloutBinding.js +52 -0
  13. package/bootstrapper/CollapsibleKnockoutBinding.js +70 -0
  14. package/bootstrapper/CopyBinding.js +150 -0
  15. package/bootstrapper/FilterFlyoutKnockoutBinding.js +114 -0
  16. package/bootstrapper/FormFields.js +397 -0
  17. package/bootstrapper/InlineBlockBinding.js +69 -0
  18. package/bootstrapper/JQueryUIBindings.js +152 -0
  19. package/bootstrapper/KnockoutBindings.js +635 -0
  20. package/bootstrapper/LoadingBinding.js +54 -0
  21. package/bootstrapper/MonacoEditorKnockoutBinding.js +67 -0
  22. package/bootstrapper/ParameterGroupsBinding.js +289 -0
  23. package/bootstrapper/PivotKnockoutBinding.js +61 -0
  24. package/bootstrapper/StatusCalendarFlyoutKnockoutBinding.js +398 -0
  25. package/bootstrapper/StatusCalendarKnockoutBinding.js +107 -0
  26. package/bootstrapper/TelemetryKnockoutBinding.js +68 -0
  27. package/bootstrapper/WinJSButtonKnockoutBinding.js +72 -0
  28. package/bootstrapper/WinJSKnockoutBindings.js +49 -0
  29. package/bootstrapper/WizardBinding.js +611 -0
  30. package/bootstrapper/startup.js +29 -0
  31. package/libs/VivaGraphControl/Content/CSS/Graph.css +157 -0
  32. package/libs/VivaGraphControl/Content/CSS/LightTheme.css +699 -0
  33. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Base/Base.TriggerableLifetimeManager.js +190 -0
  34. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Base/Base.js +647 -0
  35. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Base/Image.js +113 -0
  36. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Base/KnockoutExtensions.js +1064 -0
  37. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/DockedBalloon.js +18 -0
  38. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/Animation.js +192 -0
  39. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/Commands/MoveNodes.js +83 -0
  40. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/Geometry.js +167 -0
  41. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/GraphEntityViewModel.js +260 -0
  42. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/GraphViewModel.js +338 -0
  43. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/GraphWidget.Constants.js +178 -0
  44. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/GraphWidget.js +5190 -0
  45. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/MouseCapture.js +148 -0
  46. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/SvgUtils.js +164 -0
  47. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Util/Detection.js +658 -0
  48. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Util/Resize.js +241 -0
  49. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Util/Util.Private.js +236 -0
  50. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Util/Util.js +905 -0
  51. package/libs/WinJS/WinJs.min.js +61909 -0
  52. package/libs/WinJS/ui-light.css +8500 -0
  53. package/package.json +15 -0
  54. package/scripts/AppContext.js +262 -0
  55. package/scripts/ExposureControl.js +11 -0
  56. package/scripts/Framework/Model/ActivityWindowCache.js +390 -0
  57. package/scripts/Framework/Model/ArmDataFactoryCache.js +77 -0
  58. package/scripts/Framework/Model/Contracts/Activity.js +83 -0
  59. package/scripts/Framework/Model/Contracts/ActivityWindow.js +185 -0
  60. package/scripts/Framework/Model/Contracts/BaseEncodable.js +106 -0
  61. package/scripts/Framework/Model/Contracts/Common.js +19 -0
  62. package/scripts/Framework/Model/Contracts/DataArtifact.js +100 -0
  63. package/scripts/Framework/Model/Contracts/Diagram.js +9 -0
  64. package/scripts/Framework/Model/Contracts/Encodable.js +113 -0
  65. package/scripts/Framework/Model/Contracts/Gateway.js +98 -0
  66. package/scripts/Framework/Model/Contracts/LinkedService.js +200 -0
  67. package/scripts/Framework/Model/Contracts/Pipeline.js +197 -0
  68. package/scripts/Framework/Model/DataCache.js +105 -0
  69. package/scripts/Framework/Model/DataFactoryCache.js +24 -0
  70. package/scripts/Framework/Model/Filter.js +186 -0
  71. package/scripts/Framework/Model/Helpers/ActivityWindowHelper.js +185 -0
  72. package/scripts/Framework/Model/MonitoringView.js +40 -0
  73. package/scripts/Framework/Shared/Constants.js +27 -0
  74. package/scripts/Framework/Shared/DataConstants.js +61 -0
  75. package/scripts/Framework/Shared/Disposable.js +53 -0
  76. package/scripts/Framework/Shared/IconResources.js +59 -0
  77. package/scripts/Framework/Shared/Resources/IbizaSvgs.js +241 -0
  78. package/scripts/Framework/Shared/TypeDeclarations.js +4 -0
  79. package/scripts/Framework/Telemetry/Telemetry.js +78 -0
  80. package/scripts/Framework/UI/Breadcrumbs.js +84 -0
  81. package/scripts/Framework/UI/Command.js +231 -0
  82. package/scripts/Framework/UI/ContextMenu.js +80 -0
  83. package/scripts/Framework/UI/Loader.js +11 -0
  84. package/scripts/Framework/UI/Menu.js +65 -0
  85. package/scripts/Framework/UI/PanelMessage.js +25 -0
  86. package/scripts/Framework/UI/Refresh.js +70 -0
  87. package/scripts/Framework/UI/Spinner.js +61 -0
  88. package/scripts/Framework/UI/StatusCalendar.js +1070 -0
  89. package/scripts/Framework/UI/Toolbar.js +84 -0
  90. package/scripts/Framework/Util/Datetime.js +258 -0
  91. package/scripts/Framework/Util/Log.js +10 -0
  92. package/scripts/Framework/Util/ResourceIdUtil.js +56 -0
  93. package/scripts/Framework/Util/Security.js +73 -0
  94. package/scripts/Framework/Util/Util.js +332 -0
  95. package/scripts/Framework/Views/HoverFlyout.js +92 -0
  96. package/scripts/Handlers/ErrorHandler.js +176 -0
  97. package/scripts/Handlers/MessageHandler.js +115 -0
  98. package/scripts/Handlers/MonitoringViewHandler.js +199 -0
  99. package/scripts/Handlers/RoutingHandler.js +364 -0
  100. package/scripts/Handlers/WinJSHandlers.js +265 -0
  101. package/scripts/MonitoringViewContext.js +75 -0
  102. package/scripts/Services/AzureInsightsService.js +162 -0
  103. package/scripts/Services/AzureResourceManagerService.js +869 -0
  104. package/scripts/Services/BaseService.js +232 -0
  105. package/scripts/Services/DataFactoryService.js +204 -0
  106. package/scripts/Services/HDInsightArmService.js +59 -0
  107. package/scripts/ViewContext.js +9 -0
  108. package/stylesheets/main.css +1042 -0
  109. package/views/Edit/DateTimeFilterViewModel.js +211 -0
  110. package/views/Edit/FilterViewModel.js +131 -0
  111. package/views/Shared/ProvisioningState.js +11 -0
@@ -0,0 +1,1064 @@
1
+ /// <reference path="../../../Definitions/knockout.d.ts" />
2
+ /// <reference path="../../../Definitions/jquery.d.ts" />
3
+ /// <reference path="../../../Definitions/Html5.d.ts" />
4
+ /// <reference path="../../../Definitions/knockout.extensionstypes.d.ts" />
5
+ var __extends =
6
+ this.__extends ||
7
+ function (d, b) {
8
+ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
9
+ function __() {
10
+ this.constructor = d;
11
+ }
12
+ __.prototype = b.prototype;
13
+ d.prototype = new __();
14
+ };
15
+ define(["require", "exports", "./Image"], function (require, exports, Image) {
16
+ var Main;
17
+ (function (Main) {
18
+ "use strict";
19
+ var global = window,
20
+ $ = jQuery,
21
+ koArrayEditFixupTokenPropertyName =
22
+ "###knockoutArrayEditFixupTokenPropertyName###";
23
+ /**
24
+ * Stores the Knockout bindingContext private variable (in normal and minified forms).
25
+ */
26
+ Main._koBindingContext = ko["bindingContext"] || ko["N"];
27
+ if (!Main._koBindingContext) {
28
+ throw new Error("Unable to find Knockout bindingContext variable.");
29
+ }
30
+ /**
31
+ * Stores the Knockout dependencyDetection private variable (in normal and minified forms).
32
+ */
33
+ var _koDependencyDetection = ko["dependencyDetection"] || ko["k"];
34
+ if (!_koDependencyDetection) {
35
+ throw new Error("Unable to find Knockout dependencyDetection variable.");
36
+ }
37
+ /**
38
+ * Stores the Knockout dependencyDetection private variable (in normal and minified forms).
39
+ */
40
+ Main._koDependencyDetectionIgnore =
41
+ _koDependencyDetection["ignore"] || _koDependencyDetection["B"];
42
+ if (!Main._koDependencyDetectionIgnore) {
43
+ throw new Error("Unable to find dependencyDetection.ignore variable.");
44
+ }
45
+ /**
46
+ * Stores the Knockout utils cloneNodes private variable (in normal and minified forms).
47
+ */
48
+ var _koCloneNodes = ko.utils["cloneNodes"] || ko.utils["ia"];
49
+ if (!_koCloneNodes) {
50
+ throw new Error("Unable to find Knockout cloneNodes variable.");
51
+ }
52
+ /**
53
+ * Simplified command binding.
54
+ * Enables binding command viewmodel directly to button or anchor with a single binding:
55
+ * <button data-bind="azcCommand: commandViewModel">
56
+ */
57
+ ko.bindingHandlers["azcCommand"] = {
58
+ init: function (
59
+ element,
60
+ valueAccessor,
61
+ allBindingsAccessor,
62
+ viewModel,
63
+ bindingContext
64
+ ) {
65
+ var value = ko.utils.unwrapObservable(valueAccessor());
66
+ if (
67
+ !value ||
68
+ !value.text ||
69
+ !value.visible ||
70
+ !value.disabled ||
71
+ !value.handler ||
72
+ !value.execute
73
+ ) {
74
+ throw new Error(
75
+ "Command binding must be bound to viewmodel that implements Viva.Controls.Command.Contract"
76
+ );
77
+ }
78
+ if (ko.bindingHandlers.text.init) {
79
+ ko.bindingHandlers.text.init(
80
+ element,
81
+ function () {
82
+ return value.text;
83
+ },
84
+ allBindingsAccessor,
85
+ viewModel,
86
+ bindingContext
87
+ );
88
+ }
89
+ if (ko.bindingHandlers.value.init) {
90
+ ko.bindingHandlers.value.init(
91
+ element,
92
+ function () {
93
+ return value.text;
94
+ },
95
+ allBindingsAccessor,
96
+ viewModel,
97
+ bindingContext
98
+ );
99
+ }
100
+ if (ko.bindingHandlers.visible.init) {
101
+ ko.bindingHandlers.visible.init(
102
+ element,
103
+ function () {
104
+ return value.visible;
105
+ },
106
+ allBindingsAccessor,
107
+ viewModel,
108
+ bindingContext
109
+ );
110
+ }
111
+ if (ko.bindingHandlers.disable.init) {
112
+ ko.bindingHandlers.disable.init(
113
+ element,
114
+ function () {
115
+ var disabled = value.disabled(),
116
+ handler = value.handler(),
117
+ canExecute = handler ? handler.canExecute() : false,
118
+ disable = disabled || !canExecute;
119
+ if (element) {
120
+ $(element).toggleClass("azc-command-disabled", disable);
121
+ }
122
+ return disable;
123
+ },
124
+ allBindingsAccessor,
125
+ viewModel,
126
+ bindingContext
127
+ );
128
+ }
129
+ if (ko.bindingHandlers.click.init) {
130
+ ko.bindingHandlers.click.init(
131
+ element,
132
+ function () {
133
+ return function () {
134
+ var handler = value.handler();
135
+ if (handler && !value.disabled() && handler.canExecute()) {
136
+ value.execute();
137
+ }
138
+ };
139
+ },
140
+ allBindingsAccessor,
141
+ viewModel,
142
+ bindingContext
143
+ );
144
+ }
145
+ },
146
+ update: function (
147
+ element,
148
+ valueAccessor,
149
+ allBindingsAccessor,
150
+ viewModel,
151
+ bindingContext
152
+ ) {
153
+ var value = ko.utils.unwrapObservable(valueAccessor());
154
+ if (ko.bindingHandlers.text.update) {
155
+ ko.bindingHandlers.text.update(
156
+ element,
157
+ function () {
158
+ return value.text;
159
+ },
160
+ allBindingsAccessor,
161
+ viewModel,
162
+ bindingContext
163
+ );
164
+ }
165
+ if (ko.bindingHandlers.value.update) {
166
+ ko.bindingHandlers.value.update(
167
+ element,
168
+ function () {
169
+ return value.text;
170
+ },
171
+ allBindingsAccessor,
172
+ viewModel,
173
+ bindingContext
174
+ );
175
+ }
176
+ if (ko.bindingHandlers.visible.update) {
177
+ ko.bindingHandlers.visible.update(
178
+ element,
179
+ function () {
180
+ return value.visible;
181
+ },
182
+ allBindingsAccessor,
183
+ viewModel,
184
+ bindingContext
185
+ );
186
+ }
187
+ if (ko.bindingHandlers.disable.update) {
188
+ ko.bindingHandlers.disable.update(
189
+ element,
190
+ function () {
191
+ var disabled = value.disabled(),
192
+ handler = value.handler(),
193
+ canExecute = handler ? handler.canExecute() : false,
194
+ disable = disabled || !canExecute;
195
+ if (element) {
196
+ $(element).toggleClass("azc-command-disabled", disable);
197
+ }
198
+ return disable;
199
+ },
200
+ allBindingsAccessor,
201
+ viewModel,
202
+ bindingContext
203
+ );
204
+ }
205
+ if (ko.bindingHandlers.click.update) {
206
+ ko.bindingHandlers.click.update(
207
+ element,
208
+ function () {
209
+ return function () {
210
+ var handler = value.handler();
211
+ if (handler && !value.disabled() && handler.canExecute()) {
212
+ value.execute();
213
+ }
214
+ };
215
+ },
216
+ allBindingsAccessor,
217
+ viewModel,
218
+ bindingContext
219
+ );
220
+ }
221
+ },
222
+ };
223
+ /**
224
+ * Allows to stop binding of descendants.
225
+ */
226
+ ko.bindingHandlers["stopBindings"] = {
227
+ init: function (element, valueAccessor, allBindingsAccessor, viewModel) {
228
+ var value = ko.utils.unwrapObservable(valueAccessor());
229
+ return { controlsDescendantBindings: value };
230
+ },
231
+ };
232
+ /**
233
+ * Allows HTML binding to continue binding of descendants.
234
+ */
235
+ ko.bindingHandlers["htmlBinding"] = {
236
+ init: function () {
237
+ // Allow html binding to be made
238
+ return { controlsDescendantBindings: true };
239
+ },
240
+ update: function (
241
+ element,
242
+ valueAccessor,
243
+ allBindingsAccessor,
244
+ viewModel,
245
+ bindingContext
246
+ ) {
247
+ var value = ko.utils.unwrapObservable(valueAccessor());
248
+ ko.utils.ignoreDependencies(function () {
249
+ ko.utils.cleanDescendantNodes(element);
250
+ ko.utils.setHtml(element, value);
251
+ ko.applyBindingsToDescendants(bindingContext, element);
252
+ });
253
+ },
254
+ };
255
+ /**
256
+ * Creates a private template, so that descendants are not allowed to reach the $parent.
257
+ * A new $root is created for descendants, making descendants isolated.
258
+ * TODO jsgoupil: Look into calling ko.applyBindingsToNode instead (per stevesa)
259
+ */
260
+ ko.bindingHandlers["privateTemplate"] = {
261
+ createBindingContext: function (bindingContext) {
262
+ var privateBindingContext = new Main._koBindingContext(
263
+ bindingContext.$data
264
+ );
265
+ privateBindingContext["createChildContext"] = function (
266
+ dataItem,
267
+ dataItemAlias
268
+ ) {
269
+ return new Main._koBindingContext(dataItem, null, dataItemAlias);
270
+ };
271
+ return privateBindingContext;
272
+ },
273
+ init: function (
274
+ element,
275
+ valueAccessor,
276
+ allBindingsAccessor,
277
+ viewModel,
278
+ bindingContext
279
+ ) {
280
+ return ko.bindingHandlers["template"]["init"](
281
+ element,
282
+ valueAccessor,
283
+ allBindingsAccessor,
284
+ viewModel,
285
+ ko.bindingHandlers["privateTemplate"]["createBindingContext"](
286
+ bindingContext
287
+ )
288
+ );
289
+ },
290
+ update: function (
291
+ element,
292
+ valueAccessor,
293
+ allBindingsAccessor,
294
+ viewModel,
295
+ bindingContext
296
+ ) {
297
+ return ko.bindingHandlers["template"]["update"](
298
+ element,
299
+ valueAccessor,
300
+ allBindingsAccessor,
301
+ viewModel,
302
+ ko.bindingHandlers["privateTemplate"]["createBindingContext"](
303
+ bindingContext
304
+ )
305
+ );
306
+ },
307
+ };
308
+ /**
309
+ * An observable map/dictionary. When you add or remove key value pairs, it notifies subscribers.
310
+ * Can be used in computeds and like any other observable except that you use .latch() to read the map
311
+ * and put, remove, and clear to mutate the map.
312
+ */
313
+ var ObservableMap = (function () {
314
+ function ObservableMap() {
315
+ /**
316
+ * Actual string map that stores the values.
317
+ */
318
+ this._modifyMap = {};
319
+ /**
320
+ * Maps, dependent on this one.
321
+ */
322
+ this._dependantMaps = [];
323
+ /**
324
+ * The internal workings of observable map. We name it without _ so Ibiza will synchronize the observables
325
+ * across the iframe.
326
+ */
327
+ this.observable = ko.observable({});
328
+ this._isInModifyBlock = false;
329
+ }
330
+ /**
331
+ * See interface.
332
+ */
333
+ ObservableMap.prototype.put = function (key, value) {
334
+ var _this = this;
335
+ this._validateKey(key);
336
+ this.modify(function () {
337
+ _this._modifyMap[key] = value;
338
+ _this._dependantMaps.forEach(function (dependantMap) {
339
+ dependantMap._putNotification(key, value);
340
+ });
341
+ });
342
+ };
343
+ /**
344
+ * See interface.
345
+ */
346
+ ObservableMap.prototype.lookup = function (key) {
347
+ return this._modifyMap[key];
348
+ };
349
+ /**
350
+ * See interface.
351
+ */
352
+ ObservableMap.prototype.modify = function (callback) {
353
+ var _this = this;
354
+ var shouldNotifyKnockout = false,
355
+ modifyChain = [],
356
+ currentDependantIndex = 0,
357
+ oldMap;
358
+ if (!this._isInModifyBlock) {
359
+ shouldNotifyKnockout = true;
360
+ this._isInModifyBlock = true;
361
+ // Clone the existing map, as Ibiza doesn't allow us to mutate objects being proxied
362
+ // in observables.
363
+ this._modifyMap = {};
364
+ oldMap = this.observable();
365
+ for (var key in oldMap) {
366
+ this._modifyMap[key] = oldMap[key];
367
+ }
368
+ for (
369
+ currentDependantIndex = 0;
370
+ currentDependantIndex < this._dependantMaps.length;
371
+ currentDependantIndex++
372
+ ) {
373
+ // We want to capture currentDependantIndex by value, not reference. To do this,
374
+ // push it onto the stack and reference the copy.
375
+ var createIndexClosure = function (index) {
376
+ modifyChain.push(function () {
377
+ _this._dependantMaps[index].modify.apply(
378
+ _this._dependantMaps[index],
379
+ [modifyChain[index + 1]]
380
+ );
381
+ });
382
+ };
383
+ createIndexClosure(currentDependantIndex);
384
+ }
385
+ }
386
+ try {
387
+ modifyChain.push(callback);
388
+ modifyChain[0]();
389
+ } finally {
390
+ if (shouldNotifyKnockout) {
391
+ this._isInModifyBlock = false;
392
+ this.observable(this._modifyMap);
393
+ }
394
+ }
395
+ };
396
+ /**
397
+ * See interface.
398
+ */
399
+ ObservableMap.prototype.latch = function () {
400
+ return this.observable();
401
+ };
402
+ /**
403
+ * See interface.
404
+ */
405
+ ObservableMap.prototype.clear = function () {
406
+ var _this = this;
407
+ this.modify(function () {
408
+ _this._modifyMap = {};
409
+ _this._dependantMaps.forEach(function (dependantMap) {
410
+ dependantMap._clearNotification(_this);
411
+ });
412
+ });
413
+ };
414
+ Object.defineProperty(ObservableMap.prototype, "count", {
415
+ /**
416
+ * See interface.
417
+ */
418
+ get: function () {
419
+ // Things in Object.prototype don't appear in keys (they aren't enumerable), so we can call keys directly
420
+ return Object.keys(this.observable()).length;
421
+ },
422
+ enumerable: true,
423
+ configurable: true,
424
+ });
425
+ /**
426
+ * See interface.
427
+ */
428
+ ObservableMap.prototype.remove = function (key) {
429
+ var _this = this;
430
+ this._validateKey(key);
431
+ if (!(key in this.observable())) {
432
+ throw new Error(
433
+ "Key " +
434
+ key +
435
+ " not found in observable map when trying to remove it."
436
+ );
437
+ }
438
+ this.modify(function () {
439
+ delete _this._modifyMap[key];
440
+ _this._dependantMaps.forEach(function (dependantMap) {
441
+ dependantMap._removeNotification(key);
442
+ });
443
+ });
444
+ };
445
+ /**
446
+ * See interface.
447
+ */
448
+ ObservableMap.prototype.forEach = function (callback) {
449
+ for (var key in this.observable()) {
450
+ callback(this.observable()[key], key);
451
+ }
452
+ };
453
+ /**
454
+ * See interface.
455
+ */
456
+ ObservableMap.prototype.some = function (callbackfn) {
457
+ for (var key in this.observable()) {
458
+ if (callbackfn(this.observable()[key], key)) {
459
+ return true;
460
+ }
461
+ }
462
+ return false;
463
+ };
464
+ /**
465
+ * See interface.
466
+ */
467
+ ObservableMap.prototype.every = function (callbackfn) {
468
+ for (var key in this.observable()) {
469
+ if (!callbackfn(this.observable()[key], key)) {
470
+ return false;
471
+ }
472
+ }
473
+ return true;
474
+ };
475
+ /**
476
+ * See interface.
477
+ */
478
+ ObservableMap.prototype.toArray = function () {
479
+ var result = new Array();
480
+ this.forEach(function (element) {
481
+ result.push(element);
482
+ });
483
+ return result;
484
+ };
485
+ /**
486
+ * See interface.
487
+ */
488
+ ObservableMap.prototype.dispose = function () {};
489
+ /**
490
+ * See interface.
491
+ */
492
+ ObservableMap.prototype.subscribe = function (
493
+ lifetimeManager,
494
+ callback,
495
+ target,
496
+ topic
497
+ ) {
498
+ // The Knockout implementation in the Viva test doesn't yet support lifetime managers, so we explicitly do this using the deprecated subscribe API.
499
+ var subscription;
500
+ subscription = this.observable.subscribe(callback, target, topic);
501
+ lifetimeManager.registerForDispose(subscription);
502
+ return subscription;
503
+ };
504
+ /**
505
+ * See interface.
506
+ */
507
+ ObservableMap.prototype.map = function (lifetimeManager, transform) {
508
+ return new ObservableMapProjection(lifetimeManager, this, transform);
509
+ };
510
+ /**
511
+ * Adds a map as a dependant. Whenever the user adds or removes a key, this change gets reflected
512
+ * in all dependant maps.
513
+ *
514
+ * @param map The map that depends on us. Generic parameter is any instead of T because projections are generally a different type.
515
+ */
516
+ ObservableMap.prototype._addDependantMap = function (map) {
517
+ this._dependantMaps.push(map);
518
+ };
519
+ /**
520
+ * Removes a dependant observable map. The map will no longer receive updates from this map.
521
+ *
522
+ * @param map The map to remove as a dependancy. Generic parameter is any instead of T because projections are generally a different type.
523
+ */
524
+ ObservableMap.prototype._removeDependantMap = function (map) {
525
+ var newDependantMaps = [];
526
+ for (var i = 0; i < this._dependantMaps.length; i++) {
527
+ if (this._dependantMaps[i] !== map) {
528
+ newDependantMaps.push(this._dependantMaps[i]);
529
+ }
530
+ }
531
+ this._dependantMaps = newDependantMaps;
532
+ };
533
+ /**
534
+ * Called when an an upstream map adds a key value pair.
535
+ *
536
+ * @param key The added key.
537
+ * @param value The added value. Type is any because projections may have a different type than the parent map.
538
+ */
539
+ ObservableMap.prototype._putNotification = function (key, value) {};
540
+ /**
541
+ * Called when an upstream map removes a key.
542
+ *
543
+ * @param key The key removed.
544
+ */
545
+ ObservableMap.prototype._removeNotification = function (key) {};
546
+ /**
547
+ * Called when an upstream map removes all keys
548
+ *
549
+ * @param map The map being cleared.
550
+ */
551
+ ObservableMap.prototype._clearNotification = function (map) {};
552
+ ObservableMap.prototype._validateKey = function (key) {
553
+ for (var property in Object.prototype) {
554
+ if (property === key) {
555
+ throw new Error(
556
+ key +
557
+ " is a reserved key and thus you cannot add or remove it from observable maps."
558
+ );
559
+ }
560
+ }
561
+ };
562
+ return ObservableMap;
563
+ })();
564
+ Main.ObservableMap = ObservableMap;
565
+ /**
566
+ * A projection of an observable map. Whenever a key/value pair gets added to the base map,
567
+ * a transformed object with the same key gets added to the projection. Removing from or clearing
568
+ * the base map reflects in the projection as well.
569
+ * Map.project is an easier was to create these.
570
+ */
571
+ var ObservableMapProjection = (function (_super) {
572
+ __extends(ObservableMapProjection, _super);
573
+ function ObservableMapProjection(lifetimeManager, map, transform) {
574
+ var _this = this;
575
+ _super.call(this);
576
+ this._map = map;
577
+ this._transform = transform;
578
+ map._addDependantMap(this);
579
+ lifetimeManager.registerForDispose(this);
580
+ this.modify(function () {
581
+ map.forEach(function (value, key) {
582
+ _super.prototype.put.call(_this, key, _this._transform(value));
583
+ });
584
+ });
585
+ }
586
+ /**
587
+ * See parent.
588
+ */
589
+ ObservableMapProjection.prototype.dispose = function () {
590
+ this._map._removeDependantMap(this);
591
+ };
592
+ /**
593
+ * Projections are immutable. Throws an exception.
594
+ */
595
+ ObservableMapProjection.prototype.put = function (key, value) {
596
+ throw new Error("Can't put entries in projections.");
597
+ };
598
+ /**
599
+ * Projections are immutable. Throws an exception.
600
+ */
601
+ ObservableMapProjection.prototype.remove = function (key) {
602
+ throw new Error("Can't remove entries from projections.");
603
+ };
604
+ /**
605
+ * Projections are immutable. Throws an exceptions.
606
+ */
607
+ ObservableMapProjection.prototype.clear = function () {
608
+ throw new Error("Can't clear observable map projections.");
609
+ };
610
+ /**
611
+ * See parent.
612
+ */
613
+ ObservableMapProjection.prototype._putNotification = function (
614
+ key,
615
+ value
616
+ ) {
617
+ // Our parent observable map already called modify, so we just need to put the thing in the map.
618
+ var oldValue = this.latch()[key];
619
+ if (oldValue && oldValue["dispose"]) {
620
+ oldValue["dispose"]();
621
+ }
622
+ _super.prototype.put.call(this, key, this._transform(value));
623
+ };
624
+ /**
625
+ * See parent.
626
+ */
627
+ ObservableMapProjection.prototype._removeNotification = function (key) {
628
+ var oldValue = this.latch()[key];
629
+ if (oldValue && oldValue["dispose"]) {
630
+ oldValue["dispose"]();
631
+ }
632
+ _super.prototype.remove.call(this, key);
633
+ };
634
+ /**
635
+ * See parent.
636
+ */
637
+ ObservableMapProjection.prototype._clearNotification = function (map) {
638
+ this.forEach(function (item) {
639
+ if (typeof item.dispose === "function") {
640
+ item.dispose();
641
+ }
642
+ });
643
+ _super.prototype.clear.call(this);
644
+ };
645
+ return ObservableMapProjection;
646
+ })(ObservableMap);
647
+ Main.ObservableMapProjection = ObservableMapProjection;
648
+ /**
649
+ * Contains the union of key/value pairs on any number of other maps.
650
+ */
651
+ var ObservableMapUnion = (function (_super) {
652
+ __extends(ObservableMapUnion, _super);
653
+ function ObservableMapUnion(lifetimeManager) {
654
+ var _this = this;
655
+ var maps = [];
656
+ for (var _i = 1; _i < arguments.length; _i++) {
657
+ maps[_i - 1] = arguments[_i];
658
+ }
659
+ _super.call(this);
660
+ this._maps = maps;
661
+ lifetimeManager.registerForDispose(this);
662
+ maps.forEach(function (map) {
663
+ map._addDependantMap(_this);
664
+ _this.modify(function () {
665
+ map.forEach(function (value, key) {
666
+ _super.prototype.put.call(_this, key, value);
667
+ });
668
+ });
669
+ });
670
+ }
671
+ /**
672
+ * See interface.
673
+ */
674
+ ObservableMapUnion.prototype.dispose = function () {
675
+ var _this = this;
676
+ this._maps.forEach(function (map) {
677
+ map._removeDependantMap(_this);
678
+ });
679
+ };
680
+ /**
681
+ * Unions are immutable. Throws an exceptions.
682
+ */
683
+ ObservableMapUnion.prototype.put = function (key, value) {
684
+ throw new Error("Can't put entries in projections.");
685
+ };
686
+ /**
687
+ * Unions are immutable. Throws an exceptions.
688
+ */
689
+ ObservableMapUnion.prototype.remove = function (key) {
690
+ throw new Error("Can't remove entries from projections.");
691
+ };
692
+ /**
693
+ * Unions are immutable. Throws an exceptions.
694
+ */
695
+ ObservableMapUnion.prototype.clear = function () {
696
+ throw new Error("Can't clear observable map projections.");
697
+ };
698
+ /**
699
+ * See parent.
700
+ */
701
+ ObservableMapUnion.prototype._putNotification = function (key, value) {
702
+ _super.prototype.put.call(this, key, value);
703
+ };
704
+ /**
705
+ * See parent.
706
+ */
707
+ ObservableMapUnion.prototype._removeNotification = function (key) {
708
+ _super.prototype.remove.call(this, key);
709
+ };
710
+ /**
711
+ * See parent.
712
+ */
713
+ ObservableMapUnion.prototype._clearNotification = function (map) {
714
+ // when we get _clearNotification from one of the maps in the union we only need to clear elements that are coming from that map.
715
+ // the approach we use here - delete all elements and re-add all elements that are currently here.
716
+ var _this = this;
717
+ this._modifyMap = {};
718
+ this._maps.forEach(function (mapInUnion) {
719
+ if (mapInUnion !== map) {
720
+ mapInUnion.forEach(function (value, key) {
721
+ _super.prototype.put.call(_this, key, value);
722
+ });
723
+ }
724
+ });
725
+ this._dependantMaps.forEach(function (dependantMap) {
726
+ dependantMap._clearNotification(_this);
727
+ });
728
+ };
729
+ return ObservableMapUnion;
730
+ })(ObservableMap);
731
+ Main.ObservableMapUnion = ObservableMapUnion;
732
+ /**
733
+ * iannight: Taken from 5.0.302.391
734
+ *
735
+ * Analogous the foreach binding, mapForEach will take either an ObservableMap or a
736
+ * { data: ObservableMap, afterRender: () => void, optimizeRendering: bool } type.
737
+ * If optimizeRendering is true (strongly recommended), it only builds the DOM for added or removed items instead of rebuilding all items.
738
+ */
739
+ ko.bindingHandlers["mapForEach"] = {
740
+ a: function (valueAccessor) {
741
+ return function () {
742
+ var afterRender = undefined,
743
+ map,
744
+ optimizeRendering;
745
+ if (valueAccessor() instanceof ObservableMap) {
746
+ map = valueAccessor();
747
+ optimizeRendering = true; // iannight: made this opt out
748
+ } else {
749
+ map = valueAccessor().data;
750
+ afterRender = valueAccessor().afterRender;
751
+ optimizeRendering = !(valueAccessor().optimizeRendering === false); // iannight: made this opt out
752
+ }
753
+ // Convert the map to an array so we can use Knockout's foreach binding which is optimized.
754
+ var mapArray = map.toArray();
755
+ return {
756
+ m: map,
757
+ foreach: mapArray,
758
+ afterRender: afterRender,
759
+ o: optimizeRendering,
760
+ };
761
+ };
762
+ },
763
+ init: function (
764
+ element,
765
+ valueAccessor,
766
+ allBindingsAccessor,
767
+ viewModel,
768
+ bindingContext
769
+ ) {
770
+ var accessor = ko.bindingHandlers["mapForEach"].a(valueAccessor);
771
+ if (accessor().o === true) {
772
+ return ko.bindingHandlers.template.init(
773
+ element,
774
+ accessor,
775
+ allBindingsAccessor,
776
+ viewModel,
777
+ bindingContext
778
+ );
779
+ }
780
+ var childNodes = [],
781
+ allChildren = [];
782
+ allChildren = ko.virtualElements.childNodes(element);
783
+ ko.virtualElements.emptyNode(element);
784
+ allChildren.forEach(function (node) {
785
+ // Only append comment or element nodes
786
+ var nodeType = node.nodeType;
787
+ if (nodeType === 1 || nodeType === 8) {
788
+ childNodes.push(node);
789
+ }
790
+ });
791
+ element["__mapForEachTemplate"] = childNodes;
792
+ return { controlsDescendantBindings: true };
793
+ },
794
+ update: function (
795
+ element,
796
+ valueAccessor,
797
+ allBindingsAccessor,
798
+ viewModel,
799
+ bindingContext
800
+ ) {
801
+ var accessor = ko.bindingHandlers["mapForEach"].a(valueAccessor);
802
+ if (accessor().o === true) {
803
+ return ko.bindingHandlers.template.update(
804
+ element,
805
+ accessor,
806
+ allBindingsAccessor,
807
+ viewModel,
808
+ bindingContext
809
+ );
810
+ }
811
+ var template = element["__mapForEachTemplate"];
812
+ ko.virtualElements.emptyNode(element);
813
+ // For whatever reason, the virtual DOM API doesn't have append. So we'll implement it ourselves.
814
+ var virtualAppend = function (parent, child) {
815
+ if (ko.virtualElements.firstChild(parent)) {
816
+ var childNodes = ko.virtualElements.childNodes(parent);
817
+ ko.virtualElements.insertAfter(
818
+ parent,
819
+ child,
820
+ childNodes[childNodes.length - 1]
821
+ );
822
+ } else {
823
+ ko.virtualElements.prepend(parent, child);
824
+ }
825
+ };
826
+ // Implicitly subscribe to the map.
827
+ accessor().m.latch();
828
+ accessor().m.forEach(function (value) {
829
+ var elementsForObject = _koCloneNodes(template);
830
+ elementsForObject.forEach(function (childElement) {
831
+ virtualAppend(element, childElement);
832
+ ko.applyBindings(
833
+ bindingContext.createChildContext(value),
834
+ childElement
835
+ );
836
+ });
837
+ });
838
+ // If the user specified afterRender, call it.
839
+ var afterRender = accessor().afterRender;
840
+ if (afterRender) {
841
+ ko.ignoreDependencies(function () {
842
+ afterRender();
843
+ });
844
+ }
845
+ },
846
+ };
847
+ ko.virtualElements.allowedBindings["mapForEach"] = true;
848
+ ko.bindingHandlers["svgImage"] = {
849
+ init: function () {
850
+ return { controlsDescendantBindings: true };
851
+ },
852
+ update: function (element, valueAccessor) {
853
+ var $element = $(element),
854
+ bindingValue = ko.utils.unwrapObservable(valueAccessor()),
855
+ html = "";
856
+ if (!bindingValue) {
857
+ return;
858
+ }
859
+ if (bindingValue.type === 0 /* Blank */) {
860
+ // If there are existing images there, make sure to remove.
861
+ $element.empty();
862
+ } else if (bindingValue.type === 2 /* ImageUri */) {
863
+ // We must use createElementNS in order to create an image element
864
+ // If we use $element.append("<image xlink:href.../ >), jQuery will translate
865
+ // the <image> into <img> which does not work with SVG
866
+ var img = document.createElementNS(
867
+ "http://www.w3.org/2000/svg",
868
+ "image"
869
+ );
870
+ // The height and width are optional. If not specified, the icon will be
871
+ // displayed in the original size.
872
+ if (bindingValue.height) {
873
+ img.setAttributeNS(null, "height", "" + bindingValue.height);
874
+ }
875
+ if (bindingValue.width) {
876
+ img.setAttributeNS(null, "width", "" + bindingValue.width);
877
+ }
878
+ img.setAttributeNS(null, "x", "" + bindingValue.x);
879
+ img.setAttributeNS(null, "y", "" + bindingValue.y);
880
+ img.setAttributeNS(
881
+ "http://www.w3.org/1999/xlink",
882
+ "href",
883
+ bindingValue.data
884
+ );
885
+ $element.empty();
886
+ $element.append(img);
887
+ } else if (bindingValue.data) {
888
+ // All other types will treat data as the svg data if it has data
889
+ var svgElement = $(bindingValue.data);
890
+ // Create an SVG element to wrap the inner SVG element so we can set the
891
+ // height, width and position of the element.
892
+ var svgParent = document.createElementNS(
893
+ "http://www.w3.org/2000/svg",
894
+ "svg"
895
+ );
896
+ // If the width / width are not set, we need to try to figure out the height
897
+ // and width from the svg data element. If the svg data element does not have
898
+ // height and width, we will use the default height and width. Further adjustment
899
+ // can to be done on the element using transforms later.
900
+ if (bindingValue.width) {
901
+ svgParent.setAttributeNS(null, "width", "" + bindingValue.width);
902
+ // Make sure to display child element has the same width as the parent.
903
+ // If not only part of the image will be shown if the width / height of parent is smaller
904
+ // than the child.
905
+ svgElement.attr("width", bindingValue.width);
906
+ } else if (svgElement.attr("width")) {
907
+ svgParent.setAttributeNS(
908
+ null,
909
+ "width",
910
+ "" + svgElement.attr("width")
911
+ );
912
+ }
913
+ if (bindingValue.height) {
914
+ svgParent.setAttributeNS(null, "height", "" + bindingValue.height);
915
+ svgElement.attr("height", bindingValue.height);
916
+ } else if (svgElement.attr("height")) {
917
+ svgParent.setAttributeNS(
918
+ null,
919
+ "height",
920
+ "" + svgElement.attr("height")
921
+ );
922
+ }
923
+ svgParent.setAttribute("x", "" + bindingValue.x);
924
+ svgParent.setAttribute("y", "" + bindingValue.y);
925
+ svgParent.appendChild(svgElement[0]);
926
+ $element.empty();
927
+ $element.append(svgParent);
928
+ } else {
929
+ }
930
+ },
931
+ };
932
+ ko.virtualElements.allowedBindings["svgImage"] = true;
933
+ // More advanced SVG text binding that allow text elements to have <tspan>
934
+ ko.bindingHandlers["svgSpannableText"] = {
935
+ init: function () {
936
+ return { controlsDescendantBindings: true };
937
+ },
938
+ update: function (element, valueAccessor) {
939
+ var $element = $(element),
940
+ bindingValue = ko.utils.unwrapObservable(valueAccessor()),
941
+ domParser = new DOMParser();
942
+ if (bindingValue === null) {
943
+ return;
944
+ }
945
+ // If the element is plain text that does not contain <tspan>
946
+ // We set the text node
947
+ if (bindingValue.indexOf("<tspan") === -1) {
948
+ $element.text(bindingValue);
949
+ return;
950
+ }
951
+ // IE does not have innerHtml on the SVG nodes so we cannot set the innerHtml directly.
952
+ // JQuery is not aware of the namespace of the element because it is basically using a <div>
953
+ // element to parse the string. We have to use DOMParser to parse the string and create
954
+ // the element with SVG namespace.
955
+ var xmlString = "<svg>" + bindingValue + "</svg>",
956
+ doc = domParser.parseFromString(xmlString, "image/svg+xml"),
957
+ nodes = doc.getElementsByTagName("tspan");
958
+ // Make sure to empty the element every time the <text> node is updated.
959
+ $element.empty();
960
+ var tspanElement, node, attribute, i, j;
961
+ for (i = 0; i < nodes.length; i++) {
962
+ node = nodes[i];
963
+ tspanElement = document.createElementNS(
964
+ "http://www.w3.org/2000/svg",
965
+ "tspan"
966
+ );
967
+ for (j = 0; j < node.attributes.length; j++) {
968
+ attribute = node.attributes.item(j);
969
+ tspanElement.setAttribute(attribute.name, attribute.value);
970
+ }
971
+ // Lastly we can directly set the text content
972
+ tspanElement.textContent = node.textContent;
973
+ // Append the <tspan> to the top level <text> element
974
+ $element.append(tspanElement);
975
+ }
976
+ },
977
+ };
978
+ ko.virtualElements.allowedBindings["svgSpannableText"] = true;
979
+ ko.utils.fixupArrayEdits = function (edits) {
980
+ if (edits) {
981
+ if (edits[koArrayEditFixupTokenPropertyName]) {
982
+ throw new Error("Knockout array edits have already been fixed up.");
983
+ }
984
+ edits[koArrayEditFixupTokenPropertyName] =
985
+ koArrayEditFixupTokenPropertyName;
986
+ var offset = 0;
987
+ edits.forEach(function (e) {
988
+ switch (e.status) {
989
+ case "added":
990
+ offset++;
991
+ break;
992
+ case "deleted":
993
+ e.index += offset;
994
+ offset--;
995
+ break;
996
+ }
997
+ });
998
+ }
999
+ return edits;
1000
+ };
1001
+ ko.utils.applyArrayEdits = function (target, edits, mapFunc) {
1002
+ if (edits) {
1003
+ if (!mapFunc) {
1004
+ mapFunc = function (value) {
1005
+ return value;
1006
+ };
1007
+ }
1008
+ edits.forEach(function (c) {
1009
+ switch (c.status) {
1010
+ case "added":
1011
+ target.splice(c.index, 0, mapFunc(c.value));
1012
+ break;
1013
+ case "deleted":
1014
+ target.splice(c.index, 1);
1015
+ break;
1016
+ }
1017
+ });
1018
+ }
1019
+ };
1020
+ /**
1021
+ * Cleans knockout properties and disposables from descendents of the specified node
1022
+ * without cleaning the node itself.
1023
+ *
1024
+ * @param node The root node to start from.
1025
+ */
1026
+ ko.utils.cleanDescendantNodes = function (node) {
1027
+ $(node)
1028
+ .contents()
1029
+ .toArray()
1030
+ .forEach(function (node) {
1031
+ ko.cleanNode(node);
1032
+ });
1033
+ };
1034
+ /**
1035
+ * Ignores all dependent observables that are accessed in the callback.
1036
+ *
1037
+ * @param callback The function to execute.
1038
+ */
1039
+ ko.utils.ignoreDependencies = function (callback) {
1040
+ var ignore = ko.computed({ read: callback, deferEvaluation: true });
1041
+ try {
1042
+ ignore();
1043
+ } finally {
1044
+ ignore.dispose();
1045
+ }
1046
+ };
1047
+ /**
1048
+ * Encodes the input into a string that has none of these characters: <>&.
1049
+ *
1050
+ * @param value Input to encode.
1051
+ * @return Encoded HTML.
1052
+ */
1053
+ function htmlEncode(value) {
1054
+ return value === null || value === undefined
1055
+ ? ""
1056
+ : (value + "")
1057
+ .replace(/&/g, "&amp;")
1058
+ .replace(/</g, "&lt;")
1059
+ .replace(/>/g, "&gt;");
1060
+ }
1061
+ Main.htmlEncode = htmlEncode;
1062
+ })(Main || (Main = {}));
1063
+ return Main;
1064
+ });