Skip to content

Commit 36f462b

Browse files
committed
Merge pull request #1 from angular-ui/master
Updating
2 parents 43e423e + aa56355 commit 36f462b

File tree

144 files changed

+9787
-4520
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+9787
-4520
lines changed

.editorconfig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
3+
# editorconfig.org
4+
5+
root = true
6+
7+
8+
[*]
9+
10+
# Change these settings to your own preference
11+
indent_style = space
12+
indent_size = 2
13+
14+
# We recommend you to keep these unchanged
15+
end_of_line = lf
16+
charset = utf-8
17+
trim_trailing_whitespace = true
18+
insert_final_newline = true
19+
20+
[*.md]
21+
trim_trailing_whitespace = false

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ node_js:
44
- '0.10'
55

66
notifications:
7-
irc: "chat.freenode.net#ui-grid"
87
webhooks:
98
urls:
109
- https://webhooks.gitter.im/e/c9dc628573cc153706fa

CHANGELOG.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,64 @@
1+
<a name="v3.0.0-rc.21"></a>
2+
### v3.0.0-rc.21 (2015-04-28)
3+
4+
5+
#### Bug Fixes
6+
7+
* **Expandable:** Run with lower priority than ngIf ([949013c3](http://github.com/angular-ui/ng-grid/commit/949013c332c5af1b3e37b1d3fa515dfd96c8acb2), closes [#2804](http://github.com/angular-ui/ng-grid/issues/2804))
8+
* **RTL:**
9+
* Use Math.abs for normalizing negatives ([4acbdc1a](http://github.com/angular-ui/ng-grid/commit/4acbdc1a58d8043d60e3a62d1126b0f69bc6ee86))
10+
* Use feature detection to determine RTL ([fbb36319](http://github.com/angular-ui/ng-grid/commit/fbb363197ab3975411589dfa0904495f861795c0), closes [#1689](http://github.com/angular-ui/ng-grid/issues/1689))
11+
* **cellNav:** fix null ref issue in navigate event for oldRowColumn scrollTo should not setF ([02b05cae](http://github.com/angular-ui/ng-grid/commit/02b05cae6d5385e01d00f812662f16009130c647))
12+
* **pinning:** restore correct width state ([4ffaaf26](http://github.com/angular-ui/ng-grid/commit/4ffaaf26774bae7f52bf4956f45243f6c7dd53a3))
13+
* **scrolling:** Fix for #3260 atTop/Bottom/Left/Right needed tweaking ([89461bcb](http://github.com/angular-ui/ng-grid/commit/89461bcbcfdfc527655c398df19555738fa9bd63))
14+
* **selection:**
15+
* allow rowSelection to be navigable if using cellNav; allow rowSelection via the ([95ce7b1b](http://github.com/angular-ui/ng-grid/commit/95ce7b1b694b23f1a7506cf4f6a32d0ae384697c))
16+
* allow rowSelection to be navigable if using cellNav; allow rowSelection via the ([3d5d6031](http://github.com/angular-ui/ng-grid/commit/3d5d603178f0fcb4cc2abab6ce637c1dd6face8d))
17+
* **uiGrid:**
18+
* Use margins rather than floats for pinning ([1373b99e](http://github.com/angular-ui/ng-grid/commit/1373b99e1e1680184270d61bca88124efd7a4c14), closes [#2997](http://github.com/angular-ui/ng-grid/issues/2997), [#NaN](http://github.com/angular-ui/ng-grid/issues/NaN))
19+
* Wait for grid to get dimensions ([e7dfb8c2](http://github.com/angular-ui/ng-grid/commit/e7dfb8c2dfac69bb3a38f7253062367671fec56d))
20+
* **uiGridColumnMenu:** Position relatively ([9d918052](http://github.com/angular-ui/ng-grid/commit/9d9180520d8d6fd16b897ba4b9fbfc4bb4860ea9), closes [#2319](http://github.com/angular-ui/ng-grid/issues/2319))
21+
* **uiGridFooter:** Watch for col change ([1f9100de](http://github.com/angular-ui/ng-grid/commit/1f9100defb1489bed46515fb859aed9c9a090e73), closes [#2686](http://github.com/angular-ui/ng-grid/issues/2686))
22+
* **uiGridHeader:**
23+
* Use parseInt on header heights ([98ed0104](http://github.com/angular-ui/ng-grid/commit/98ed01049015b22caddb651b1884f6e383fc58aa))
24+
* Allow header to shrink in size ([7c5cdca1](http://github.com/angular-ui/ng-grid/commit/7c5cdca1f471a0a3c1ef340fe65af268df68cae3), closes [#3138](http://github.com/angular-ui/ng-grid/issues/3138))
25+
26+
27+
#### Features
28+
29+
* **saveState:** add pinning to save state ([b0d943a8](http://github.com/angular-ui/ng-grid/commit/b0d943a82a1d5c64808b759c8b96833e66380b02))
30+
31+
32+
#### Breaking Changes
33+
34+
* gridUtil will no longer calculate dimensions of hidden
35+
elements
36+
([e7dfb8c2](http://github.com/angular-ui/ng-grid/commit/e7dfb8c2dfac69bb3a38f7253062367671fec56d))
37+
* Two events are now emitted on scroll:
38+
39+
grid.api.core.ScrollBegin
40+
grid.api.core.ScrollEnd
41+
42+
Before:
43+
grid.api.core.ScrollEvent
44+
After:
45+
grid.api.core.ScrollBegin
46+
47+
ScrollToIfNecessary and ScrollTo moved from cellNav to core and grid removed from arguments
48+
Before:
49+
grid.api.cellNav.ScrollToIfNecessary(grid, gridRow, gridCol)
50+
grid.api.cellNav.ScrollTo(grid, rowEntity, colDef)
51+
52+
After:
53+
grid.api.core.ScrollToIfNecessary(gridRow, gridCol)
54+
grid.api.core.ScrollTo(rowEntity, colDef)
55+
56+
GridEdit/cellNav
57+
When using cellNav, a cell no longer receives focus. Instead the viewport always receives focus. This eliminated many bugs associated with scrolling and focus.
58+
59+
If you have a custom editor, you will no longer receive keyDown/Up events from the readonly cell. Use the cellNav api viewPortKeyDown to capture any needed keydown events. see GridEdit.js for an example
60+
([052c2321](http://github.com/angular-ui/ng-grid/commit/052c2321f97b37f860c769dcbd2e8d9094cf2bbf))
61+
162
<a name="v3.0.0-rc.20"></a>
263
### v3.0.0-rc.20 (2015-02-24)
364

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-ui-grid",
3-
"version": "3.0.0-rc.20",
3+
"version": "3.0.0-rc.21",
44
"homepage": "http://ui-grid.info",
55
"repository": {
66
"type": "git",

misc/api/design-rendering-cycle.ngdoc

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
@ngdoc overview
2+
@name Rendering Cycle
3+
@module
4+
@description
5+
6+
The core grid rendering cycle is executed whenever the grid needs re-rendering. There are a number of core methods,
7+
with some of those methods able to be called individually.
8+
9+
### Current
10+
The key method is `grid.refresh`. This method updates the rows and columns in the grid, then redraws and resizes the grid.
11+
12+
- grid.refresh
13+
- rowsProcessors
14+
- setVisibleRows
15+
- columnsProcessors
16+
- setVisibleColumns
17+
- redrawInPlace
18+
- refreshCanvas
19+
20+
By preference grid.refresh is called through a debounce function - grid.queueGridRefresh. If you use this method you are
21+
telling the grid that you want a refresh, but you're allowing the grid to consolidate all refreshes from the current digest cycle
22+
and process just once.
23+
24+
A similar method, `grid.refreshRows` also exists, this is the same as grid.refresh except that it doesn't run `columnsProcessors`
25+
or `setVisibleColumns`.
26+
27+
The rows and columns processors are focused on ordering and determining the visibility of columns and rows. They include functions
28+
such as sorting and filtering (impacting order and visibility of rows), grouping rows (which adds extra rows, and changes the ordering
29+
and widths of columns), and pinning, which changes which render container particular columns are in.
30+
31+
`redrawInPlace` determines the correct scroll percentage in the grid, and therefore which of the rows and columns should currently
32+
be visible in the viewport.
33+
34+
`refreshCanvas` is a complicated method that determines the sizing of each of the grid elements. In some cases it is currently iterative,
35+
for example it determines header height by rendering each of the column headers, and determining the maximum rendered height. This largely
36+
appears to be to accomodate filters.
37+
38+
- refreshCanvas
39+
- buildStyles
40+
- $timeout - calcHeaders (this is inline - should it be a style computation? It isn't a promise, and doesn't wait on the buildStyles
41+
promise, but it does run in a timeout. Conversely, it creates a promise that it resolves - but it doesn't wait for the header calc to
42+
complete before resolving the promise)
43+
- may call buildStyles again if it decides headerHeight has changed
44+
45+
The style builders include:
46+
47+
- `GridRenderContainer.updateColumnWidths`, which calculates column widths based on the defined settings, including resolving * and ** etc. No rendering
48+
is involved - all based on the availableWidth. This may be the source of some of the iteration - because availableWidth must in some way be
49+
based on columnWidth - the canvas doesn't really have an available width. I also have question on why we calculate widths on the grid
50+
and not on the renderContainer, that may be another source of iteration. Having said that, things like % and * probably apply to the
51+
full grid width, not to just a container, and we wouldn't expect a column to change width when it changed container (e.g. when we pinned it)
52+
- `uiGridRenderContainer.update()`, which is called for each renderContainer. It determines the
53+
width of each column in the render container, and the width of the overall render container.
54+
- `Grid.prototype.getFooterStyles()`, sets the columnFooterHeight and the gridFooterHeight based on fixed values declared in the options
55+
- when there are multiple renderContainers (e.g. a left container), the non-body render containers appear to execute first
56+
- `ui-pinned-container.updateContainerDimensions()`: sets the width of a pinned container. How does this interact with render container width?
57+
58+
### Vision
59+
The vision is to make the style calculations more deterministic, and remove any iteration or other dependencies. A single pass through
60+
refreshCanvas should return a correctly sized grid.
61+
62+
To achieve this, we really need to:
63+
64+
- calculate all sizing in code, without reference to the sizing of rendered grid elements. We already do most of this for rows
65+
and columns, the main gap seems to be grid header
66+
- we could reference rendered size to determine the grid's available size (if we want to), which could allow the grid to be more
67+
responsive. Probably we already do this.
68+
- calculate the column widths and element heights
69+
- layout all the columns - what render container they're in etc, then size the render containers
70+
- calculate the overall grid sizing based on all the elements (headerHeight, footerHeight, container widths etc)
71+
- render
72+
73+
Thinking only at this stage!!

misc/demo/grid-save.html

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<!DOCTYPE html>
2+
<html class="no-js" ng-app="test"><!--<![endif]-->
3+
<head>
4+
<meta charset="utf-8">
5+
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
6+
<title></title>
7+
<meta content="width=device-width" name="viewport">
8+
9+
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css" />
10+
<link href="/dist/release/ui-grid.css" rel="stylesheet">
11+
12+
<!--<script src="https://code.jquery.com/jquery-1.11.1.js"></script>-->
13+
<script src="/lib/test/angular/1.2.26/angular.js"></script>
14+
<script src="/dist/release/ui-grid.js"></script>
15+
16+
<style>
17+
body {
18+
padding: 60px;
19+
min-height: 600px;
20+
}
21+
.grid {
22+
width: 500px;
23+
height: 400px;
24+
}
25+
</style>
26+
</head>
27+
<body ng-controller="Main">
28+
29+
<h2>Grid</h2>
30+
<div ui-grid="gridOptions" class="grid" ui-grid-save-state ui-grid-selection ui-grid-cellNav ui-grid-resize-columns ui-grid-move-columns ui-grid-pinning ></div>
31+
<button id="save" type="button" class="btn btn-success" ng-click="saveState()">Save</button>
32+
<button id="restore" type="button" class="btn btn-success" ng-click="restoreState()">Restore</button>
33+
34+
<br>
35+
<br>
36+
37+
<script>
38+
var app = angular.module('test', ['ui.grid', 'ui.grid.pinning', 'ui.grid.resizeColumns', 'ui.grid.saveState']);
39+
app.controller('Main', function($scope, $http) {
40+
$scope.gridOptions = {};
41+
$scope.gridOptions.columnDefs = [
42+
{ name:'id', width:50 },
43+
{ name:'name', width:100, pinnedLeft:true },
44+
{ name:'age', width:100, pinnedRight:true },
45+
{ name:'address.street', width:150 },
46+
{ name:'address.city', width:150 },
47+
{ name:'address.state', width:50 },
48+
{ name:'address.zip', width:50 },
49+
{ name:'company', width:100 },
50+
{ name:'email', width:100 },
51+
{ name:'phone', width:200 },
52+
{ name:'about', width:300 },
53+
{ name:'friends[0].name', displayName:'1st friend', width:150 },
54+
{ name:'friends[1].name', displayName:'2nd friend', width:150 },
55+
{ name:'friends[2].name', displayName:'3rd friend', width:150 }
56+
];
57+
$scope.gridOptions.enableFiltering = true;
58+
$scope.gridOptions.onRegisterApi = function(gridApi) {
59+
$scope.gridApi = gridApi;
60+
61+
gridApi.pinning.on.columnPinned($scope, function(col, action) {
62+
console.log(col, action);
63+
});
64+
};
65+
$scope.state = {};
66+
67+
$scope.saveState = function() {
68+
$scope.state = $scope.gridApi.saveState.save();
69+
};
70+
71+
$scope.restoreState = function() {
72+
$scope.gridApi.saveState.restore( $scope, $scope.state );
73+
};
74+
75+
$http.get('https://rawgit.com/angular-ui/ui-grid.info/gh-pages/data/500_complex.json')
76+
.success(function(data) {
77+
$scope.gridOptions.data = data;
78+
});
79+
});
80+
</script>
81+
</body>
82+
</html>
83+

misc/demo/modal.html

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<!DOCTYPE html>
2+
<html ng-app="app">
3+
4+
<head>
5+
<link data-require="bootstrap@*" data-semver="3.3.2" rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" />
6+
<script data-require="[email protected]" data-semver="2.1.3" src="http://code.jquery.com/jquery-2.1.3.min.js"></script>
7+
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.js"></script>
8+
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular-touch.js"></script>
9+
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular-animate.js"></script>
10+
<script data-require="ui-bootstrap@*" data-semver="0.12.1" src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.12.1.min.js"></script>
11+
<script src="http://ui-grid.info/docs/grunt-scripts/csv.js"></script>
12+
<script src="http://ui-grid.info/docs/grunt-scripts/pdfmake.js"></script>
13+
<script src="http://ui-grid.info/docs/grunt-scripts/vfs_fonts.js"></script>
14+
<script src="/dist/release/ui-grid.js"></script>
15+
<link rel="stylesheet" href="/dist/release/ui-grid.css" type="text/css" />
16+
<style type="text/css">
17+
.grid {
18+
width: 100%;
19+
max-width: 600px;
20+
height: 400px;
21+
}
22+
23+
body {
24+
padding: 20px;
25+
}
26+
</style>
27+
</head>
28+
29+
<body>
30+
<div ng-controller="MainCtrl">
31+
<button ng-click="openModal()" class="btn btn-success">Open Modal</button>
32+
</div>
33+
34+
<script>
35+
var app = angular.module('app', ['ui.grid', 'ui.bootstrap']);
36+
37+
app.controller('MainCtrl', function ($scope, $modal) {
38+
$scope.openModal = function () {
39+
$modal.open({
40+
templateUrl: 'modal.html'
41+
});
42+
}
43+
});
44+
45+
app.controller('ModalDemoCtrl', function ($scope, $http) {
46+
$scope.gridOptions = {};
47+
48+
$http.get('https://cdn.rawgit.com/angular-ui/ui-grid.info/gh-pages/data/500_complex.json')
49+
.success(function(data) {
50+
$scope.gridOptions.data = data;
51+
});
52+
});
53+
</script>
54+
55+
<script type="text/ng-template" id="modal.html">
56+
<div ng-controller="ModalDemoCtrl">
57+
<div class="modal-header">
58+
<h3 class="modal-title">I'm a modal!</h3>
59+
</div>
60+
<div class="modal-body">
61+
<div id="grid1" ui-grid="gridOptions" class="grid"></div>
62+
</div>
63+
<div class="modal-footer">
64+
<button class="btn btn-warning" ng-click="$close()">Cancel</button>
65+
</div>
66+
<div ng-show="selected">Selection from a modal: {{ selected }}</div>
67+
</div>
68+
</script>
69+
</body>
70+
</html>

0 commit comments

Comments
 (0)