@grafit/era-dependencies 1.0.0

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.
Files changed (72) hide show
  1. package/package.json +7 -0
  2. package/vendor/fonts/FontAwesome.otf +0 -0
  3. package/vendor/fonts/fontawesome-webfont.eot +0 -0
  4. package/vendor/fonts/fontawesome-webfont.svg +685 -0
  5. package/vendor/fonts/fontawesome-webfont.ttf +0 -0
  6. package/vendor/fonts/fontawesome-webfont.woff +0 -0
  7. package/vendor/fonts/fontawesome-webfont.woff2 +0 -0
  8. package/vendor/fonts/glyphicons-halflings-regular.eot +0 -0
  9. package/vendor/fonts/glyphicons-halflings-regular.svg +288 -0
  10. package/vendor/fonts/glyphicons-halflings-regular.ttf +0 -0
  11. package/vendor/fonts/glyphicons-halflings-regular.woff +0 -0
  12. package/vendor/fonts/glyphicons-halflings-regular.woff2 +0 -0
  13. package/vendor/scripts/angular/angular-cookies.js +322 -0
  14. package/vendor/scripts/angular/angular-file-upload.js +2087 -0
  15. package/vendor/scripts/angular/angular-filter.js +2287 -0
  16. package/vendor/scripts/angular/angular-locale_ru-ru.js +143 -0
  17. package/vendor/scripts/angular/angular-route.js +1069 -0
  18. package/vendor/scripts/angular/angular-sanitize.js +738 -0
  19. package/vendor/scripts/angular/angular-ui-router-0.2.18.js +4539 -0
  20. package/vendor/scripts/angular/angular.js +31768 -0
  21. package/vendor/scripts/angular/datetimepicker.js +578 -0
  22. package/vendor/scripts/angular/datetimepicker.templates.js +30 -0
  23. package/vendor/scripts/angular/mask.min.js +7 -0
  24. package/vendor/scripts/angular/ng-table.js +1518 -0
  25. package/vendor/scripts/angular/select.js +2356 -0
  26. package/vendor/scripts/angular/ui-bootstrap-tpls-2.1.3.js +7536 -0
  27. package/vendor/scripts/angular/uploader.js +3 -0
  28. package/vendor/scripts/bootbox.js +985 -0
  29. package/vendor/scripts/bootstrap.js +2377 -0
  30. package/vendor/scripts/es6-shim.js +3837 -0
  31. package/vendor/scripts/highchart/highcharts-more.src.js +3165 -0
  32. package/vendor/scripts/highchart/highstock.src.js +32008 -0
  33. package/vendor/scripts/highchart/modules/boost.src.js +2721 -0
  34. package/vendor/scripts/highchart/modules/exporting.src.js +951 -0
  35. package/vendor/scripts/jquery/jquery.js +11008 -0
  36. package/vendor/scripts/jquery.datetimepicker.full.js +2911 -0
  37. package/vendor/scripts/keycloak.js +2382 -0
  38. package/vendor/scripts/lodash.js +16733 -0
  39. package/vendor/scripts/moment-with-locales.js +12251 -0
  40. package/vendor/scripts/moment.js +4234 -0
  41. package/vendor/scripts/old/datepicker-ru.js +38 -0
  42. package/vendor/scripts/old/jquery-ui-1.11.1.js +16375 -0
  43. package/vendor/scripts/old/jquery.form.js +1278 -0
  44. package/vendor/scripts/perfect-scrollbar.js +1549 -0
  45. package/vendor/scripts/pickmeup/pickmeup-locales.js +11 -0
  46. package/vendor/scripts/pickmeup/pickmeup.js +1383 -0
  47. package/vendor/scripts/quill.js +9676 -0
  48. package/vendor/scripts/socket.io.min.js +3 -0
  49. package/vendor/scripts/textAngular/angular-spectrum-colorpicker.min.js +2 -0
  50. package/vendor/scripts/textAngular/spectrum.min.js +1 -0
  51. package/vendor/scripts/textAngular/textAngular-dropdownToggle.js +38 -0
  52. package/vendor/scripts/textAngular/textAngular-rangy.min.js +478 -0
  53. package/vendor/scripts/textAngular/textAngular-sanitize.min.js +322 -0
  54. package/vendor/scripts/textAngular/textAngular.min.js +1481 -0
  55. package/vendor/scripts/textAngular/textAngularSetup.js +1013 -0
  56. package/vendor/styles/bootstrap-theme.css +587 -0
  57. package/vendor/styles/bootstrap-theme.css.map +1 -0
  58. package/vendor/styles/bootstrap-theme.min.css +6 -0
  59. package/vendor/styles/bootstrap-theme.min.css.map +1 -0
  60. package/vendor/styles/bootstrap.css +6757 -0
  61. package/vendor/styles/bootstrap.css.map +1 -0
  62. package/vendor/styles/bootstrap.min.css +6 -0
  63. package/vendor/styles/bootstrap.min.css.map +1 -0
  64. package/vendor/styles/datetimepicker.css +115 -0
  65. package/vendor/styles/font-awesome.css +2199 -0
  66. package/vendor/styles/jquery.datetimepicker.min.css +1 -0
  67. package/vendor/styles/ng-table.css +136 -0
  68. package/vendor/styles/normalize.css +424 -0
  69. package/vendor/styles/perfect-scrollbar.css +165 -0
  70. package/vendor/styles/pickmeup.css +137 -0
  71. package/vendor/styles/spectrum.min.css +1 -0
  72. package/vendor/styles/textAngular.css +193 -0
@@ -0,0 +1,951 @@
1
+ /**
2
+ * @license Highcharts JS v5.0.12 (2017-05-24)
3
+ * Exporting module
4
+ *
5
+ * (c) 2010-2017 Torstein Honsi
6
+ *
7
+ * License: www.highcharts.com/license
8
+ */
9
+ 'use strict';
10
+ (function(factory) {
11
+ if (typeof module === 'object' && module.exports) {
12
+ module.exports = factory;
13
+ } else {
14
+ factory(Highcharts);
15
+ }
16
+ }(function(Highcharts) {
17
+ (function(H) {
18
+ /**
19
+ * Exporting module
20
+ *
21
+ * (c) 2010-2017 Torstein Honsi
22
+ *
23
+ * License: www.highcharts.com/license
24
+ */
25
+
26
+ /* eslint indent:0 */
27
+
28
+ // create shortcuts
29
+ var defaultOptions = H.defaultOptions,
30
+ doc = H.doc,
31
+ Chart = H.Chart,
32
+ addEvent = H.addEvent,
33
+ removeEvent = H.removeEvent,
34
+ fireEvent = H.fireEvent,
35
+ createElement = H.createElement,
36
+ discardElement = H.discardElement,
37
+ css = H.css,
38
+ merge = H.merge,
39
+ pick = H.pick,
40
+ each = H.each,
41
+ objectEach = H.objectEach,
42
+ extend = H.extend,
43
+ isTouchDevice = H.isTouchDevice,
44
+ win = H.win,
45
+ userAgent = win.navigator.userAgent,
46
+ SVGRenderer = H.SVGRenderer,
47
+ symbols = H.Renderer.prototype.symbols,
48
+ isMSBrowser = /Edge\/|Trident\/|MSIE /.test(userAgent),
49
+ isFirefoxBrowser = /firefox/i.test(userAgent);
50
+
51
+ // Add language
52
+ extend(defaultOptions.lang, {
53
+ printChart: 'Print chart',
54
+ downloadPNG: 'Download PNG image',
55
+ downloadJPEG: 'Download JPEG image',
56
+ downloadPDF: 'Download PDF document',
57
+ downloadSVG: 'Download SVG vector image',
58
+ contextButtonTitle: 'Chart context menu'
59
+ });
60
+
61
+ // Buttons and menus are collected in a separate config option set called 'navigation'.
62
+ // This can be extended later to add control buttons like zoom and pan right click menus.
63
+ defaultOptions.navigation = {
64
+ buttonOptions: {
65
+ theme: {},
66
+ symbolSize: 14,
67
+ symbolX: 12.5,
68
+ symbolY: 10.5,
69
+ align: 'right',
70
+ buttonSpacing: 3,
71
+ height: 22,
72
+ // text: null,
73
+ verticalAlign: 'top',
74
+ width: 24
75
+ }
76
+ };
77
+
78
+
79
+ // Presentational attributes
80
+ merge(true, defaultOptions.navigation, {
81
+ menuStyle: {
82
+ border: '1px solid #999999',
83
+ background: '#ffffff',
84
+ padding: '5px 0'
85
+ },
86
+ menuItemStyle: {
87
+ padding: '0.5em 1em',
88
+ background: 'none',
89
+ color: '#333333',
90
+ fontSize: isTouchDevice ? '14px' : '11px',
91
+ transition: 'background 250ms, color 250ms'
92
+ },
93
+ menuItemHoverStyle: {
94
+ background: '#335cad',
95
+ color: '#ffffff'
96
+ },
97
+ buttonOptions: {
98
+ symbolFill: '#666666',
99
+ symbolStroke: '#666666',
100
+ symbolStrokeWidth: 3,
101
+ theme: {
102
+ fill: '#ffffff', // capture hover
103
+ stroke: 'none',
104
+ padding: 5
105
+ }
106
+ }
107
+ });
108
+
109
+
110
+
111
+ // Add the export related options
112
+ defaultOptions.exporting = {
113
+ //enabled: true,
114
+ //filename: 'chart',
115
+ type: 'image/png',
116
+ url: 'https://export.highcharts.com/',
117
+ //width: undefined,
118
+ printMaxWidth: 780,
119
+ scale: 2,
120
+ buttons: {
121
+ contextButton: {
122
+ className: 'highcharts-contextbutton',
123
+ menuClassName: 'highcharts-contextmenu',
124
+ //x: -10,
125
+ symbol: 'menu',
126
+ _titleKey: 'contextButtonTitle',
127
+ menuItems: [{
128
+ textKey: 'printChart',
129
+ onclick: function() {
130
+ this.print();
131
+ }
132
+ }, {
133
+ separator: true
134
+ }, {
135
+ textKey: 'downloadPNG',
136
+ onclick: function() {
137
+ this.exportChart();
138
+ }
139
+ }, {
140
+ textKey: 'downloadJPEG',
141
+ onclick: function() {
142
+ this.exportChart({
143
+ type: 'image/jpeg'
144
+ });
145
+ }
146
+ }, {
147
+ textKey: 'downloadPDF',
148
+ onclick: function() {
149
+ this.exportChart({
150
+ type: 'application/pdf'
151
+ });
152
+ }
153
+ }, {
154
+ textKey: 'downloadSVG',
155
+ onclick: function() {
156
+ this.exportChart({
157
+ type: 'image/svg+xml'
158
+ });
159
+ }
160
+ }]
161
+ }
162
+ }
163
+ };
164
+
165
+ // Add the H.post utility
166
+ H.post = function(url, data, formAttributes) {
167
+ // create the form
168
+ var form = createElement('form', merge({
169
+ method: 'post',
170
+ action: url,
171
+ enctype: 'multipart/form-data'
172
+ }, formAttributes), {
173
+ display: 'none'
174
+ }, doc.body);
175
+
176
+ // add the data
177
+ objectEach(data, function(val, name) {
178
+ createElement('input', {
179
+ type: 'hidden',
180
+ name: name,
181
+ value: val
182
+ }, null, form);
183
+ });
184
+
185
+ // submit
186
+ form.submit();
187
+
188
+ // clean up
189
+ discardElement(form);
190
+ };
191
+
192
+ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
193
+
194
+ /**
195
+ * A collection of fixes on the produced SVG to account for expando properties,
196
+ * browser bugs, VML problems and other. Returns a cleaned SVG.
197
+ */
198
+ sanitizeSVG: function(svg, options) {
199
+ // Move HTML into a foreignObject
200
+ if (options && options.exporting && options.exporting.allowHTML) {
201
+ var html = svg.match(/<\/svg>(.*?$)/);
202
+ if (html && html[1]) {
203
+ html = '<foreignObject x="0" y="0" ' +
204
+ 'width="' + options.chart.width + '" ' +
205
+ 'height="' + options.chart.height + '">' +
206
+ '<body xmlns="http://www.w3.org/1999/xhtml">' +
207
+ html[1] +
208
+ '</body>' +
209
+ '</foreignObject>';
210
+ svg = svg.replace('</svg>', html + '</svg>');
211
+ }
212
+ }
213
+
214
+ svg = svg
215
+ .replace(/zIndex="[^"]+"/g, '')
216
+ .replace(/isShadow="[^"]+"/g, '')
217
+ .replace(/symbolName="[^"]+"/g, '')
218
+ .replace(/jQuery[0-9]+="[^"]+"/g, '')
219
+ .replace(/url\(("|&quot;)(\S+)("|&quot;)\)/g, 'url($2)')
220
+ .replace(/url\([^#]+#/g, 'url(#')
221
+ .replace(/<svg /, '<svg xmlns:xlink="http://www.w3.org/1999/xlink" ')
222
+ .replace(/ (NS[0-9]+\:)?href=/g, ' xlink:href=') // #3567
223
+ .replace(/\n/, ' ')
224
+ // Any HTML added to the container after the SVG (#894)
225
+ .replace(/<\/svg>.*?$/, '</svg>')
226
+ // Batik doesn't support rgba fills and strokes (#3095)
227
+ .replace(/(fill|stroke)="rgba\(([ 0-9]+,[ 0-9]+,[ 0-9]+),([ 0-9\.]+)\)"/g, '$1="rgb($2)" $1-opacity="$3"')
228
+ /* This fails in IE < 8
229
+ .replace(/([0-9]+)\.([0-9]+)/g, function(s1, s2, s3) { // round off to save weight
230
+ return s2 +'.'+ s3[0];
231
+ })*/
232
+
233
+ // Replace HTML entities, issue #347
234
+ .replace(/&nbsp;/g, '\u00A0') // no-break space
235
+ .replace(/&shy;/g, '\u00AD'); // soft hyphen
236
+
237
+
238
+ // IE specific
239
+ svg = svg
240
+ .replace(/<IMG /g, '<image ')
241
+ .replace(/<(\/?)TITLE>/g, '<$1title>')
242
+ .replace(/height=([^" ]+)/g, 'height="$1"')
243
+ .replace(/width=([^" ]+)/g, 'width="$1"')
244
+ .replace(/hc-svg-href="([^"]+)">/g, 'xlink:href="$1"/>')
245
+ .replace(/ id=([^" >]+)/g, ' id="$1"') // #4003
246
+ .replace(/class=([^" >]+)/g, 'class="$1"')
247
+ .replace(/ transform /g, ' ')
248
+ .replace(/:(path|rect)/g, '$1')
249
+ .replace(/style="([^"]+)"/g, function(s) {
250
+ return s.toLowerCase();
251
+ });
252
+
253
+
254
+ return svg;
255
+ },
256
+
257
+ /**
258
+ * Return innerHTML of chart. Used as hook for plugins.
259
+ */
260
+ getChartHTML: function() {
261
+
262
+ return this.container.innerHTML;
263
+ },
264
+
265
+ /**
266
+ * Return an SVG representation of the chart.
267
+ *
268
+ * @param chartOptions {Options}
269
+ * Additional chart options for the generated SVG representation.
270
+ * For collections like `xAxis`, `yAxis` or `series`, the additional
271
+ * options is either merged in to the orininal item of the same
272
+ * `id`, or to the first item if a common id is not found.
273
+ * @return {String}
274
+ * The SVG representation of the rendered chart.
275
+ * @sample highcharts/members/chart-getsvg/
276
+ * View the SVG from a button
277
+ */
278
+ getSVG: function(chartOptions) {
279
+ var chart = this,
280
+ chartCopy,
281
+ sandbox,
282
+ svg,
283
+ seriesOptions,
284
+ sourceWidth,
285
+ sourceHeight,
286
+ cssWidth,
287
+ cssHeight,
288
+ options = merge(chart.options, chartOptions); // copy the options and add extra options
289
+
290
+
291
+ // IE compatibility hack for generating SVG content that it doesn't really understand
292
+ if (!doc.createElementNS) {
293
+ doc.createElementNS = function(ns, tagName) {
294
+ return doc.createElement(tagName);
295
+ };
296
+ }
297
+
298
+ // create a sandbox where a new chart will be generated
299
+ sandbox = createElement('div', null, {
300
+ position: 'absolute',
301
+ top: '-9999em',
302
+ width: chart.chartWidth + 'px',
303
+ height: chart.chartHeight + 'px'
304
+ }, doc.body);
305
+
306
+ // get the source size
307
+ cssWidth = chart.renderTo.style.width;
308
+ cssHeight = chart.renderTo.style.height;
309
+ sourceWidth = options.exporting.sourceWidth ||
310
+ options.chart.width ||
311
+ (/px$/.test(cssWidth) && parseInt(cssWidth, 10)) ||
312
+ 600;
313
+ sourceHeight = options.exporting.sourceHeight ||
314
+ options.chart.height ||
315
+ (/px$/.test(cssHeight) && parseInt(cssHeight, 10)) ||
316
+ 400;
317
+
318
+ // override some options
319
+ extend(options.chart, {
320
+ animation: false,
321
+ renderTo: sandbox,
322
+ forExport: true,
323
+ renderer: 'SVGRenderer',
324
+ width: sourceWidth,
325
+ height: sourceHeight
326
+ });
327
+ options.exporting.enabled = false; // hide buttons in print
328
+ delete options.data; // #3004
329
+
330
+ // prepare for replicating the chart
331
+ options.series = [];
332
+ each(chart.series, function(serie) {
333
+ seriesOptions = merge(serie.userOptions, { // #4912
334
+ animation: false, // turn off animation
335
+ enableMouseTracking: false,
336
+ showCheckbox: false,
337
+ visible: serie.visible
338
+ });
339
+
340
+ if (!seriesOptions.isInternal) { // used for the navigator series that has its own option set
341
+ options.series.push(seriesOptions);
342
+ }
343
+ });
344
+
345
+ // Assign an internal key to ensure a one-to-one mapping (#5924)
346
+ each(chart.axes, function(axis) {
347
+ if (!axis.userOptions.internalKey) { // #6444
348
+ axis.userOptions.internalKey = H.uniqueKey();
349
+ }
350
+ });
351
+
352
+ // generate the chart copy
353
+ chartCopy = new H.Chart(options, chart.callback);
354
+
355
+ // Axis options and series options (#2022, #3900, #5982)
356
+ if (chartOptions) {
357
+ each(['xAxis', 'yAxis', 'series'], function(coll) {
358
+ var collOptions = {};
359
+ if (chartOptions[coll]) {
360
+ collOptions[coll] = chartOptions[coll];
361
+ chartCopy.update(collOptions);
362
+ }
363
+ });
364
+ }
365
+
366
+ // Reflect axis extremes in the export (#5924)
367
+ each(chart.axes, function(axis) {
368
+ var axisCopy = H.find(chartCopy.axes, function(copy) {
369
+ return copy.options.internalKey ===
370
+ axis.userOptions.internalKey;
371
+ }),
372
+ extremes = axis.getExtremes(),
373
+ userMin = extremes.userMin,
374
+ userMax = extremes.userMax;
375
+
376
+ if (axisCopy && (userMin !== undefined || userMax !== undefined)) {
377
+ axisCopy.setExtremes(userMin, userMax, true, false);
378
+ }
379
+ });
380
+
381
+ // Get the SVG from the container's innerHTML
382
+ svg = chartCopy.getChartHTML();
383
+
384
+ svg = chart.sanitizeSVG(svg, options);
385
+
386
+ // free up memory
387
+ options = null;
388
+ chartCopy.destroy();
389
+ discardElement(sandbox);
390
+
391
+ return svg;
392
+ },
393
+
394
+ getSVGForExport: function(options, chartOptions) {
395
+ var chartExportingOptions = this.options.exporting;
396
+
397
+ return this.getSVG(merge({
398
+ chart: {
399
+ borderRadius: 0
400
+ }
401
+ },
402
+ chartExportingOptions.chartOptions,
403
+ chartOptions, {
404
+ exporting: {
405
+ sourceWidth: (options && options.sourceWidth) || chartExportingOptions.sourceWidth,
406
+ sourceHeight: (options && options.sourceHeight) || chartExportingOptions.sourceHeight
407
+ }
408
+ }
409
+ ));
410
+ },
411
+
412
+ /**
413
+ * Exporting module required. Submit an SVG version of the chart to a server
414
+ * along with some parameters for conversion.
415
+ * @param {Object} exportingOptions
416
+ * Exporting options in addition to those defined in {@link
417
+ * https://api.highcharts.com/highcharts/exporting|exporting}.
418
+ * @param {String} exportingOptions.filename
419
+ * The file name for the export without extension.
420
+ * @param {String} exportingOptions.url
421
+ * The URL for the server module to do the conversion.
422
+ * @param {Number} exportingOptions.width
423
+ * The width of the PNG or JPG image generated on the server.
424
+ * @param {String} exportingOptions.type
425
+ * The MIME type of the converted image.
426
+ * @param {Number} exportingOptions.sourceWidth
427
+ * The pixel width of the source (in-page) chart.
428
+ * @param {Number} exportingOptions.sourceHeight
429
+ * The pixel height of the source (in-page) chart.
430
+ * @param {Options} chartOptions
431
+ * Additional chart options for the exported chart. For example a
432
+ * different background color can be added here, or `dataLabels`
433
+ * for export only.
434
+ *
435
+ * @sample highcharts/members/chart-exportchart/
436
+ * Export with no options
437
+ * @sample highcharts/members/chart-exportchart-filename/
438
+ * PDF type and custom filename
439
+ * @sample highcharts/members/chart-exportchart-custom-background/
440
+ * Different chart background in export
441
+ * @sample stock/members/chart-exportchart/
442
+ * Export with Highstock
443
+ */
444
+ exportChart: function(exportingOptions, chartOptions) {
445
+
446
+ var svg = this.getSVGForExport(exportingOptions, chartOptions);
447
+
448
+ // merge the options
449
+ exportingOptions = merge(this.options.exporting, exportingOptions);
450
+
451
+ // do the post
452
+ H.post(exportingOptions.url, {
453
+ filename: exportingOptions.filename || 'chart',
454
+ type: exportingOptions.type,
455
+ width: exportingOptions.width || 0, // IE8 fails to post undefined correctly, so use 0
456
+ scale: exportingOptions.scale,
457
+ svg: svg
458
+ }, exportingOptions.formAttributes);
459
+
460
+ },
461
+
462
+ /**
463
+ * Exporting module required. Clears away other elements in the page and
464
+ * prints the chart as it is displayed. By default, when the exporting
465
+ * module is enabled, a context button with a drop down menu in the upper
466
+ * right corner accesses this function.
467
+ *
468
+ * @sample highcharts/members/chart-print/
469
+ * Print from a HTML button
470
+ */
471
+ print: function() {
472
+
473
+ var chart = this,
474
+ container = chart.container,
475
+ origDisplay = [],
476
+ origParent = container.parentNode,
477
+ body = doc.body,
478
+ childNodes = body.childNodes,
479
+ printMaxWidth = chart.options.exporting.printMaxWidth,
480
+ resetParams,
481
+ handleMaxWidth;
482
+
483
+ if (chart.isPrinting) { // block the button while in printing mode
484
+ return;
485
+ }
486
+
487
+ chart.isPrinting = true;
488
+ chart.pointer.reset(null, 0);
489
+
490
+ fireEvent(chart, 'beforePrint');
491
+
492
+ // Handle printMaxWidth
493
+ handleMaxWidth = printMaxWidth && chart.chartWidth > printMaxWidth;
494
+ if (handleMaxWidth) {
495
+ resetParams = [chart.options.chart.width, undefined, false];
496
+ chart.setSize(printMaxWidth, undefined, false);
497
+ }
498
+
499
+ // hide all body content
500
+ each(childNodes, function(node, i) {
501
+ if (node.nodeType === 1) {
502
+ origDisplay[i] = node.style.display;
503
+ node.style.display = 'none';
504
+ }
505
+ });
506
+
507
+ // pull out the chart
508
+ body.appendChild(container);
509
+
510
+ // print
511
+ win.focus(); // #1510
512
+ win.print();
513
+
514
+ // allow the browser to prepare before reverting
515
+ setTimeout(function() {
516
+
517
+ // put the chart back in
518
+ origParent.appendChild(container);
519
+
520
+ // restore all body content
521
+ each(childNodes, function(node, i) {
522
+ if (node.nodeType === 1) {
523
+ node.style.display = origDisplay[i];
524
+ }
525
+ });
526
+
527
+ chart.isPrinting = false;
528
+
529
+ // Reset printMaxWidth
530
+ if (handleMaxWidth) {
531
+ chart.setSize.apply(chart, resetParams);
532
+ }
533
+
534
+ fireEvent(chart, 'afterPrint');
535
+
536
+ }, 1000);
537
+
538
+ },
539
+
540
+ /**
541
+ * Display a popup menu for choosing the export type
542
+ *
543
+ * @param {String} className An identifier for the menu
544
+ * @param {Array} items A collection with text and onclicks for the items
545
+ * @param {Number} x The x position of the opener button
546
+ * @param {Number} y The y position of the opener button
547
+ * @param {Number} width The width of the opener button
548
+ * @param {Number} height The height of the opener button
549
+ */
550
+ contextMenu: function(className, items, x, y, width, height, button) {
551
+ var chart = this,
552
+ navOptions = chart.options.navigation,
553
+ chartWidth = chart.chartWidth,
554
+ chartHeight = chart.chartHeight,
555
+ cacheName = 'cache-' + className,
556
+ menu = chart[cacheName],
557
+ menuPadding = Math.max(width, height), // for mouse leave detection
558
+ innerMenu,
559
+ hide,
560
+ menuStyle;
561
+
562
+ // create the menu only the first time
563
+ if (!menu) {
564
+
565
+ // create a HTML element above the SVG
566
+ chart[cacheName] = menu = createElement('div', {
567
+ className: className
568
+ }, {
569
+ position: 'absolute',
570
+ zIndex: 1000,
571
+ padding: menuPadding + 'px'
572
+ }, chart.container);
573
+
574
+ innerMenu = createElement('div', {
575
+ className: 'highcharts-menu'
576
+ }, null, menu);
577
+
578
+
579
+ // Presentational CSS
580
+ css(innerMenu, extend({
581
+ MozBoxShadow: '3px 3px 10px #888',
582
+ WebkitBoxShadow: '3px 3px 10px #888',
583
+ boxShadow: '3px 3px 10px #888'
584
+ }, navOptions.menuStyle));
585
+
586
+
587
+ // hide on mouse out
588
+ hide = function() {
589
+ css(menu, {
590
+ display: 'none'
591
+ });
592
+ if (button) {
593
+ button.setState(0);
594
+ }
595
+ chart.openMenu = false;
596
+ };
597
+
598
+ // Hide the menu some time after mouse leave (#1357)
599
+ chart.exportEvents.push(
600
+ addEvent(menu, 'mouseleave', function() {
601
+ menu.hideTimer = setTimeout(hide, 500);
602
+ }),
603
+ addEvent(menu, 'mouseenter', function() {
604
+ clearTimeout(menu.hideTimer);
605
+ }),
606
+
607
+ // Hide it on clicking or touching outside the menu (#2258, #2335,
608
+ // #2407)
609
+ addEvent(doc, 'mouseup', function(e) {
610
+ if (!chart.pointer.inClass(e.target, className)) {
611
+ hide();
612
+ }
613
+ })
614
+ );
615
+
616
+ // create the items
617
+ each(items, function(item) {
618
+ if (item) {
619
+ var element;
620
+
621
+ if (item.separator) {
622
+ element = createElement('hr', null, null, innerMenu);
623
+
624
+ } else {
625
+ element = createElement('div', {
626
+ className: 'highcharts-menu-item',
627
+ onclick: function(e) {
628
+ if (e) { // IE7
629
+ e.stopPropagation();
630
+ }
631
+ hide();
632
+ if (item.onclick) {
633
+ item.onclick.apply(chart, arguments);
634
+ }
635
+ },
636
+ innerHTML: item.text || chart.options.lang[item.textKey]
637
+ }, null, innerMenu);
638
+
639
+
640
+ element.onmouseover = function() {
641
+ css(this, navOptions.menuItemHoverStyle);
642
+ };
643
+ element.onmouseout = function() {
644
+ css(this, navOptions.menuItemStyle);
645
+ };
646
+ css(element, extend({
647
+ cursor: 'pointer'
648
+ }, navOptions.menuItemStyle));
649
+
650
+ }
651
+
652
+ // Keep references to menu divs to be able to destroy them
653
+ chart.exportDivElements.push(element);
654
+ }
655
+ });
656
+
657
+ // Keep references to menu and innerMenu div to be able to destroy them
658
+ chart.exportDivElements.push(innerMenu, menu);
659
+
660
+ chart.exportMenuWidth = menu.offsetWidth;
661
+ chart.exportMenuHeight = menu.offsetHeight;
662
+ }
663
+
664
+ menuStyle = {
665
+ display: 'block'
666
+ };
667
+
668
+ // if outside right, right align it
669
+ if (x + chart.exportMenuWidth > chartWidth) {
670
+ menuStyle.right = (chartWidth - x - width - menuPadding) + 'px';
671
+ } else {
672
+ menuStyle.left = (x - menuPadding) + 'px';
673
+ }
674
+ // if outside bottom, bottom align it
675
+ if (y + height + chart.exportMenuHeight > chartHeight && button.alignOptions.verticalAlign !== 'top') {
676
+ menuStyle.bottom = (chartHeight - y - menuPadding) + 'px';
677
+ } else {
678
+ menuStyle.top = (y + height - menuPadding) + 'px';
679
+ }
680
+
681
+ css(menu, menuStyle);
682
+ chart.openMenu = true;
683
+ },
684
+
685
+ /**
686
+ * Add the export button to the chart
687
+ */
688
+ addButton: function(options) {
689
+ var chart = this,
690
+ renderer = chart.renderer,
691
+ btnOptions = merge(chart.options.navigation.buttonOptions, options),
692
+ onclick = btnOptions.onclick,
693
+ menuItems = btnOptions.menuItems,
694
+ symbol,
695
+ button,
696
+ symbolSize = btnOptions.symbolSize || 12;
697
+ if (!chart.btnCount) {
698
+ chart.btnCount = 0;
699
+ }
700
+
701
+ // Keeps references to the button elements
702
+ if (!chart.exportDivElements) {
703
+ chart.exportDivElements = [];
704
+ chart.exportSVGElements = [];
705
+ }
706
+
707
+ if (btnOptions.enabled === false) {
708
+ return;
709
+ }
710
+
711
+
712
+ var attr = btnOptions.theme,
713
+ states = attr.states,
714
+ hover = states && states.hover,
715
+ select = states && states.select,
716
+ callback;
717
+
718
+ delete attr.states;
719
+
720
+ if (onclick) {
721
+ callback = function(e) {
722
+ e.stopPropagation();
723
+ onclick.call(chart, e);
724
+ };
725
+
726
+ } else if (menuItems) {
727
+ callback = function() {
728
+ chart.contextMenu(
729
+ button.menuClassName,
730
+ menuItems,
731
+ button.translateX,
732
+ button.translateY,
733
+ button.width,
734
+ button.height,
735
+ button
736
+ );
737
+ button.setState(2);
738
+ };
739
+ }
740
+
741
+
742
+ if (btnOptions.text && btnOptions.symbol) {
743
+ attr.paddingLeft = pick(attr.paddingLeft, 25);
744
+
745
+ } else if (!btnOptions.text) {
746
+ extend(attr, {
747
+ width: btnOptions.width,
748
+ height: btnOptions.height,
749
+ padding: 0
750
+ });
751
+ }
752
+
753
+ button = renderer.button(btnOptions.text, 0, 0, callback, attr, hover, select)
754
+ .addClass(options.className)
755
+ .attr({
756
+
757
+ 'stroke-linecap': 'round',
758
+
759
+ title: chart.options.lang[btnOptions._titleKey],
760
+ zIndex: 3 // #4955
761
+ });
762
+ button.menuClassName = options.menuClassName || 'highcharts-menu-' + chart.btnCount++;
763
+
764
+ if (btnOptions.symbol) {
765
+ symbol = renderer.symbol(
766
+ btnOptions.symbol,
767
+ btnOptions.symbolX - (symbolSize / 2),
768
+ btnOptions.symbolY - (symbolSize / 2),
769
+ symbolSize,
770
+ symbolSize
771
+ )
772
+ .addClass('highcharts-button-symbol')
773
+ .attr({
774
+ zIndex: 1
775
+ }).add(button);
776
+
777
+
778
+ symbol.attr({
779
+ stroke: btnOptions.symbolStroke,
780
+ fill: btnOptions.symbolFill,
781
+ 'stroke-width': btnOptions.symbolStrokeWidth || 1
782
+ });
783
+
784
+ }
785
+
786
+ button.add()
787
+ .align(extend(btnOptions, {
788
+ width: button.width,
789
+ x: pick(btnOptions.x, chart.buttonOffset) // #1654
790
+ }), true, 'spacingBox');
791
+
792
+ chart.buttonOffset += (button.width + btnOptions.buttonSpacing) * (btnOptions.align === 'right' ? -1 : 1);
793
+
794
+ chart.exportSVGElements.push(button, symbol);
795
+
796
+ },
797
+
798
+ /**
799
+ * Destroy the buttons.
800
+ */
801
+ destroyExport: function(e) {
802
+ var chart = e ? e.target : this,
803
+ exportSVGElements = chart.exportSVGElements,
804
+ exportDivElements = chart.exportDivElements,
805
+ exportEvents = chart.exportEvents,
806
+ cacheName;
807
+
808
+ // Destroy the extra buttons added
809
+ if (exportSVGElements) {
810
+ each(exportSVGElements, function(elem, i) {
811
+
812
+ // Destroy and null the svg/vml elements
813
+ if (elem) { // #1822
814
+ elem.onclick = elem.ontouchstart = null;
815
+ cacheName = 'cache-' + elem.menuClassName;
816
+
817
+ if (chart[cacheName]) {
818
+ delete chart[cacheName];
819
+ }
820
+
821
+ chart.exportSVGElements[i] = elem.destroy();
822
+ }
823
+ });
824
+ exportSVGElements.length = 0;
825
+ }
826
+
827
+ // Destroy the divs for the menu
828
+ if (exportDivElements) {
829
+ each(exportDivElements, function(elem, i) {
830
+
831
+ // Remove the event handler
832
+ clearTimeout(elem.hideTimer); // #5427
833
+ removeEvent(elem, 'mouseleave');
834
+
835
+ // Remove inline events
836
+ chart.exportDivElements[i] = elem.onmouseout = elem.onmouseover = elem.ontouchstart = elem.onclick = null;
837
+
838
+ // Destroy the div by moving to garbage bin
839
+ discardElement(elem);
840
+ });
841
+ exportDivElements.length = 0;
842
+ }
843
+
844
+ if (exportEvents) {
845
+ each(exportEvents, function(unbind) {
846
+ unbind();
847
+ });
848
+ exportEvents.length = 0;
849
+ }
850
+ }
851
+ });
852
+
853
+
854
+
855
+
856
+ symbols.menu = function(x, y, width, height) {
857
+ var arr = [
858
+ 'M', x, y + 2.5,
859
+ 'L', x + width, y + 2.5,
860
+ 'M', x, y + height / 2 + 0.5,
861
+ 'L', x + width, y + height / 2 + 0.5,
862
+ 'M', x, y + height - 1.5,
863
+ 'L', x + width, y + height - 1.5
864
+ ];
865
+ return arr;
866
+ };
867
+
868
+ // Add the buttons on chart load
869
+ Chart.prototype.renderExporting = function() {
870
+ var chart = this,
871
+ exportingOptions = chart.options.exporting,
872
+ buttons = exportingOptions.buttons,
873
+ isDirty = chart.isDirtyExporting || !chart.exportSVGElements;
874
+
875
+ chart.buttonOffset = 0;
876
+ if (chart.isDirtyExporting) {
877
+ chart.destroyExport();
878
+ }
879
+
880
+ if (isDirty && exportingOptions.enabled !== false) {
881
+ chart.exportEvents = [];
882
+
883
+ objectEach(buttons, function(button) {
884
+ chart.addButton(button);
885
+ });
886
+
887
+ chart.isDirtyExporting = false;
888
+ }
889
+
890
+ // Destroy the export elements at chart destroy
891
+ addEvent(chart, 'destroy', chart.destroyExport);
892
+ };
893
+
894
+ Chart.prototype.callbacks.push(function(chart) {
895
+
896
+ function update(prop, options, redraw) {
897
+ chart.isDirtyExporting = true;
898
+ merge(true, chart.options[prop], options);
899
+ if (pick(redraw, true)) {
900
+ chart.redraw();
901
+ }
902
+
903
+ }
904
+
905
+ chart.renderExporting();
906
+
907
+ addEvent(chart, 'redraw', chart.renderExporting);
908
+
909
+ // Add update methods to handle chart.update and chart.exporting.update
910
+ // and chart.navigation.update.
911
+ each(['exporting', 'navigation'], function(prop) {
912
+ chart[prop] = {
913
+ update: function(options, redraw) {
914
+ update(prop, options, redraw);
915
+ }
916
+ };
917
+ });
918
+
919
+ // Uncomment this to see a button directly below the chart, for quick
920
+ // testing of export
921
+ /*
922
+ if (!chart.renderer.forExport) {
923
+ var button;
924
+
925
+ // View SVG Image
926
+ button = doc.createElement('button');
927
+ button.innerHTML = 'View SVG Image';
928
+ chart.renderTo.parentNode.appendChild(button);
929
+ button.onclick = function () {
930
+ var div = doc.createElement('div');
931
+ div.innerHTML = chart.getSVGForExport();
932
+ chart.renderTo.parentNode.appendChild(div);
933
+ };
934
+
935
+ // View SVG Source
936
+ button = doc.createElement('button');
937
+ button.innerHTML = 'View SVG Source';
938
+ chart.renderTo.parentNode.appendChild(button);
939
+ button.onclick = function () {
940
+ var pre = doc.createElement('pre');
941
+ pre.innerHTML = chart.getSVGForExport()
942
+ .replace(/</g, '\n&lt;')
943
+ .replace(/>/g, '&gt;');
944
+ chart.renderTo.parentNode.appendChild(pre);
945
+ };
946
+ }
947
+ // */
948
+ });
949
+
950
+ }(Highcharts));
951
+ }));