-
Notifications
You must be signed in to change notification settings - Fork 77
/
ui-grid.autoResize.js
114 lines (102 loc) · 3.37 KB
/
ui-grid.autoResize.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*!
* ui-grid - v4.12.0 - 2023-01-12
* http://ui-grid.info/
* Copyright (c) 2023 UI Grid Team; License: MIT
*/
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 605:
/***/ (() => {
(function() {
'use strict';
/**
* @ngdoc overview
* @name ui.grid.autoResize
*
* @description
*
* #ui.grid.autoResize
*
* <div class="alert alert-warning" role="alert"><strong>Beta</strong> This feature is ready for testing, but it either hasn't seen a lot of use or has some known bugs.</div>
*
* This module provides auto-resizing functionality to UI-Grid.
*/
var module = angular.module('ui.grid.autoResize', ['ui.grid']);
/**
* @ngdoc directive
* @name ui.grid.autoResize.directive:uiGridAutoResize
* @element div
* @restrict A
*
* @description Stacks on top of the ui-grid directive and
* adds the a watch to the grid's height and width which refreshes
* the grid content whenever its dimensions change.
*
*/
module.directive('uiGridAutoResize', ['gridUtil', function(gridUtil) {
return {
require: 'uiGrid',
scope: false,
link: function($scope, $elm, $attrs, uiGridCtrl) {
var debouncedRefresh;
function getDimensions() {
return {
width: gridUtil.elementWidth($elm),
height: gridUtil.elementHeight($elm)
};
}
function refreshGrid(prevWidth, prevHeight, width, height) {
if ($elm[0].offsetParent !== null) {
uiGridCtrl.grid.gridWidth = width;
uiGridCtrl.grid.gridHeight = height;
uiGridCtrl.grid.queueGridRefresh()
.then(function() {
uiGridCtrl.grid.api.core.raise.gridDimensionChanged(prevHeight, prevWidth, height, width);
});
}
}
debouncedRefresh = gridUtil.debounce(refreshGrid, 400);
$scope.$watchCollection(getDimensions, function(newValues, oldValues) {
if (!angular.equals(newValues, oldValues)) {
debouncedRefresh(oldValues.width, oldValues.height, newValues.width, newValues.height);
}
});
}
};
}]);
})();
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
__webpack_require__(605);
})();
/******/ })()
;