@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,905 @@
1
+ /// <reference path="../../Definitions/knockout.extensionstypes.d.ts" />
2
+ define(["require", "exports", "./Detection", "./Util.Private"], function (
3
+ require,
4
+ exports,
5
+ Detection,
6
+ azcPrivate
7
+ ) {
8
+ var Main;
9
+ (function (Main) {
10
+ "use strict";
11
+ var global = window,
12
+ checkObjectSetting = function (object, settingString) {
13
+ var nameSpaces = settingString.split("."),
14
+ currentObject = object;
15
+ for (var i = 0; i < nameSpaces.length; i++) {
16
+ currentObject = currentObject[nameSpaces[i]];
17
+ if (currentObject === undefined) {
18
+ break;
19
+ }
20
+ }
21
+ return !!currentObject;
22
+ },
23
+ devMode = checkObjectSetting(global, "fx.environment.isDevelopmentMode"),
24
+ $ = jQuery,
25
+ hexValues = [
26
+ "0",
27
+ "1",
28
+ "2",
29
+ "3",
30
+ "4",
31
+ "5",
32
+ "6",
33
+ "7",
34
+ "8",
35
+ "9",
36
+ "A",
37
+ "B",
38
+ "C",
39
+ "D",
40
+ "E",
41
+ "F",
42
+ ];
43
+ Main.blankGif =
44
+ "data:image/gif;base64,R0lGODlhAQABAJEAAAAAAP///////wAAACH5BAEAAAIALAAAAAABAAEAAAICVAEAOw==";
45
+ var Constants = (function () {
46
+ function Constants() {}
47
+ /**
48
+ * Declares the elements which can be focused on.
49
+ * We expect when an element declares a "data-canfocus" attribute, the HTMLElement has a property called "data-canfocus" which has a "setFocus(): boolean" function callback.
50
+ * That is, element["data-canfocus"] = () => boolean.
51
+ */
52
+ Constants.dataCanFocusAttribute = "data-canfocus";
53
+ /**
54
+ * Declares the elements that should get the focus first of all the data-canfocus.
55
+ */
56
+ Constants.dataFocusFirstAttribute = "data-focus-first";
57
+ /**
58
+ * Declares the elements that are also editable in addition to data-canfocus. For example, Grid.EditableRowExtension prefers data-editable over non-editable.
59
+ */
60
+ Constants.dataEditableAttribute = "data-editable";
61
+ /**
62
+ * Declares the elements that are controls, such that when user click on an element of a control, we will search for the owning control (with data-control attribute.) to set the focus.
63
+ */
64
+ Constants.dataControlAttribute = "data-control";
65
+ /**
66
+ * Declares the elements that can be activatable. For example, GridActivatableRowExtension use this as indicator for activate a column.
67
+ */
68
+ Constants.dataActivatableAttribute = "data-activatable";
69
+ /**
70
+ * Declares the elements activate additional info to pass to the ActivatedRowSelection.
71
+ */
72
+ Constants.dataActivateInfoAttribute = "data-activate-info";
73
+ return Constants;
74
+ })();
75
+ Main.Constants = Constants;
76
+ // TODO #3412002: Unify Viva.Util and MsPortal.Util
77
+ (function (KeyCode) {
78
+ KeyCode[(KeyCode["Alt"] = 18)] = "Alt";
79
+ KeyCode[(KeyCode["Backslash"] = 220)] = "Backslash";
80
+ KeyCode[(KeyCode["Backspace"] = 8)] = "Backspace";
81
+ KeyCode[(KeyCode["Comma"] = 188)] = "Comma";
82
+ KeyCode[(KeyCode["Control"] = 17)] = "Control";
83
+ KeyCode[(KeyCode["Delete"] = 46)] = "Delete";
84
+ KeyCode[(KeyCode["Down"] = 40)] = "Down";
85
+ KeyCode[(KeyCode["End"] = 35)] = "End";
86
+ KeyCode[(KeyCode["Enter"] = 13)] = "Enter";
87
+ KeyCode[
88
+ (KeyCode["Equals"] = Detection.Detection.Browsers.firefox ? 61 : 187)
89
+ ] = "Equals";
90
+ KeyCode[(KeyCode["Escape"] = 27)] = "Escape";
91
+ KeyCode[(KeyCode["F10"] = 121)] = "F10";
92
+ KeyCode[(KeyCode["Home"] = 36)] = "Home";
93
+ KeyCode[(KeyCode["Left"] = 37)] = "Left";
94
+ KeyCode[
95
+ (KeyCode["Minus"] = Detection.Detection.Browsers.firefox ? 173 : 189)
96
+ ] = "Minus";
97
+ KeyCode[(KeyCode["PageDown"] = 34)] = "PageDown";
98
+ KeyCode[(KeyCode["PageUp"] = 33)] = "PageUp";
99
+ KeyCode[(KeyCode["Period"] = 190)] = "Period";
100
+ KeyCode[(KeyCode["Right"] = 39)] = "Right";
101
+ KeyCode[(KeyCode["Shift"] = 16)] = "Shift";
102
+ KeyCode[(KeyCode["Slash"] = 191)] = "Slash";
103
+ KeyCode[(KeyCode["Space"] = 32)] = "Space";
104
+ KeyCode[(KeyCode["Tab"] = 9)] = "Tab";
105
+ KeyCode[(KeyCode["Up"] = 38)] = "Up";
106
+ KeyCode[(KeyCode["A"] = 65)] = "A";
107
+ KeyCode[(KeyCode["B"] = 66)] = "B";
108
+ KeyCode[(KeyCode["C"] = 67)] = "C";
109
+ KeyCode[(KeyCode["D"] = 68)] = "D";
110
+ KeyCode[(KeyCode["E"] = 69)] = "E";
111
+ KeyCode[(KeyCode["F"] = 70)] = "F";
112
+ KeyCode[(KeyCode["G"] = 71)] = "G";
113
+ KeyCode[(KeyCode["H"] = 72)] = "H";
114
+ KeyCode[(KeyCode["I"] = 73)] = "I";
115
+ KeyCode[(KeyCode["J"] = 74)] = "J";
116
+ KeyCode[(KeyCode["K"] = 75)] = "K";
117
+ KeyCode[(KeyCode["L"] = 76)] = "L";
118
+ KeyCode[(KeyCode["M"] = 77)] = "M";
119
+ KeyCode[(KeyCode["N"] = 78)] = "N";
120
+ KeyCode[(KeyCode["O"] = 79)] = "O";
121
+ KeyCode[(KeyCode["P"] = 80)] = "P";
122
+ KeyCode[(KeyCode["Q"] = 81)] = "Q";
123
+ KeyCode[(KeyCode["R"] = 82)] = "R";
124
+ KeyCode[(KeyCode["S"] = 83)] = "S";
125
+ KeyCode[(KeyCode["T"] = 84)] = "T";
126
+ KeyCode[(KeyCode["U"] = 85)] = "U";
127
+ KeyCode[(KeyCode["V"] = 86)] = "V";
128
+ KeyCode[(KeyCode["W"] = 87)] = "W";
129
+ KeyCode[(KeyCode["X"] = 88)] = "X";
130
+ KeyCode[(KeyCode["Y"] = 89)] = "Y";
131
+ KeyCode[(KeyCode["Z"] = 90)] = "Z";
132
+ KeyCode[(KeyCode["Num0"] = 48)] = "Num0";
133
+ KeyCode[(KeyCode["Num1"] = 49)] = "Num1";
134
+ KeyCode[(KeyCode["Num2"] = 50)] = "Num2";
135
+ KeyCode[(KeyCode["Num3"] = 51)] = "Num3";
136
+ KeyCode[(KeyCode["Num4"] = 52)] = "Num4";
137
+ KeyCode[(KeyCode["Num5"] = 53)] = "Num5";
138
+ KeyCode[(KeyCode["Num6"] = 54)] = "Num6";
139
+ KeyCode[(KeyCode["Num7"] = 55)] = "Num7";
140
+ KeyCode[(KeyCode["Num8"] = 56)] = "Num8";
141
+ KeyCode[(KeyCode["Num9"] = 57)] = "Num9";
142
+ })(Main.KeyCode || (Main.KeyCode = {}));
143
+ var KeyCode = Main.KeyCode;
144
+ (function (MouseButton) {
145
+ MouseButton[(MouseButton["Left"] = 1)] = "Left";
146
+ MouseButton[(MouseButton["Middle"] = 2)] = "Middle";
147
+ MouseButton[(MouseButton["Right"] = 3)] = "Right";
148
+ })(Main.MouseButton || (Main.MouseButton = {}));
149
+ var MouseButton = Main.MouseButton;
150
+ /**
151
+ * Returns a GUID such as xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx.
152
+ *
153
+ * @return New GUID.
154
+ */
155
+ function newGuid() {
156
+ // c.f. rfc4122 (UUID version 4 = xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx)
157
+ var oct = "",
158
+ tmp;
159
+ for (var a = 0; a < 4; a++) {
160
+ tmp = (4294967296 * Math.random()) | 0;
161
+ oct +=
162
+ hexValues[tmp & 0xf] +
163
+ hexValues[(tmp >> 4) & 0xf] +
164
+ hexValues[(tmp >> 8) & 0xf] +
165
+ hexValues[(tmp >> 12) & 0xf] +
166
+ hexValues[(tmp >> 16) & 0xf] +
167
+ hexValues[(tmp >> 20) & 0xf] +
168
+ hexValues[(tmp >> 24) & 0xf] +
169
+ hexValues[(tmp >> 28) & 0xf];
170
+ }
171
+ // "Set the two most significant bits (bits 6 and 7) of the clock_seq_hi_and_reserved to zero and one, respectively"
172
+ var clockSequenceHi = hexValues[(8 + Math.random() * 4) | 0];
173
+ return (
174
+ oct.substr(0, 8) +
175
+ "-" +
176
+ oct.substr(9, 4) +
177
+ "-4" +
178
+ oct.substr(13, 3) +
179
+ "-" +
180
+ clockSequenceHi +
181
+ oct.substr(16, 3) +
182
+ "-" +
183
+ oct.substr(19, 12)
184
+ );
185
+ }
186
+ Main.newGuid = newGuid;
187
+ /**
188
+ * Encodes html attribute string.
189
+ *
190
+ * @param value The string to encode.
191
+ * @return The encoded string.
192
+ */
193
+ function encodeAttribute(value) {
194
+ return encodeHtml(value)
195
+ .replace(/"/g, "&quot;")
196
+ .replace(/'/g, "&apos;")
197
+ .replace(/`/g, "&#96;");
198
+ }
199
+ Main.encodeAttribute = encodeAttribute;
200
+ /**
201
+ * Encodes html string.
202
+ *
203
+ * @param value The string to encode.
204
+ * @return The encoded string.
205
+ */
206
+ function encodeHtml(value) {
207
+ if (!value) {
208
+ return "";
209
+ }
210
+ return value
211
+ .replace(/&/g, "&amp;")
212
+ .replace(/</g, "&lt;")
213
+ .replace(/>/g, "&gt;");
214
+ }
215
+ Main.encodeHtml = encodeHtml;
216
+ /**
217
+ * Joins items in array with delimiter and suffix.
218
+ *
219
+ * @param items The items to join.
220
+ * @param delim The delimiter to go between each item.
221
+ * @param append The suffix to append to each item.
222
+ * @return The joined string.
223
+ */
224
+ function joinAppend(items, delim, append) {
225
+ return items.join(append + delim) + append;
226
+ }
227
+ Main.joinAppend = joinAppend;
228
+ /**
229
+ * Joins items in array with delimiter and prefix.
230
+ *
231
+ * @param items The items to join.
232
+ * @param prepend The prefix to place before each item.
233
+ * @param delim The delimiter to go between each item.
234
+ * @return The joined string.
235
+ */
236
+ function joinPrepend(items, prepend, delim) {
237
+ return prepend + items.join(delim + prepend);
238
+ }
239
+ Main.joinPrepend = joinPrepend;
240
+ /**
241
+ * check object's setting
242
+ *
243
+ * @param object for the settingString to check on. For example, global
244
+ * @param settingString the environmentSetting to check. For example, "fx.environment.isDevelopmentMode"
245
+ *
246
+ * @return if object setting exists and it's trusy.
247
+ */
248
+ function checkSetting(object, settingString) {
249
+ return checkObjectSetting(object, settingString);
250
+ }
251
+ Main.checkSetting = checkSetting;
252
+ /**
253
+ * return the setting for "global.fx.environment.isDevelopmentMode". This return the static setting of the object (load time check.)
254
+ */
255
+ function isDevMode() {
256
+ return devMode;
257
+ }
258
+ Main.isDevMode = isDevMode;
259
+ /**
260
+ * Detect a value is null or undefined.
261
+ *
262
+ * @param value The value to check against null && undefined.
263
+ * @return boolean.
264
+ */
265
+ function isNullOrUndefined(value) {
266
+ return value === null || value === undefined;
267
+ }
268
+ Main.isNullOrUndefined = isNullOrUndefined;
269
+ /**
270
+ * Generates a random integer between min and max inclusive.
271
+ *
272
+ * @param min The minimum integer result.
273
+ * @param max The maximum integer result.
274
+ * @return A random integer.
275
+ */
276
+ function random(min, max) {
277
+ if (min === undefined || max === undefined || min > max) {
278
+ return undefined;
279
+ }
280
+ return Math.floor(Math.random() * (max - min + 1)) + min;
281
+ }
282
+ Main.random = random;
283
+ /**
284
+ * Truncates a number to the integer part.
285
+ *
286
+ * @param value The number to truncate.
287
+ * @return The integer number.
288
+ */
289
+ function truncate(value) {
290
+ // Converts to integer by bit operation
291
+ return value | 0;
292
+ }
293
+ Main.truncate = truncate;
294
+ /**
295
+ * Adds and removes an element to force the narrator to read the section again.
296
+ *
297
+ * @param element DOM element.
298
+ * @param addAriaLive Adds aria-live to polite then restores the previous value.
299
+ */
300
+ function forceScreenRead(element, addAriaLive) {
301
+ var tagName = element.tagName,
302
+ newElementTagName,
303
+ newElement,
304
+ previousAriaLive;
305
+ switch (tagName) {
306
+ case "TABLE":
307
+ // Add one row
308
+ newElementTagName = "tr";
309
+ break;
310
+ case "TR":
311
+ // Add one cell
312
+ newElementTagName = "td";
313
+ break;
314
+ case "UL":
315
+ // Add one list-item
316
+ newElementTagName = "li";
317
+ break;
318
+ default:
319
+ // Add an inline element
320
+ newElementTagName = "span";
321
+ }
322
+ if (addAriaLive) {
323
+ previousAriaLive = element.getAttribute("aria-live");
324
+ element.setAttribute("aria-live", "assertive");
325
+ }
326
+ newElement = document.createElement(newElementTagName);
327
+ element.appendChild(newElement);
328
+ element.removeChild(newElement);
329
+ if (addAriaLive) {
330
+ if (previousAriaLive) {
331
+ element.setAttribute("aria-live", previousAriaLive);
332
+ } else {
333
+ element.removeAttribute("aria-live");
334
+ }
335
+ }
336
+ }
337
+ Main.forceScreenRead = forceScreenRead;
338
+ /**
339
+ * Returns true if the character is a non-written character.
340
+ *
341
+ * @param keyCode KeyCode to verify.
342
+ * @return True if non-written character.
343
+ */
344
+ function isNonWrittenCharacter(keyCode) {
345
+ switch (keyCode) {
346
+ case 18 /* Alt */:
347
+ case 17 /* Control */:
348
+ case 40 /* Down */:
349
+ case 35 /* End */:
350
+ case 27 /* Escape */:
351
+ case 36 /* Home */:
352
+ case 37 /* Left */:
353
+ case 34 /* PageDown */:
354
+ case 33 /* PageUp */:
355
+ case 39 /* Right */:
356
+ case 16 /* Shift */:
357
+ case 9 /* Tab */:
358
+ case 38 /* Up */:
359
+ return true;
360
+ default:
361
+ return false;
362
+ }
363
+ }
364
+ Main.isNonWrittenCharacter = isNonWrittenCharacter;
365
+ /**
366
+ * Shallow copy from a key/value pairs object.
367
+ *
368
+ * @param to An un-typed object to be populated.
369
+ * @param from An un-typed object with values to populate.
370
+ * @param scopes Scoped down the list for shallowCopy
371
+ */
372
+ function shallowCopyFromObject(to, from, scopes) {
373
+ var stringMapTo = to,
374
+ stringMapFrom = from,
375
+ copyFunction = function (key) {
376
+ var value;
377
+ if (stringMapFrom.hasOwnProperty(key)) {
378
+ value = stringMapFrom[key];
379
+ if (value !== undefined) {
380
+ stringMapTo[key] = value;
381
+ }
382
+ }
383
+ },
384
+ actualScopes = scopes || Object.keys(stringMapFrom) || [];
385
+ actualScopes.forEach(copyFunction);
386
+ }
387
+ Main.shallowCopyFromObject = shallowCopyFromObject;
388
+ /**
389
+ * Shallow copy from a key/value pairs object.
390
+ *
391
+ * @param to An un-typed object to be populated.
392
+ * @param from An un-typed object with values to populate.
393
+ */
394
+ function shallowCopyToObserableFromObject(to, from, scopes) {
395
+ var stringMapTo = to,
396
+ stringMapFrom = from,
397
+ copyFunction = function (key) {
398
+ var value;
399
+ if (stringMapFrom.hasOwnProperty(key)) {
400
+ value = stringMapFrom[key];
401
+ if (value !== undefined) {
402
+ stringMapTo[key] = ko.isObservable(value)
403
+ ? value
404
+ : ko.observable(value);
405
+ }
406
+ }
407
+ },
408
+ actualScopes = scopes || Object.keys(stringMapFrom) || [];
409
+ actualScopes.forEach(copyFunction);
410
+ }
411
+ Main.shallowCopyToObserableFromObject = shallowCopyToObserableFromObject;
412
+ /**
413
+ * Gets the scrollable parents for the specified element.
414
+ *
415
+ * @param element DOM element.
416
+ * @param includeWindow True to include window in the list of scrollable parents.
417
+ * @return List of scrollable parent elements.
418
+ */
419
+ function getScrollableParents(element, includeWindow) {
420
+ var scrollableParents = element.parents().filter(function () {
421
+ var target = $(this),
422
+ targetCssOverflowX = target.css("overflow-x"),
423
+ targetCssOverflowY = target.css("overflow-y");
424
+ return (
425
+ (targetCssOverflowX !== "hidden" ||
426
+ targetCssOverflowY !== "hidden") &&
427
+ (targetCssOverflowX !== "visible" || targetCssOverflowY !== "visible")
428
+ );
429
+ });
430
+ if (includeWindow) {
431
+ scrollableParents = scrollableParents.add(window);
432
+ }
433
+ return scrollableParents;
434
+ }
435
+ Main.getScrollableParents = getScrollableParents;
436
+ /**
437
+ * Helper function to deal with short form number string.
438
+ * Generally we want to show number.toFixed(1). But in the case when it can be round up to an integer, we choose the shorter form.
439
+ * For example, 80 instead of 80.0 or 100 instead of 100.00.
440
+ *
441
+ * @param value The number.
442
+ * @param fractionDigits The fractionDigits for this number string output.
443
+ * @return String for this number.
444
+ */
445
+ function toNiceFixed(value, fractionDigits) {
446
+ if (fractionDigits === void 0) {
447
+ fractionDigits = 0;
448
+ }
449
+ var valueString = value.toFixed(fractionDigits),
450
+ index;
451
+ if (fractionDigits > 0) {
452
+ for (
453
+ index = valueString.length - 1;
454
+ index > 0 && valueString[index] === "0";
455
+ index--
456
+ );
457
+ return valueString.substr(
458
+ 0,
459
+ valueString[index] === "." ? index : index + 1
460
+ );
461
+ }
462
+ return valueString;
463
+ }
464
+ Main.toNiceFixed = toNiceFixed;
465
+ /**
466
+ * Helper function to in-place adjust KnockoutObserableArray<T> such that ko bind array doesn't destroy the origin DOM object.
467
+ * Project the source Array into the KnockoutObserableArray.
468
+ *
469
+ * @param source Array that to be projected to the existing KnockoutObservableArray.
470
+ * @param dest KnockoutObserableArray<T> that's currently use in widget binding.
471
+ * @param itemCopyFunction a function that take the source and copy the content but keep the ko.obserable and ko.obserable as it.
472
+ */
473
+ function projectArrayData(source, dest, itemCopyFunction) {
474
+ var destArray, additonSource, index;
475
+ dest.splice(source.length);
476
+ destArray = dest.peek();
477
+ for (index = 0; index < destArray.length; index++) {
478
+ itemCopyFunction(source[index], destArray[index]);
479
+ }
480
+ dest.push.apply(dest, source.slice(index));
481
+ }
482
+ Main.projectArrayData = projectArrayData;
483
+ /**
484
+ * Helper function to help identifying the container with data attribute "data-control".
485
+ *
486
+ * @param elem The current element to start searching.
487
+ * @return The first element that has "data-control" attribute. It can be the element it starts with. If none is found, null is returned.
488
+ */
489
+ function findContainingControl(elem) {
490
+ if (elem) {
491
+ var $elem = $(elem),
492
+ found;
493
+ if ($elem.attr(Constants.dataControlAttribute)) {
494
+ return elem;
495
+ } else {
496
+ found = $elem.closest(
497
+ "[" + Constants.dataControlAttribute + "='true']"
498
+ );
499
+ if (found.length > 0) {
500
+ return found[0];
501
+ }
502
+ }
503
+ }
504
+ return null;
505
+ }
506
+ Main.findContainingControl = findContainingControl;
507
+ /**
508
+ * Helper function to help execute the setFocus function that "data-canfocus" has on the element.
509
+ *
510
+ * @param elem The current element to execute the setFocus on.
511
+ * @return Whether setFocus() is successfully executed. If false, the container will need to find the next item to set focus on.
512
+ */
513
+ function executeSetFocusOn(elem) {
514
+ var jElem = $(elem),
515
+ focusFunction;
516
+ if (jElem.attr(Constants.dataCanFocusAttribute)) {
517
+ focusFunction = elem[Constants.dataCanFocusAttribute];
518
+ if (focusFunction) {
519
+ return focusFunction();
520
+ }
521
+ }
522
+ return false;
523
+ }
524
+ Main.executeSetFocusOn = executeSetFocusOn;
525
+ /**
526
+ * Helper function to help execute the setFocusToFirstFocusableChild.
527
+ * It is performance oriented, it finds the first candidate and executes the setFocus on the element.
528
+ * If first.setFocus() fails, it goes on to do the next one.
529
+ *
530
+ * @param elem The current element to find child elements with the selector and a custom filter to set the focus on.
531
+ * @return Whether setFocus() is successfully executed. If false, the container will need to find the next item to set focus on.
532
+ */
533
+ function executeSetFocusOnSelector(elem, selector, elementfilter) {
534
+ var index = 0,
535
+ currentElemnt,
536
+ filterElement,
537
+ jq,
538
+ ret;
539
+ do {
540
+ currentElemnt = null;
541
+ jq = elem.find(selector + ":eq(" + index + ")");
542
+ if (jq.length > 0) {
543
+ currentElemnt = jq[0];
544
+ filterElement = elementfilter(currentElemnt);
545
+ if (filterElement && executeSetFocusOn(currentElemnt)) {
546
+ return true;
547
+ }
548
+ }
549
+ index++;
550
+ } while (!isNullOrUndefined(currentElemnt));
551
+ return false;
552
+ }
553
+ /**
554
+ * Helper function to return the basicShape of an object
555
+ */
556
+ function getObjectBasicShape(obj, sort) {
557
+ if (sort === void 0) {
558
+ sort = true;
559
+ }
560
+ var keys = Object.keys(obj);
561
+ return sort
562
+ ? keys.sort(function (a, b) {
563
+ return a < b ? 1 : -1;
564
+ })
565
+ : keys;
566
+ }
567
+ Main.getObjectBasicShape = getObjectBasicShape;
568
+ /**
569
+ * Helper function to return whether the extendedShape have same property bag names
570
+ */
571
+ function shapeContains(extendedShape, baseShape) {
572
+ if (baseShape.length <= extendedShape.length) {
573
+ var extendedShapeIndex = -1;
574
+ for (
575
+ var baseShapeIndex = 0;
576
+ baseShapeIndex < baseShape.length;
577
+ baseShapeIndex++
578
+ ) {
579
+ var baseShapeName = baseShape[baseShapeIndex];
580
+ extendedShapeIndex = extendedShape.firstIndex(function (value) {
581
+ return value === baseShapeName;
582
+ }, extendedShapeIndex + 1);
583
+ if (extendedShapeIndex < 0) {
584
+ return false;
585
+ }
586
+ }
587
+ return true;
588
+ }
589
+ return false;
590
+ }
591
+ Main.shapeContains = shapeContains;
592
+ /**
593
+ * Sets the focus to the first Focusable Child Control under the first element.
594
+ * It goes through two paths to find the first suitable control.
595
+ * First pass goes through the elements with both data-canfocus and data-focusfirst.
596
+ * Then it tries again with data-canfocus and :not(data-focusfirst).
597
+ * --(Note for experienced users who need to set the data-focusfirst, please use Base.Widget._markFocusFirstElements(elem: JQuery)
598
+ *
599
+ * @param elem The container element for this function to find the child element to set focus on.
600
+ * @param preferFilter The optional function callback to filter on specific elements that the user perfers. For example, GridEditableRow, prefers the next data-editable row.
601
+ */
602
+ function setFocusToFirstFocusableChild(elem, preferFilter) {
603
+ var focusFirst = "[" + Constants.dataFocusFirstAttribute + "='true']",
604
+ notFocusFirst = ":not(" + focusFirst + ")",
605
+ focusable = "[" + Constants.dataCanFocusAttribute + "='true']",
606
+ noFilter = function (e) {
607
+ return e;
608
+ },
609
+ ret = false;
610
+ // First pass through with user's filter
611
+ if (preferFilter) {
612
+ ret = executeSetFocusOnSelector(
613
+ elem,
614
+ focusable + focusFirst,
615
+ preferFilter
616
+ );
617
+ if (!ret) {
618
+ ret = executeSetFocusOnSelector(
619
+ elem,
620
+ focusable + notFocusFirst,
621
+ preferFilter
622
+ );
623
+ }
624
+ }
625
+ // if we can't find any, we do the hard work to find the first one with no filter.
626
+ if (!ret) {
627
+ ret = executeSetFocusOnSelector(elem, focusable + focusFirst, noFilter);
628
+ if (!ret) {
629
+ ret = executeSetFocusOnSelector(
630
+ elem,
631
+ focusable + notFocusFirst,
632
+ noFilter
633
+ );
634
+ }
635
+ }
636
+ return ret;
637
+ }
638
+ Main.setFocusToFirstFocusableChild = setFocusToFirstFocusableChild;
639
+ /**
640
+ * Clones the event by copying some important functions.
641
+ * Will use the same type unless you pass one to the function.
642
+ * The original event will be kept in newEvent.originalEvent.
643
+ *
644
+ * @param evt Object to clone.
645
+ * @param type New type to use.
646
+ * @return New cloned object.
647
+ */
648
+ function cloneEvent(evt, type) {
649
+ var evtType = type || evt.type,
650
+ newEvent = $.Event(evt, {
651
+ type: evtType,
652
+ target: evt.target,
653
+ ctrlKey: evt.ctrlKey,
654
+ shiftKey: evt.shiftKey,
655
+ currentTarget: evt.currentTarget,
656
+ isImmediatePropagationStopped: evt.isImmediatePropagationStopped,
657
+ isPropagationStopped: evt.isPropagationStopped,
658
+ preventDefault: evt.preventDefault,
659
+ stopImmediatePropagation: evt.stopImmediatePropagation,
660
+ stopPropagation: evt.stopPropagation,
661
+ });
662
+ return newEvent;
663
+ }
664
+ Main.cloneEvent = cloneEvent;
665
+ /**
666
+ * Mirror the souce fields, which are observables to the dest fields.
667
+ * The purpose of this function is keep the obserable which is binded to a div and just mirror the value on to it.
668
+ * This is to avoid destroy a DOM Element and recreate one.
669
+ * For example, bar chart, when the new value come in. We push the value to the prior bar wihtout destroy it.
670
+ *
671
+ * @param source Object's keys are observable.
672
+ * @param dest object
673
+ * @param keyNames array of keys to mirror
674
+ * @return New cloned object.
675
+ */
676
+ function fillObserableFields(source, dest, keyNames) {
677
+ var length = keyNames ? keyNames.length : 0,
678
+ index = 0,
679
+ fieldName,
680
+ field,
681
+ sourceField;
682
+ for (index = 0; index < length; index++) {
683
+ fieldName = keyNames[index];
684
+ field = dest[fieldName] || ko.observable();
685
+ sourceField = source[fieldName];
686
+ field(ko.isObservable(sourceField) ? sourceField.peek() : sourceField);
687
+ if (!dest[fieldName]) {
688
+ dest[fieldName] = field;
689
+ }
690
+ }
691
+ }
692
+ Main.fillObserableFields = fillObserableFields;
693
+ /**
694
+ * Utility to map a knockout projected array to an observable array.
695
+ * Knockout projection which returns observable of array while many view model exposes KnokoutObservableArray.
696
+ * This utility will help in mapping the projected array to ObservableArray.
697
+ *
698
+ * @param mappedArray Knockout projected array.
699
+ * @param lifetime The LifetimeManager reflecting the lifetime of the array that's returned.
700
+ * @return returns KnockoutObservableArray.
701
+ */
702
+ function thunkArray(lifetime, mappedArray) {
703
+ var observableArray = ko.observableArray(),
704
+ computed = ko.computed(function () {
705
+ observableArray(mappedArray());
706
+ });
707
+ observableArray.dispose = computed.dispose.bind(computed);
708
+ lifetime.registerForDispose(observableArray);
709
+ return observableArray;
710
+ }
711
+ Main.thunkArray = thunkArray;
712
+ /**
713
+ * existsOrRegisterId. This is utility function for helping in the destroy method to avoid recursive
714
+ *
715
+ * @param id Unique identifier.
716
+ * @return whether this id is already on the array. If true, mean this is not yet been executed.
717
+ */
718
+ function existsOrRegisterId(array, id) {
719
+ var notExists = array.indexOf(id) < 0;
720
+ if (notExists) {
721
+ array.push(id);
722
+ }
723
+ return !notExists;
724
+ }
725
+ Main.existsOrRegisterId = existsOrRegisterId;
726
+ /**
727
+ * Shim that implements all of DOMTokenList except [] indexing. Use item() to index.
728
+ */
729
+ var DOMTokenListShim = (function () {
730
+ /**
731
+ * Creates a DOMTokenListShim that behaves like DOMTokenList
732
+ */
733
+ function DOMTokenListShim(tokenString) {
734
+ if (tokenString === void 0) {
735
+ tokenString = null;
736
+ }
737
+ this._fields = tokenString ? tokenString.split(" ") : [];
738
+ }
739
+ /**
740
+ * Adds a taken to the token list if not already present.
741
+ *
742
+ * @param token The token to add.
743
+ */
744
+ DOMTokenListShim.prototype.add = function (token) {
745
+ if (this._fields.indexOf(token) < 0) {
746
+ this._fields.push(token);
747
+ }
748
+ };
749
+ /**
750
+ * Removes all instances of token.
751
+ *
752
+ * @param token The token to remove.
753
+ */
754
+ DOMTokenListShim.prototype.remove = function (token) {
755
+ while (this._fields.indexOf(token) >= 0) {
756
+ this._fields.splice(this._fields.indexOf(token), 1);
757
+ }
758
+ };
759
+ /**
760
+ * Returns true if the token list contains the specified token.
761
+ *
762
+ * @param token The token to look for.
763
+ * @return Whether or not the token appears in the token list.
764
+ */
765
+ DOMTokenListShim.prototype.contains = function (token) {
766
+ return this._fields.indexOf(token) >= 0;
767
+ };
768
+ Object.defineProperty(DOMTokenListShim.prototype, "length", {
769
+ /**
770
+ * The number of tokens in the token list.
771
+ */
772
+ get: function () {
773
+ return this._fields.length;
774
+ },
775
+ enumerable: true,
776
+ configurable: true,
777
+ });
778
+ /**
779
+ * Adds a token if note present or removes it if it is.
780
+ *
781
+ * @param token The token to turn on or off.
782
+ * @return Whether the item exists in the token list after toggling.
783
+ */
784
+ DOMTokenListShim.prototype.toggle = function (token) {
785
+ if (this._fields.indexOf(token) >= 0) {
786
+ this.remove(token);
787
+ return false;
788
+ } else {
789
+ this.add(token);
790
+ return true;
791
+ }
792
+ };
793
+ /**
794
+ * Returns the token at the index parameter.
795
+ *
796
+ * @param index The index.
797
+ * @return The item at the passed index.
798
+ */
799
+ DOMTokenListShim.prototype.item = function (index) {
800
+ return this._fields[index];
801
+ };
802
+ /**
803
+ * See toString on pretty much any other object.
804
+ */
805
+ DOMTokenListShim.prototype.toString = function () {
806
+ return this._fields.toString();
807
+ };
808
+ return DOMTokenListShim;
809
+ })();
810
+ Main.DOMTokenListShim = DOMTokenListShim;
811
+ /**
812
+ * This function exists as an alternative to element.classList, as IE doesn't support this on SVG elements.
813
+ * Returns a token list shim containing all the classes on the element. Note the token list is not synchronized with
814
+ * the element and you need to call setClassList to update a class attribute from a token list.
815
+ *
816
+ * @param element The element for which to get the classList.
817
+ * @return The class list.
818
+ */
819
+ function getClassList(element) {
820
+ var classAttr = element.getAttribute("class");
821
+ return classAttr
822
+ ? new DOMTokenListShim(classAttr)
823
+ : new DOMTokenListShim();
824
+ }
825
+ Main.getClassList = getClassList;
826
+ /**
827
+ * Sets the classes on an element to be those in the specified class list.
828
+ *
829
+ * @param element The element to set classes on.
830
+ * @param classes The class list.
831
+ */
832
+ function setClassList(element, classes) {
833
+ element.setAttribute("class", classes._fields.join(" "));
834
+ }
835
+ Main.setClassList = setClassList;
836
+ Main.DataTransfer = azcPrivate.DataTransfer2;
837
+ /**
838
+ * Returns true if the Hammer.js library has been loaded.
839
+ */
840
+ function hammerLoaded() {
841
+ return typeof Hammer === "function";
842
+ }
843
+ Main.hammerLoaded = hammerLoaded;
844
+ /**
845
+ * Compares two values.
846
+ *
847
+ * @param value The value.
848
+ * @param compareTo The compare to value.
849
+ * @param key? The key to access the values.
850
+ * @return An integer indicating if the value is greater or less than the compareTo.
851
+ */
852
+ function compareTo(value, compareTo, key) {
853
+ var val, compTo;
854
+ if (key) {
855
+ val = value[key];
856
+ compTo = compareTo[key];
857
+ } else {
858
+ val = value;
859
+ compTo = compareTo;
860
+ }
861
+ if (ko.isObservable(val)) {
862
+ val = val.peek();
863
+ }
864
+ if (ko.isObservable(compTo)) {
865
+ compTo = compTo.peek();
866
+ }
867
+ if (val === compTo) {
868
+ return 0;
869
+ }
870
+ return val > compTo ? 1 : -1;
871
+ }
872
+ Main.compareTo = compareTo;
873
+ var KnockoutDelayTrigger = (function () {
874
+ /**
875
+ * Creates a KOUpdateTrigger with certain extension
876
+ *
877
+ * @param knockoutObserveExtend the knockout extend apply to this value observable
878
+ */
879
+ function KnockoutDelayTrigger(knockoutObserveExtend) {
880
+ var value = ko.observable(0),
881
+ extend = knockoutObserveExtend
882
+ ? knockoutObserveExtend
883
+ : { rateLimit: 30 };
884
+ value.extend(extend);
885
+ this._value = value;
886
+ }
887
+ Object.defineProperty(KnockoutDelayTrigger.prototype, "value", {
888
+ /**
889
+ * This is the value to subscribe to the delay trigger.
890
+ */
891
+ get: function () {
892
+ return this._value;
893
+ },
894
+ enumerable: true,
895
+ configurable: true,
896
+ });
897
+ KnockoutDelayTrigger.prototype.touch = function () {
898
+ this._value((this._value.peek() + 1) & 0xffff);
899
+ };
900
+ return KnockoutDelayTrigger;
901
+ })();
902
+ Main.KnockoutDelayTrigger = KnockoutDelayTrigger;
903
+ })(Main || (Main = {}));
904
+ return Main;
905
+ });