@progress/telerik-jquery-report-viewer 21.24.305 → 22.24.514

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/accessibility.js +218 -0
  3. package/dist/cjs/binder.js +172 -0
  4. package/dist/cjs/command.js +32 -0
  5. package/dist/cjs/commandSet.js +167 -0
  6. package/dist/cjs/controller.js +1207 -0
  7. package/dist/cjs/documentMapArea.js +168 -0
  8. package/dist/cjs/domUtils.js +50 -0
  9. package/dist/cjs/enums.js +52 -0
  10. package/dist/cjs/event-emitter.js +17 -0
  11. package/dist/cjs/events.js +23 -0
  12. package/dist/cjs/globalSettings.js +9 -0
  13. package/dist/cjs/history.js +131 -0
  14. package/dist/cjs/index.js +58 -0
  15. package/dist/cjs/jqueryThrottleDebounce.js +48 -0
  16. package/dist/cjs/kendo-jquery.js +4 -0
  17. package/dist/cjs/mainMenu.js +332 -0
  18. package/dist/cjs/mem-storage.js +44 -0
  19. package/dist/cjs/pagesArea.js +641 -0
  20. package/dist/cjs/parameterValidators.js +167 -0
  21. package/dist/cjs/parameters.js +921 -0
  22. package/dist/cjs/parametersArea.js +502 -0
  23. package/dist/cjs/perspectives.js +138 -0
  24. package/dist/cjs/print.js +166 -0
  25. package/dist/cjs/report-viewer/report-viewer-settings.js +138 -0
  26. package/dist/cjs/reportViewer.js +654 -0
  27. package/dist/cjs/scroll.js +537 -0
  28. package/dist/cjs/search.js +634 -0
  29. package/dist/cjs/sendEmail.js +435 -0
  30. package/dist/cjs/service-client-sentinel.js +52 -0
  31. package/dist/cjs/serviceClient.js +405 -0
  32. package/dist/cjs/sideMenu.js +225 -0
  33. package/dist/cjs/sr.js +164 -0
  34. package/dist/cjs/stringResources.js +11 -0
  35. package/dist/cjs/telerikReportViewer.kendo.js +60196 -0
  36. package/dist/cjs/telerikReportViewer.kendo.min.js +19776 -0
  37. package/dist/cjs/template-cache.js +39 -0
  38. package/dist/cjs/touch.js +86 -0
  39. package/dist/cjs/uiController.js +142 -0
  40. package/dist/cjs/uiFreezeCoordinator.js +281 -0
  41. package/dist/cjs/utils.js +492 -0
  42. package/dist/es/accessibility.js +214 -0
  43. package/dist/es/binder.js +168 -0
  44. package/dist/es/command.js +28 -0
  45. package/dist/es/commandSet.js +163 -0
  46. package/dist/es/controller.js +1203 -0
  47. package/dist/es/documentMapArea.js +164 -0
  48. package/dist/es/domUtils.js +43 -0
  49. package/dist/es/enums.js +41 -0
  50. package/dist/es/event-emitter.js +13 -0
  51. package/dist/es/events.js +19 -0
  52. package/dist/es/globalSettings.js +5 -0
  53. package/dist/es/history.js +127 -0
  54. package/dist/es/index.js +24 -0
  55. package/dist/es/jqueryThrottleDebounce.js +46 -0
  56. package/dist/es/kendo-jquery.js +1 -0
  57. package/dist/es/mainMenu.js +328 -0
  58. package/dist/es/mem-storage.js +40 -0
  59. package/dist/es/pagesArea.js +637 -0
  60. package/dist/es/parameterValidators.js +163 -0
  61. package/dist/es/parameters.js +916 -0
  62. package/dist/es/parametersArea.js +498 -0
  63. package/dist/es/perspectives.js +134 -0
  64. package/dist/es/print.js +162 -0
  65. package/dist/es/report-viewer/report-viewer-settings.js +134 -0
  66. package/dist/es/reportViewer.js +650 -0
  67. package/dist/es/scroll.js +533 -0
  68. package/dist/es/search.js +630 -0
  69. package/dist/es/sendEmail.js +431 -0
  70. package/dist/es/service-client-sentinel.js +48 -0
  71. package/dist/es/serviceClient.js +401 -0
  72. package/dist/es/sideMenu.js +221 -0
  73. package/dist/es/sr.js +162 -0
  74. package/dist/es/stringResources.js +7 -0
  75. package/dist/es/telerikReportViewer.kendo.js +60194 -0
  76. package/dist/es/telerikReportViewer.kendo.min.js +19774 -0
  77. package/dist/es/template-cache.js +35 -0
  78. package/dist/es/touch.js +82 -0
  79. package/dist/es/uiController.js +138 -0
  80. package/dist/es/uiFreezeCoordinator.js +277 -0
  81. package/dist/es/utils.js +447 -0
  82. package/dist/font/font-icons.css +4 -4
  83. package/dist/font/font-icons.min.css +3 -3
  84. package/dist/js/telerikReportViewer.js +8562 -8606
  85. package/dist/js/telerikReportViewer.min.js +1 -17
  86. package/dist/js/telerikReportViewer.stringResources.js +166 -173
  87. package/dist/styles/telerikReportViewer.css +1 -1
  88. package/dist/styles/telerikReportViewer.min.css +1 -1
  89. package/dist/templates/telerikReportViewerTemplate-FA.html +3 -3
  90. package/dist/templates/telerikReportViewerTemplate.html +3 -3
  91. package/package.json +13 -7
  92. /package/dist/font/{ReportingIcons-18.0.24.305.ttf → ReportingIcons-18.1.24.514.ttf} +0 -0
@@ -0,0 +1,39 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var utils = require('./utils.js');
6
+
7
+ const TemplateCache = function() {
8
+ var cache = {};
9
+ return {
10
+ load: function(url, serviceUrl, client) {
11
+ var p = cache[url];
12
+ if (!p) {
13
+ cache[url] = p = client.get(url).then(function(html) {
14
+ var templates = {};
15
+ var styleSheets = [];
16
+ var baseUri = utils.rTrim(serviceUrl, "\\/") + "/";
17
+ html = utils.replaceAll(html, "{service}/", baseUri);
18
+ html = utils.replaceAll(html, "{service}", baseUri);
19
+ var viewerTemplate = $("<div></div>").html(html);
20
+ utils.each(viewerTemplate.find("template"), function(index, e) {
21
+ var $e = $(e);
22
+ templates[$e.attr("id")] = utils.trim($e.html(), "\n ");
23
+ });
24
+ utils.each(viewerTemplate.find("link"), function(index, e) {
25
+ styleSheets.push(utils.trim(e.outerHTML, "\n "));
26
+ });
27
+ styleSheets = utils.filterUniqueLastOccurance(styleSheets);
28
+ return {
29
+ templates,
30
+ styleSheets
31
+ };
32
+ });
33
+ }
34
+ return p;
35
+ }
36
+ };
37
+ }();
38
+
39
+ exports.TemplateCache = TemplateCache;
@@ -0,0 +1,86 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ function TouchBehavior(dom, options) {
6
+ var startDistance;
7
+ var ignoreTouch;
8
+ init(dom);
9
+ function init(element) {
10
+ if (typeof $.fn.kendoTouch === "function") {
11
+ try {
12
+ $(element).mousedown(function() {
13
+ ignoreTouch = true;
14
+ }).mouseup(function() {
15
+ ignoreTouch = false;
16
+ }).kendoTouch({
17
+ multiTouch: true,
18
+ enableSwipe: true,
19
+ swipe: function(e) {
20
+ if (!ignoreTouch) {
21
+ onSwipe(e);
22
+ }
23
+ },
24
+ gesturestart: function(e) {
25
+ if (!ignoreTouch) {
26
+ onGestureStart(e);
27
+ }
28
+ },
29
+ gestureend: function(e) {
30
+ if (!ignoreTouch) {
31
+ onGestureEnd(e);
32
+ }
33
+ },
34
+ gesturechange: function(e) {
35
+ if (!ignoreTouch) {
36
+ onGestureChange(e);
37
+ }
38
+ },
39
+ doubletap: function(e) {
40
+ if (!ignoreTouch) {
41
+ onDoubleTap(e);
42
+ }
43
+ },
44
+ touchstart: function(e) {
45
+ if (!ignoreTouch) {
46
+ fire("touchstart");
47
+ }
48
+ }
49
+ });
50
+ } catch (e) {
51
+ console.error("Instantiation of Kendo Touch threw an exception", e);
52
+ throw e;
53
+ }
54
+ }
55
+ }
56
+ function onDoubleTap(e) {
57
+ fire("doubletap", e);
58
+ }
59
+ function onGestureStart(e) {
60
+ startDistance = kendo.touchDelta(e.touches[0], e.touches[1]).distance;
61
+ }
62
+ function onGestureEnd(e) {
63
+ }
64
+ function onGestureChange(e) {
65
+ var current = kendo.touchDelta(e.touches[0], e.touches[1]).distance;
66
+ onPinch({
67
+ distance: current,
68
+ lastDistance: startDistance
69
+ });
70
+ startDistance = current;
71
+ }
72
+ function onSwipe(e) {
73
+ fire("swipe", e);
74
+ }
75
+ function onPinch(e) {
76
+ fire("pinch", e);
77
+ }
78
+ function fire(func, args) {
79
+ var handler = options[func];
80
+ if (typeof handler === "function") {
81
+ handler(args);
82
+ }
83
+ }
84
+ }
85
+
86
+ exports.TouchBehavior = TouchBehavior;
@@ -0,0 +1,142 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var enums = require('./enums.js');
6
+
7
+ function UIController(options) {
8
+ var stateFlags = {
9
+ ExportInProgress: 1 << 0,
10
+ PrintInProgress: 1 << 1,
11
+ RenderInProgress: 1 << 2
12
+ };
13
+ function getState(flags) {
14
+ return (state & flags) != 0;
15
+ }
16
+ function setState(flags, value) {
17
+ if (value) {
18
+ state |= flags;
19
+ } else {
20
+ state &= ~flags;
21
+ }
22
+ }
23
+ var controller = options.controller;
24
+ var historyManager = options.history;
25
+ var state = 0;
26
+ var refreshUI;
27
+ var commands = options.commands;
28
+ if (!controller) {
29
+ throw "No controller (telerikReporting.ReportViewerController) has been specified.";
30
+ }
31
+ function getDocumentMapState() {
32
+ var args = {};
33
+ controller.getDocumentMapState(args);
34
+ return args;
35
+ }
36
+ function getParametersAreaState() {
37
+ var args = {};
38
+ controller.getParametersAreaState(args);
39
+ return args;
40
+ }
41
+ function getSearchDialogState() {
42
+ var args = {};
43
+ controller.getSearchDialogState(args);
44
+ return args;
45
+ }
46
+ function getSendEmailDialogState() {
47
+ var args = {};
48
+ controller.getSendEmailDialogState(args);
49
+ return args;
50
+ }
51
+ function updateUI() {
52
+ if (!refreshUI) {
53
+ refreshUI = true;
54
+ window.setTimeout(function() {
55
+ try {
56
+ updateUICore();
57
+ } finally {
58
+ refreshUI = false;
59
+ }
60
+ }, 10);
61
+ }
62
+ }
63
+ function updateUICore() {
64
+ var rs = controller.getReportSource();
65
+ var pageCount = controller.getPageCount();
66
+ var currentPageNumber = controller.getCurrentPageNumber();
67
+ var hasReport = rs && rs.report;
68
+ var hasPages = hasReport && pageCount > 0;
69
+ var nextPage = hasPages && currentPageNumber < pageCount;
70
+ var prevPage = hasPages && currentPageNumber > 1;
71
+ var hasPage = hasPages && currentPageNumber;
72
+ var documentMapState = getDocumentMapState();
73
+ var parametersAreaState = getParametersAreaState();
74
+ var searchDialogState = getSearchDialogState();
75
+ var sendEmailDialogState = getSendEmailDialogState();
76
+ var renderInProgress = getState(stateFlags.RenderInProgress);
77
+ var printInProgress = getState(stateFlags.PrintInProgress);
78
+ var exportInProgress = getState(stateFlags.ExportInProgress);
79
+ commands.goToFirstPage.enabled(prevPage);
80
+ commands.goToPrevPage.enabled(prevPage);
81
+ commands.stopRendering.enabled(hasReport && renderInProgress);
82
+ commands.goToLastPage.enabled(nextPage);
83
+ commands.goToNextPage.enabled(nextPage);
84
+ commands.goToPage.enabled(hasPages);
85
+ commands.print.enabled(hasPages && !renderInProgress && !printInProgress);
86
+ commands.export.enabled(hasPages && !renderInProgress && !exportInProgress);
87
+ commands.refresh.enabled(hasReport);
88
+ commands.historyBack.enabled(historyManager && historyManager.canMoveBack());
89
+ commands.historyForward.enabled(historyManager && historyManager.canMoveForward());
90
+ commands.toggleDocumentMap.enabled(hasReport && documentMapState.enabled).checked(documentMapState.enabled && documentMapState.visible);
91
+ commands.toggleParametersArea.enabled(hasReport && parametersAreaState.enabled).checked(parametersAreaState.enabled && parametersAreaState.visible);
92
+ commands.togglePrintPreview.enabled(hasPages).checked(controller.getViewMode() == enums.ViewModes.PRINT_PREVIEW);
93
+ commands.pageMode.enabled(hasPages).checked(controller.getPageMode() == enums.PageModes.CONTINUOUS_SCROLL);
94
+ commands.zoom.enabled(hasPage);
95
+ commands.zoomIn.enabled(hasPage);
96
+ commands.zoomOut.enabled(hasPage);
97
+ commands.toggleZoomMode.enabled(hasPage).checked(controller.getScaleMode() == enums.ScaleModes.FIT_PAGE || controller.getScaleMode() == enums.ScaleModes.FIT_PAGE_WIDTH);
98
+ commands.toggleSearchDialog.enabled(hasPages).checked(searchDialogState.visible);
99
+ commands.toggleSendEmailDialog.enabled(hasPages).checked(sendEmailDialogState.visible);
100
+ controller.updateUI(null);
101
+ controller.pageNumberChange(currentPageNumber);
102
+ controller.pageCountChange(pageCount);
103
+ }
104
+ controller.setParametersAreaVisible(updateUI);
105
+ controller.setDocumentMapVisible(updateUI);
106
+ controller.updateUIInternal(updateUI);
107
+ controller.setSearchDialogVisible(updateUI);
108
+ controller.setSendEmailDialogVisible(updateUI);
109
+ controller.scaleModeChanged(updateUI);
110
+ controller.currentPageChanged(updateUI);
111
+ controller.beforeLoadReport(function() {
112
+ setState(stateFlags.RenderInProgress, true);
113
+ updateUI();
114
+ });
115
+ controller.reportLoadProgress(updateUI);
116
+ controller.reportLoadComplete(function() {
117
+ setState(stateFlags.RenderInProgress, false);
118
+ updateUI();
119
+ });
120
+ controller.reportSourceChanged(updateUI);
121
+ controller.viewModeChanged(updateUI);
122
+ controller.pageModeChanged(function() {
123
+ updateUI();
124
+ });
125
+ controller.setUIState(function(event, args) {
126
+ setState(stateFlags[args.operationName], args.inProgress);
127
+ updateUI();
128
+ });
129
+ controller.error(function() {
130
+ setState(stateFlags.ExportInProgress, false);
131
+ setState(stateFlags.PrintInProgress, false);
132
+ setState(stateFlags.RenderInProgress, false);
133
+ updateUI();
134
+ });
135
+ controller.renderingStopped(function() {
136
+ setState(stateFlags.RenderInProgress, false);
137
+ updateUI();
138
+ });
139
+ updateUI();
140
+ }
141
+
142
+ exports.UIController = UIController;
@@ -0,0 +1,281 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var utils = require('./utils.js');
6
+
7
+ var UIFreezeCoordinator = {
8
+ $placeholder: null,
9
+ $scrollableContainer: null,
10
+ itemsInitialState: {},
11
+ // Holds all items initial position per container
12
+ xFrozenAreasBounds: {},
13
+ //Holds the bounds of the frozen areas by X per container
14
+ yFrozenAreasBounds: {},
15
+ //Holds the bounds of the frozen areas by Y per container
16
+ freezeMaxZIndex: {},
17
+ zIndex: 1,
18
+ freezeBGColor: {},
19
+ // Holds default background-color value per container
20
+ currentlyfreezedContainer: {
21
+ vertical: {},
22
+ horizontal: {}
23
+ },
24
+ //Holds whether freezing has been applied per container.
25
+ isInitialize: false,
26
+ scaleFactor: null,
27
+ /**
28
+ * Initialize the uiFreezeCoordinator object
29
+ * Takes one parameter
30
+ * - $placeholder - PageArea jQuery DOM element
31
+ */
32
+ init: function($placeholder) {
33
+ this.$placeholder = $placeholder;
34
+ this.$scrollableContainer = $placeholder.find(".trv-page-container");
35
+ if (this.isInitialize) {
36
+ this.reset($placeholder);
37
+ }
38
+ this._attachToScrollEvent();
39
+ this.isInitialize = true;
40
+ },
41
+ reset: function($placeholder) {
42
+ this.$placeholder = $placeholder;
43
+ this.$scrollableContainer = $placeholder.find(".trv-page-container");
44
+ this.itemsInitialState = {};
45
+ this.xFrozenAreasBounds = {};
46
+ this.yFrozenAreasBounds = {};
47
+ this.currentlyfreezedContainer = {
48
+ vertical: {},
49
+ horizontal: {}
50
+ };
51
+ },
52
+ setScaleFactor: function(scale) {
53
+ this.scaleFactor = scale;
54
+ },
55
+ /**
56
+ * Initializing scroll listener
57
+ */
58
+ _attachToScrollEvent: function() {
59
+ var thisInstance = this;
60
+ this.$scrollableContainer.scroll(function updateFreezeUIOnScroll() {
61
+ var $freezeItems = thisInstance.$scrollableContainer.find("div[data-sticky-id]");
62
+ if ($freezeItems.length) {
63
+ var tableIDs = $freezeItems.map(function(index2, $element) {
64
+ return $($element).attr("data-sticky-id");
65
+ }).get();
66
+ var uniqueIDs = tableIDs.filter(function(item, index2) {
67
+ return index2 === tableIDs.indexOf(item);
68
+ });
69
+ var scrollableContainerScrollTop = thisInstance.$scrollableContainer.scrollTop();
70
+ var scrollableContainerScrollLeft = thisInstance.$scrollableContainer.scrollLeft();
71
+ for (var index = 0; index < uniqueIDs.length; index++) {
72
+ var freezeItemsContainerID = uniqueIDs[index];
73
+ if (!thisInstance.itemsInitialState[freezeItemsContainerID]) {
74
+ thisInstance._saveFreezeItemsInitialState(freezeItemsContainerID);
75
+ }
76
+ thisInstance._updateFreezeItemsOnScroll(
77
+ freezeItemsContainerID,
78
+ scrollableContainerScrollTop,
79
+ scrollableContainerScrollLeft
80
+ );
81
+ }
82
+ }
83
+ });
84
+ },
85
+ _saveFreezeItemsInitialState: function(freezeItemsContainerID) {
86
+ var $allFreezeItems = $("[data-sticky-direction][data-sticky-id='" + freezeItemsContainerID + "']");
87
+ var $freezeActions = $("[data-reporting-action][data-sticky-id='" + freezeItemsContainerID + "']");
88
+ var yAreaBounds;
89
+ var xAreaBounds;
90
+ this.itemsInitialState[freezeItemsContainerID] = {};
91
+ this.freezeBGColor[freezeItemsContainerID] = $("[data-id='" + freezeItemsContainerID + "']").attr("data-sticky-bg-color");
92
+ for (var index = 0; index < $allFreezeItems.length; index++) {
93
+ var $item = $($allFreezeItems[index]);
94
+ var scrollDirection = $item.attr("data-sticky-direction");
95
+ var itemID = $item.attr("data-id");
96
+ var itemPosition = $item.position();
97
+ var scaledItemPosition = { top: itemPosition.top / this.scaleFactor, left: itemPosition.left / this.scaleFactor };
98
+ var itemBounds = utils.rectangle(scaledItemPosition.left, scaledItemPosition.top, $item.outerWidth(true) * this.scaleFactor, $item.outerHeight(true) * this.scaleFactor);
99
+ switch (scrollDirection) {
100
+ case "Vertical":
101
+ yAreaBounds = yAreaBounds ? yAreaBounds.union(itemBounds) : itemBounds;
102
+ break;
103
+ case "Horizontal":
104
+ xAreaBounds = xAreaBounds ? xAreaBounds.union(itemBounds) : itemBounds;
105
+ break;
106
+ }
107
+ this._saveFreezeItemInitialState(freezeItemsContainerID, $item, itemID, scaledItemPosition);
108
+ }
109
+ this.freezeMaxZIndex[freezeItemsContainerID] = $freezeActions.length ? $freezeActions.css("zIndex") : this.zIndex;
110
+ this.yFrozenAreasBounds[freezeItemsContainerID] = yAreaBounds;
111
+ this.xFrozenAreasBounds[freezeItemsContainerID] = xAreaBounds;
112
+ },
113
+ /**
114
+ * Save the freeze UI item initial position based on the wrapper element and current page
115
+ * - freezeItemsContainerID - string. A parent/wrapper element identifier
116
+ * - $item - JQuery DOM element of the freezed item
117
+ * - itemID - string. A ID of the freeze UI item
118
+ * - position - object. Contains the top and left values
119
+ */
120
+ _saveFreezeItemInitialState: function(freezeItemsContainerID, $item, itemID, position) {
121
+ var itemBgColor = $item.css("background-color");
122
+ var hasInitialBgColor = this._hasSetBgColor(itemBgColor);
123
+ var itemState = {
124
+ top: position.top,
125
+ left: position.left,
126
+ zIndex: $item.css("zIndex"),
127
+ hasBgColor: hasInitialBgColor
128
+ };
129
+ this.itemsInitialState[freezeItemsContainerID][itemID] = itemState;
130
+ },
131
+ _updateFreezeItemsOnScroll: function(freezeItemsContainerID, scrollableContainerScrollTop, scrollableContainerScrollLeft) {
132
+ var $elementWrapper = $("div[data-id='" + freezeItemsContainerID + "']");
133
+ if (this._isInScrollVisibleArea($elementWrapper)) {
134
+ var $pageContainer = $elementWrapper.closest(".trv-report-page");
135
+ var pageContainerPosition = $pageContainer.position();
136
+ var pageContainerMargin = parseFloat($pageContainer.css("margin-top"));
137
+ var pageContainerTopOffset = parseFloat($pageContainer.css("padding-top"));
138
+ var pageContainerLeftOffset = parseFloat($pageContainer.css("padding-left"));
139
+ var pageContainerBorderTopWidth = parseFloat($pageContainer.css("border-top-width"));
140
+ var pageContainerBorderLeftWidth = parseFloat($pageContainer.css("border-left-width"));
141
+ var $rowHeaders = $("[data-sticky-direction*='Horizontal'][data-sticky-id='" + freezeItemsContainerID + "']");
142
+ var $colHeaders = $("[data-sticky-direction*='Vertical'][data-sticky-id='" + freezeItemsContainerID + "']");
143
+ var hasFixRow = $rowHeaders.length > 0;
144
+ var hasFixColumn = $colHeaders.length > 0;
145
+ var elementWrapperPosition = $elementWrapper.position();
146
+ var elementWrapperTopPosition = elementWrapperPosition.top + pageContainerPosition.top + pageContainerMargin + pageContainerTopOffset + pageContainerBorderTopWidth;
147
+ var elementWrapperLeftPosition = elementWrapperPosition.left + pageContainerLeftOffset + pageContainerBorderLeftWidth;
148
+ var verticalMoveOffset = scrollableContainerScrollTop - elementWrapperTopPosition;
149
+ var horizontalMoveOffset = scrollableContainerScrollLeft - elementWrapperLeftPosition;
150
+ if (hasFixColumn && verticalMoveOffset > 0) {
151
+ if (scrollableContainerScrollTop <= $elementWrapper.outerHeight() * this.scaleFactor + elementWrapperTopPosition - this.yFrozenAreasBounds[freezeItemsContainerID].height) {
152
+ this.currentlyfreezedContainer.vertical[freezeItemsContainerID] = true;
153
+ this._updateUIElementsPosition($colHeaders, "top", verticalMoveOffset / this.scaleFactor, freezeItemsContainerID);
154
+ }
155
+ } else {
156
+ if (this.currentlyfreezedContainer.vertical[freezeItemsContainerID]) {
157
+ delete this.currentlyfreezedContainer.vertical[freezeItemsContainerID];
158
+ this._updateUIElementsPosition($colHeaders, "top", -1, freezeItemsContainerID);
159
+ }
160
+ }
161
+ if (hasFixRow && horizontalMoveOffset > 0) {
162
+ if (scrollableContainerScrollLeft <= $elementWrapper.outerWidth() * this.scaleFactor + elementWrapperLeftPosition - this.xFrozenAreasBounds[freezeItemsContainerID].width) {
163
+ this.currentlyfreezedContainer.horizontal[freezeItemsContainerID] = true;
164
+ this._updateUIElementsPosition($rowHeaders, "left", horizontalMoveOffset / this.scaleFactor, freezeItemsContainerID);
165
+ }
166
+ } else {
167
+ if (this.currentlyfreezedContainer.horizontal[freezeItemsContainerID]) {
168
+ delete this.currentlyfreezedContainer.horizontal[freezeItemsContainerID];
169
+ this._updateUIElementsPosition($rowHeaders, "left", -1, freezeItemsContainerID);
170
+ }
171
+ }
172
+ } else {
173
+ if (this.currentlyfreezedContainer.horizontal[freezeItemsContainerID] || this.currentlyfreezedContainer.vertical[freezeItemsContainerID]) {
174
+ this._resetToDefaultPosition(freezeItemsContainerID);
175
+ }
176
+ }
177
+ },
178
+ /**
179
+ * Move all freeze items to their initial position
180
+ * Takes one parameters
181
+ * - freezeItemsContainerID - string. A parent/wrapper element identifier
182
+ */
183
+ _resetToDefaultPosition: function(freezeItemsContainerID) {
184
+ var $rowHeaders = $("[data-sticky-direction*='Horizontal'][data-sticky-id='" + freezeItemsContainerID + "']");
185
+ var $colHeaders = $("[data-sticky-direction*='Vertical'][data-sticky-id='" + freezeItemsContainerID + "']");
186
+ this._updateUIElementsPosition($colHeaders, "top", -1, freezeItemsContainerID);
187
+ this._updateUIElementsPosition($rowHeaders, "left", -1, freezeItemsContainerID);
188
+ delete this.currentlyfreezedContainer.horizontal[freezeItemsContainerID];
189
+ delete this.currentlyfreezedContainer.vertical[freezeItemsContainerID];
190
+ },
191
+ /**
192
+ * Update the freeze elements position
193
+ * Takes four parameters
194
+ * - targetElements -Array. Collection of DOM element, that has a freeze attribute
195
+ * - position - string. Indicates which position property to be updated - top or left
196
+ * - offset - integer. The value of the increase that should be applied.
197
+ * If it is negative number, should not move the items and it should set their initial position
198
+ * - freezeItemsContainerID - string. A parent/wrapper element identifier
199
+ */
200
+ _updateUIElementsPosition: function(targetElements, position, offset, freezeItemsContainerID) {
201
+ for (var index = 0; index < targetElements.length; index++) {
202
+ var $item = $(targetElements[index]);
203
+ var itemFreezeDirection = $item.attr("data-sticky-direction");
204
+ var isFrozenBothDirection = itemFreezeDirection.indexOf(",") > 0;
205
+ var itemID = $item.attr("data-id");
206
+ var itemInitialState = this.itemsInitialState[freezeItemsContainerID][itemID];
207
+ var itemNewPostion = itemInitialState[position];
208
+ var initialZIndex = itemInitialState["zIndex"];
209
+ var hasInitialBgColor = itemInitialState["hasBgColor"];
210
+ var zIndexValue = 1;
211
+ var maxZIndex = this.freezeMaxZIndex[freezeItemsContainerID] ? this.freezeMaxZIndex[freezeItemsContainerID] : zIndexValue;
212
+ if (isFrozenBothDirection) {
213
+ zIndexValue = initialZIndex !== "auto" ? initialZIndex : maxZIndex + 2;
214
+ } else {
215
+ zIndexValue = initialZIndex !== "auto" ? initialZIndex + 1 : maxZIndex;
216
+ }
217
+ var newStyleRules = {
218
+ "z-index": zIndexValue
219
+ };
220
+ if (offset >= 0) {
221
+ itemNewPostion = itemNewPostion + offset;
222
+ } else {
223
+ newStyleRules["z-index"] = initialZIndex;
224
+ }
225
+ if (!hasInitialBgColor) {
226
+ this._applyBgColorOnScroll($item, isFrozenBothDirection, hasInitialBgColor, offset >= 0, freezeItemsContainerID);
227
+ }
228
+ newStyleRules[position] = itemNewPostion + "px";
229
+ $item.css(newStyleRules);
230
+ }
231
+ },
232
+ _applyBgColorOnScroll: function($item, isItemFrozenBothDirection, hasInitialBgColor, shouldApplyBGColor, freezeItemsContainerID) {
233
+ if ($item.is("img")) {
234
+ return true;
235
+ }
236
+ if (isItemFrozenBothDirection && this._isFrozen(freezeItemsContainerID) && !hasInitialBgColor) {
237
+ $item.css("background-color", this.freezeBGColor[freezeItemsContainerID]);
238
+ return true;
239
+ }
240
+ if (shouldApplyBGColor) {
241
+ $item.css("background-color", this.freezeBGColor[freezeItemsContainerID]);
242
+ } else {
243
+ $item.css("background-color", "initial");
244
+ }
245
+ },
246
+ _hasSetBgColor: function(bgColorValue) {
247
+ return utils.getColorAlphaValue(bgColorValue) > 0;
248
+ },
249
+ _isFrozen: function(freezeItemsContainerID) {
250
+ return this.currentlyfreezedContainer.horizontal[freezeItemsContainerID] || this.currentlyfreezedContainer.vertical[freezeItemsContainerID];
251
+ },
252
+ /**
253
+ * Checks if an UI element is in the visible part of the scrollable container
254
+ * Takes one parameters
255
+ * - $element - JQuery DOM element
256
+ */
257
+ _isInScrollVisibleArea: function($element) {
258
+ var $page = $element.closest(".trv-report-page");
259
+ var elementPosition = $element.position();
260
+ return this._isVisibleVertically($element, $page, elementPosition) && this._isVisibleHorizontally($element, $page, elementPosition);
261
+ },
262
+ _isVisibleHorizontally: function($element, $page, elementPosition) {
263
+ var pageLeftOffset = parseFloat($page.css("padding-left"));
264
+ var scrollableContainerLeftScrollPosition = this.$scrollableContainer.scrollLeft();
265
+ var scrollableContainerWidth = this.$scrollableContainer.width();
266
+ var elementWidth = $element.outerWidth(true) * this.scaleFactor;
267
+ var elementLeftOffset = elementPosition.left + pageLeftOffset;
268
+ return elementLeftOffset > scrollableContainerLeftScrollPosition - elementWidth && elementLeftOffset < scrollableContainerLeftScrollPosition + elementWidth + scrollableContainerWidth;
269
+ },
270
+ _isVisibleVertically: function($element, $page, elementPosition) {
271
+ var pageTopOffset = parseFloat($page.css("padding-top"));
272
+ var pagePosition = $page.position();
273
+ var scrollableContainerTopScrollPosition = this.$scrollableContainer.scrollTop();
274
+ var scrollableContainerHeight = this.$scrollableContainer.height();
275
+ var elementHeight = $element.outerHeight(true) * this.scaleFactor;
276
+ var elementTopOffset = elementPosition.top + pageTopOffset + pagePosition.top;
277
+ return elementTopOffset > scrollableContainerTopScrollPosition - elementHeight && elementTopOffset < scrollableContainerTopScrollPosition + elementHeight + scrollableContainerHeight;
278
+ }
279
+ };
280
+
281
+ exports.UIFreezeCoordinator = UIFreezeCoordinator;