Skip to content

Commit 4cfd60c

Browse files
committed
Merge branch 'master' into master
2 parents a450a3b + 702e1b8 commit 4cfd60c

File tree

20 files changed

+189
-67
lines changed

20 files changed

+189
-67
lines changed

CONTRIBUTING.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ project's developers might not want to merge into the project.
9292
Please adhere to the coding conventions used throughout a project (indentation,
9393
accurate comments, etc.) and any other requirements (such as test coverage).
9494

95+
**Include Examples** If possible, include links to a youtube video or GIF
96+
demonstrating your fix or your feature. It will help us understand what you
97+
are doing and why we want to merge it in.
98+
9599
Adhering to the following this process is the best way to get your work
96100
included in the project:
97101

@@ -133,13 +137,18 @@ included in the project:
133137
git pull [--rebase] upstream master
134138
```
135139

136-
6. Push your topic branch up to your fork:
140+
6. Squash your change into one commit
141+
```bash
142+
git rebase -i master
143+
```
144+
145+
7. Push your topic branch up to your fork:
137146

138147
```bash
139-
git push origin <topic-branch-name>
148+
git push [--force] origin <topic-branch-name>
140149
```
141150

142-
7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
151+
8. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
143152
with a clear title and description.
144153

145154
**IMPORTANT**: By submitting a patch, you agree to allow the project owners to

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
[![Build Status](https://api.travis-ci.org/angular-ui/ui-grid.png?branch=3.0)](https://travis-ci.org/angular-ui/ui-grid) [![Coverage Status](https://coveralls.io/repos/angular-ui/ui-grid/badge.png?branch=master)](https://coveralls.io/r/angular-ui/ui-grid?branch=master)
44
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/angular-ui/ui-grid?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
5+
[![npm](https://img.shields.io/npm/dm/angular-ui-grid.svg)](https://www.npmjs.com/package/angular-ui-grid)
6+
[![npm](https://img.shields.io/npm/dt/angular-ui-grid.svg)](https://www.npmjs.com/package/angular-ui-grid)
57

68
[![Selenium Test Status](https://saucelabs.com/browser-matrix/nggrid.svg)](https://saucelabs.com/u/nggrid)
79

@@ -163,7 +165,7 @@ With the 3.0 release, the repository has been renamed from "ng-grid" to "ui-grid
163165
164166
All network traffic to GitHub should redirect automatically but they say you should update your git remote url:
165167
166-
git remote set-url origin https://github.com/angular-ui/ui-grid.git
168+
git remote set-url origin https://github.com/angular-ui/ui-grid.git
167169
168170
# Thanks
169171

misc/tutorial/205_row_editable.ngdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ The basic method of operation is that whenever a cell is edited (identified usin
3131
event) an `isDirty` flag is set on the row, and a `saveTimer` is set. If another cell in the same row commences
3232
editing within 2 seconds (or other configurable time), then the timer will be destroyed again. Otherwise
3333
upon the timer completing the row will be set to a status of `isSaving` and greyed out, and the `saveRow`
34-
event will be called. The function called by this event must return a promise, and the rowedit feature
34+
event will be called. The function called by this event must call `rowEdit.setSavePromise`, and the rowedit feature
3535
will wait on that promise.
3636

3737
If the cellNav feature is also enabled, then a setFocus on a cell within the row is sufficient to delay

src/features/cellnav/js/cellnav.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -681,8 +681,10 @@
681681
if (grid.cellNav.lastRowCol === null || rowColSelectIndex === -1) {
682682
var newRowCol = new GridRowColumn(row, col);
683683

684-
grid.api.cellNav.raise.navigate(newRowCol, grid.cellNav.lastRowCol);
685-
grid.cellNav.lastRowCol = newRowCol;
684+
if (grid.cellNav.lastRowCol === null || grid.cellNav.lastRowCol.row !== newRowCol.row || grid.cellNav.lastRowCol.col !== newRowCol.col){
685+
grid.api.cellNav.raise.navigate(newRowCol, grid.cellNav.lastRowCol);
686+
grid.cellNav.lastRowCol = newRowCol;
687+
}
686688
if (uiGridCtrl.grid.options.modifierKeysToMultiSelectCells && modifierDown) {
687689
grid.cellNav.focusedCells.push(rowCol);
688690
} else {

src/features/exporter/js/exporter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
* <div class="alert alert-success" role="alert"><strong>Stable</strong> This feature is stable. There should no longer be breaking api changes without a deprecation warning.</div>
1515
*
16-
* This module provides the ability to exporter data from the grid.
16+
* This module provides the ability to export data from the grid.
1717
*
1818
* Data can be exported in a range of formats, and all data, visible
1919
* data, or selected rows can be exported, with all columns or visible

src/features/move-columns/js/column-movable.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@
168168
});
169169
},
170170
redrawColumnAtPosition: function (grid, originalPosition, newPosition) {
171+
if (originalPosition === newPosition) {
172+
return;
173+
}
171174

172175
var columns = grid.columns;
173176

@@ -436,16 +439,7 @@
436439
//Left of cloned element should be aligned to original header cell.
437440
movingElm.addClass('movingColumn');
438441
var movingElementStyles = {};
439-
var elmLeft;
440-
if (gridUtil.detectBrowser() === 'safari') {
441-
//Correction for Safari getBoundingClientRect,
442-
//which does not correctly compute when there is an horizontal scroll
443-
elmLeft = $elm[0].offsetLeft + $elm[0].offsetWidth - $elm[0].getBoundingClientRect().width;
444-
}
445-
else {
446-
elmLeft = $elm[0].getBoundingClientRect().left;
447-
}
448-
movingElementStyles.left = (elmLeft - gridLeft) + 'px';
442+
movingElementStyles.left = $elm[0].offsetLeft + 'px';
449443
var gridRight = $scope.grid.element[0].getBoundingClientRect().right;
450444
var elmRight = $elm[0].getBoundingClientRect().right;
451445
if (elmRight > gridRight) {
@@ -475,7 +469,8 @@
475469

476470
//Update css of moving column to adjust to new left value or fire scroll in case column has reached edge of grid
477471
if ((currentElmLeft >= gridLeft || changeValue > 0) && (currentElmRight <= rightMoveLimit || changeValue < 0)) {
478-
movingElm.css({visibility: 'visible', 'left': newElementLeft + 'px'});
472+
movingElm.css({visibility: 'visible', 'left': (movingElm[0].offsetLeft +
473+
(newElementLeft < rightMoveLimit ? changeValue : (rightMoveLimit - currentElmLeft))) + 'px'});
479474
}
480475
else if (totalColumnWidth > Math.ceil(uiGridCtrl.grid.gridWidth)) {
481476
changeValue *= 8;

src/features/tree-base/js/tree-base.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@
237237
* all transient information on the tree (children, childCount) and recalculate it
238238
*
239239
*/
240-
grid.treeBase.tree = {};
240+
grid.treeBase.tree = [];
241241

242242
service.defaultGridOptions(grid.options);
243243

src/features/tree-view/less/tree-view.less

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@
33
.ui-grid-tree-header-row {
44
font-weight: bold !important;
55
}
6+
.ui-grid-tree-header-row .ui-grid-cell.ui-grid-disable-selection.ui-grid-row-header-cell {
7+
pointer-events: all;
8+
}

src/js/core/directives/ui-grid-header-cell.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,10 @@
223223
}
224224
contents.addClass(classAdded);
225225

226-
var rightMostContainer = $scope.grid.renderContainers['right'] ? $scope.grid.renderContainers['right'] : $scope.grid.renderContainers['body'];
227-
$scope.isLastCol = ( $scope.col === rightMostContainer.visibleColumnCache[ rightMostContainer.visibleColumnCache.length - 1 ] );
226+
$timeout(function (){
227+
var rightMostContainer = $scope.grid.renderContainers['right'] ? $scope.grid.renderContainers['right'] : $scope.grid.renderContainers['body'];
228+
$scope.isLastCol = ( $scope.col === rightMostContainer.visibleColumnCache[ rightMostContainer.visibleColumnCache.length - 1 ] );
229+
});
228230

229231
// Figure out whether this column is sortable or not
230232
if (uiGridCtrl.grid.options.enableSorting && $scope.col.enableSorting) {

src/js/core/directives/ui-grid-menu.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,20 @@ function ($compile, $timeout, $window, $document, gridUtil, uiGridConstants, i18
4545
link: function ($scope, $elm, $attrs, uiGridCtrl) {
4646
var menuMid;
4747
var $animate;
48+
var gridMenuMaxHeight;
49+
50+
$scope.dynamicStyles = '';
51+
52+
if (uiGridCtrl) {
53+
// magic number of 30 because the grid menu displays somewhat below
54+
// the top of the grid. It is approximately 30px.
55+
gridMenuMaxHeight = uiGridCtrl.grid.gridHeight - 30;
56+
$scope.dynamicStyles = [
57+
'.grid' + uiGridCtrl.grid.id + ' .ui-grid-menu-mid {',
58+
'max-height: ' + gridMenuMaxHeight + 'px;',
59+
'}'
60+
].join(' ');
61+
}
4862

4963
$scope.i18n = {
5064
close: i18nService.getSafeText('columnMenu.close')

src/js/core/directives/ui-grid.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@
7878
}
7979
}
8080

81+
var mostRecentData;
82+
8183
function dataWatchFunction(newData) {
8284
// gridUtil.logDebug('dataWatch fired');
8385
var promises = [];
@@ -90,6 +92,8 @@
9092
}
9193
}
9294

95+
mostRecentData = newData;
96+
9397
if (newData) {
9498
// columns length is greater than the number of row header columns, which don't count because they're created automatically
9599
var hasColumns = self.grid.columns.length > (self.grid.rowHeaderColumns ? self.grid.rowHeaderColumns.length : 0);
@@ -118,7 +122,8 @@
118122
}
119123

120124
$q.all(promises).then(function() {
121-
self.grid.modifyRows(newData)
125+
// use most recent data, rather than the potentially outdated data passed into watcher handler
126+
self.grid.modifyRows(mostRecentData)
122127
.then(function () {
123128
// if (self.viewport) {
124129
self.grid.redrawInPlace(true);

src/js/core/factories/Grid.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2332,7 +2332,7 @@ angular.module('ui.grid')
23322332
//}
23332333

23342334
// This is the minimum amount of pixels we need to scroll vertical in order to see this row.
2335-
var pixelsToSeeRow = ((seekRowIndex + 1) * self.options.rowHeight);
2335+
var pixelsToSeeRow = (seekRowIndex * self.options.rowHeight + self.headerHeight);
23362336

23372337
// Don't let the pixels required to see the row be less than zero
23382338
pixelsToSeeRow = (pixelsToSeeRow < 0) ? 0 : pixelsToSeeRow;

src/js/core/services/rowSorter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ module.service('rowSorter', ['$parse', 'uiGridConstants', function ($parse, uiGr
206206
var strA = a.toString().toLowerCase(),
207207
strB = b.toString().toLowerCase();
208208

209-
return strA === strB ? 0 : (strA < strB ? -1 : 1);
209+
return strA === strB ? 0 : strA.localeCompare(strB);
210210
}
211211
};
212212

src/js/i18n/de.js

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55
angular.module('ui.grid').config(['$provide', function ($provide) {
66
$provide.decorator('i18nService', ['$delegate', function ($delegate) {
77
$delegate.add('de', {
8+
headerCell: {
9+
aria: {
10+
defaultFilterLabel: 'Filter für Spalte',
11+
removeFilter: 'Filter löschen',
12+
columnMenuButtonLabel: 'Spaltenmenü'
13+
},
14+
priority: 'Priorität:',
15+
filterLabel: "Filter für Spalte: "
16+
},
817
aggregate: {
918
label: 'Eintrag'
1019
},
@@ -28,6 +37,7 @@
2837
sort: {
2938
ascending: 'aufsteigend sortieren',
3039
descending: 'absteigend sortieren',
40+
none: 'keine Sortierung',
3141
remove: 'Sortierung zurücksetzen'
3242
},
3343
column: {
@@ -45,7 +55,13 @@
4555
pinRight: 'Rechts anheften',
4656
unpin: 'Lösen'
4757
},
58+
columnMenu: {
59+
close: 'Schließen'
60+
},
4861
gridMenu: {
62+
aria: {
63+
buttonLabel: 'Tabellenmenü'
64+
},
4965
columns: 'Spalten:',
5066
importerTitle: 'Datei importieren',
5167
exporterAllAsCsv: 'Alle Daten als CSV exportieren',
@@ -54,7 +70,7 @@
5470
exporterAllAsPdf: 'Alle Daten als PDF exportieren',
5571
exporterVisibleAsPdf: 'sichtbare Daten als PDF exportieren',
5672
exporterSelectedAsPdf: 'markierte Daten als CSV exportieren',
57-
clearAllFilters: 'Alle filter reinigen'
73+
clearAllFilters: 'Alle Filter zurücksetzen'
5874
},
5975
importer: {
6076
noHeaders: 'Es konnten keine Spaltennamen ermittelt werden. Sind in der Datei Spaltendefinitionen enthalten?',
@@ -64,9 +80,17 @@
6480
jsonNotArray: 'Die importierte JSON-Datei muß ein Array enthalten. Breche Import ab.'
6581
},
6682
pagination: {
67-
sizes: 'Einträge pro Seite',
68-
totalItems: 'Einträge',
69-
of: 'von'
83+
aria: {
84+
pageToFirst: 'Zum Anfang',
85+
pageBack: 'Seite zurück',
86+
pageSelected: 'Ausgwählte Seite',
87+
pageForward: 'Seite vor',
88+
pageToLast: 'Zum Ende'
89+
},
90+
sizes: 'Einträge pro Seite',
91+
totalItems: 'Einträge',
92+
through: 'bis',
93+
of: 'von'
7094
},
7195
grouping: {
7296
group: 'Gruppieren',

src/js/i18n/pt-br.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
aria: {
8484
pageToFirst: 'Primeira página',
8585
pageBack: 'Página anterior',
86-
pageSelected: 'Págona Selecionada',
86+
pageSelected: 'Página Selecionada',
8787
pageForward: 'Proxima',
8888
pageToLast: 'Anterior'
8989
},

src/js/i18n/pt.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
angular.module('ui.grid').config(['$provide', function($provide) {
33
$provide.decorator('i18nService', ['$delegate', function($delegate) {
44
$delegate.add('pt', {
5+
headerCell: {
6+
aria: {
7+
defaultFilterLabel: 'Filtro por coluna',
8+
removeFilter: 'Remover filtro',
9+
columnMenuButtonLabel: 'Menu coluna'
10+
},
11+
priority: 'Prioridade:',
12+
filterLabel: "Filtro por coluna: "
13+
},
514
aggregate: {
615
label: 'itens'
716
},
@@ -25,6 +34,7 @@
2534
sort: {
2635
ascending: 'Ordenar Ascendente',
2736
descending: 'Ordenar Descendente',
37+
none: 'Nenhuma Ordem',
2838
remove: 'Remover Ordenação'
2939
},
3040
column: {
@@ -42,7 +52,13 @@
4252
pinRight: 'Fixar Direita',
4353
unpin: 'Desprender'
4454
},
55+
columnMenu: {
56+
close: 'Fechar'
57+
},
4558
gridMenu: {
59+
aria: {
60+
buttonLabel: 'Menu Grid'
61+
},
4662
columns: 'Colunas:',
4763
importerTitle: 'Importar ficheiro',
4864
exporterAllAsCsv: 'Exportar todos os dados como csv',
@@ -61,8 +77,16 @@
6177
jsonNotArray: 'Ficheiro json importado tem que conter um array. Interrompendo.'
6278
},
6379
pagination: {
80+
aria: {
81+
pageToFirst: 'Primeira página',
82+
pageBack: 'Página anterior',
83+
pageSelected: 'Página Selecionada',
84+
pageForward: 'Próxima',
85+
pageToLast: 'Anterior'
86+
},
6487
sizes: 'itens por página',
6588
totalItems: 'itens',
89+
through: 'através dos',
6690
of: 'de'
6791
},
6892
grouping: {

src/less/icons.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
@media screen and (-webkit-min-device-pixel-ratio:0) {
1515
@font-face {
1616
font-family: 'ui-grid';
17-
src: url('../font/ui-grid.svg?12312827#ui-grid') format('svg');
17+
src: url('@{font-path}ui-grid.svg?12312827#ui-grid') format('svg');
1818
}
1919
}
2020
*/

src/less/menu.less

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
right: 0;
1919
.ui-grid-menu-mid {
2020
overflow: scroll;
21-
max-height: 300px;
2221
border: @gridBorderWidth solid @borderColor;
2322
}
2423
}

src/templates/ui-grid/uiGridMenu.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<div
22
class="ui-grid-menu"
33
ng-if="shown">
4+
<style ui-grid-style>
5+
{{dynamicStyles}}
6+
</style>
47
<div
58
class="ui-grid-menu-mid"
69
ng-show="shownMid">

0 commit comments

Comments
 (0)