Skip to content

Commit

Permalink
chore(docs): fix broken docs and add info for column menu's trigger v…
Browse files Browse the repository at this point in the history
…isibility
  • Loading branch information
cybermerlin authored and mportuga committed Dec 23, 2017
1 parent 9382312 commit 10c3100
Show file tree
Hide file tree
Showing 13 changed files with 70 additions and 56 deletions.
2 changes: 2 additions & 0 deletions misc/tutorial/303_customizing_column_menu.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ this column being hidden in the gridMenu (once it is finished and merged). You
the column menu entirely using the `enableColumnMenu: false` columnDef option.

You can disable all column menus using the `enableColumnMenus: false` grid option.
By default column menu's trigger is hidden before mouse over, but you can always force it to be visible with CSS:
`.ui-grid-column-menu-button { display: block; }`.

You can supply an icon class with the `icon` property.

Expand Down
2 changes: 1 addition & 1 deletion src/features/cellnav/js/cellnav.js
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@
* we include (thisColIndex / totalNumberCols) % of this column width
* @param {Grid} grid the grid you'd like to act upon, usually available
* from gridApi.grid
* @param {gridCol} upToCol the column to total up to and including
* @param {GridColumn} upToCol the column to total up to and including
*/
getLeftWidth: function (grid, upToCol) {
var width = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/features/exporter/js/exporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@
*
* @param {Grid} grid provides the grid in case you have need of it
* @param {GridRow} row the row from which the data comes
* @param {GridCol} col the column from which the data comes
* @param {GridColumn} col the column from which the data comes
* @param {object} value the value for your massaging
* @returns {object} you must return the massaged value ready for exporting
*
Expand Down
12 changes: 6 additions & 6 deletions src/features/grouping/js/grouping.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
* <pre>
* gridApi.grouping.on.aggregationChanged(scope,function(col){})
* </pre>
* @param {gridCol} col the column which on which aggregation changed. The aggregation
* @param {GridColumn} col the column which on which aggregation changed. The aggregation
* type is available as `col.treeAggregation.type`
*/
aggregationChanged: {},
Expand All @@ -182,7 +182,7 @@
* <pre>
* gridApi.grouping.on.groupingChanged(scope,function(col){})
* </pre>
* @param {gridCol} col the column which on which grouping changed. The new grouping is
* @param {GridColumn} col the column which on which grouping changed. The new grouping is
* available as `col.grouping`
*/
groupingChanged: {}
Expand Down Expand Up @@ -384,7 +384,7 @@
* @description Sets the grouping defaults based on the columnDefs
*
* @param {object} colDef columnDef we're basing on
* @param {GridCol} col the column we're to update
* @param {GridColumn} col the column we're to update
* @param {object} gridOptions the options we should use
* @returns {promise} promise for the builder - actually we do it all inline so it's immediately resolved
*/
Expand Down Expand Up @@ -663,7 +663,7 @@
* move is handled in a columnProcessor, so gets called as part of refresh
*
* @param {Grid} grid grid object
* @param {GridCol} column the column we want to group
* @param {GridColumn} column the column we want to group
*/
groupColumn: function( grid, column){
if ( typeof(column.grouping) === 'undefined' ){
Expand Down Expand Up @@ -708,7 +708,7 @@
* move is handled in a columnProcessor, so gets called as part of refresh
*
* @param {Grid} grid grid object
* @param {GridCol} column the column we want to ungroup
* @param {GridColumn} column the column we want to ungroup
*/
ungroupColumn: function( grid, column){
if ( typeof(column.grouping) === 'undefined' ){
Expand Down Expand Up @@ -740,7 +740,7 @@
* column is currently grouped then it removes the grouping first.
*
* @param {Grid} grid grid object
* @param {GridCol} column the column we want to aggregate
* @param {GridColumn} column the column we want to aggregate
* @param {string} one of the recognised types from uiGridGroupingConstants or one of the custom aggregations from gridOptions
*/
aggregateColumn: function( grid, column, aggregationType){
Expand Down
8 changes: 4 additions & 4 deletions src/features/tree-base/js/tree-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -504,11 +504,11 @@
* label: (optional) string,
* aggregationFn: function( aggregation, fieldValue, numValue, row ){...},
* finalizerFn: (optional) function( aggregation ){...}
* },
* },
* mean: {
* label: 'mean',
* aggregationFn: function( aggregation, fieldValue, numValue ){
* aggregation.count = (aggregation.count || 1) + 1;
* aggregation.count = (aggregation.count || 1) + 1;
* aggregation.sum = (aggregation.sum || 0) + numValue;
* },
* finalizerFn: function( aggregation ){
Expand Down Expand Up @@ -546,7 +546,7 @@
* @description Sets the tree defaults based on the columnDefs
*
* @param {object} colDef columnDef we're basing on
* @param {GridCol} col the column we're to update
* @param {GridColumn} col the column we're to update
* @param {object} gridOptions the options we should use
* @returns {promise} promise for the builder - actually we do it all inline so it's immediately resolved
*/
Expand Down Expand Up @@ -1545,7 +1545,7 @@
* column footer aggregations.
*
* @param {rows} visible rows. not used, but accepted to match signature of GridColumn.aggregationType
* @param {gridColumn} the column we are finalizing
* @param {GridColumn} column the column we are finalizing
*/
treeFooterAggregationType: function( rows, column ) {
service.finaliseAggregation(undefined, column.treeFooterAggregation);
Expand Down
25 changes: 16 additions & 9 deletions src/js/core/directives/ui-grid-header-cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,15 +305,22 @@
}

/**
* @ngdoc property
* @name enableColumnMenu
* @propertyOf ui.grid.class:GridOptions.columnDef
* @description if column menus are enabled, controls the column menus for this specific
* column (i.e. if gridOptions.enableColumnMenus, then you can control column menus
* using this option. If gridOptions.enableColumnMenus === false then you get no column
* menus irrespective of the value of this option ). Defaults to true.
*
*/
* @ngdoc property
* @name enableColumnMenu
* @propertyOf ui.grid.class:GridOptions.columnDef
* @description if column menus are enabled, controls the column menus for this specific
* column (i.e. if gridOptions.enableColumnMenus, then you can control column menus
* using this option. If gridOptions.enableColumnMenus === false then you get no column
* menus irrespective of the value of this option ). Defaults to true.
*
* By default column menu's trigger is hidden before mouse over, but you can always force it to be visible with CSS:
*
* <pre>
* .ui-grid-column-menu-button {
* display: block;
* }
* </pre>
*/
/**
* @ngdoc property
* @name enableColumnMenus
Expand Down
4 changes: 2 additions & 2 deletions src/js/core/directives/ui-grid-menu-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ angular.module('ui.grid')
* menu
* @param {$scope} $scope the scope of this gridMenu, from which we can find all
* the information that we need
* @returns {array} an array of menu items that can be shown
* @returns {Array} an array of menu items that can be shown
*/
getMenuItems: function( $scope ) {
var menuItems = [
Expand Down Expand Up @@ -337,7 +337,7 @@ angular.module('ui.grid')
* @description Toggles the visibility of an individual column. Expects to be
* provided a context that has on it a gridColumn, which is the column that
* we'll operate upon. We change the visibility, and refresh the grid as appropriate
* @param {GridCol} gridCol the column that we want to toggle
* @param {GridColumn} gridCol the column that we want to toggle
*
*/
toggleColumnVisibility: function( gridCol ) {
Expand Down
4 changes: 2 additions & 2 deletions src/js/core/factories/Grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ angular.module('ui.grid')
* @description Scrolls the grid to make a certain row and column combo visible,
* in the case that it is not completely visible on the screen already.
* @param {GridRow} gridRow row to make visible
* @param {GridCol} gridCol column to make visible
* @param {GridColumn} gridCol column to make visible
* @returns {promise} a promise that is resolved when scrolling is complete
*
*/
Expand Down Expand Up @@ -2337,7 +2337,7 @@ angular.module('ui.grid')
* @description Scrolls the grid to make a certain row and column combo visible,
* in the case that it is not completely visible on the screen already.
* @param {GridRow} gridRow row to make visible
* @param {GridCol} gridCol column to make visible
* @param {GridColumn} gridCol column to make visible
* @returns {promise} a promise that is resolved when scrolling is complete
*/
Grid.prototype.scrollToIfNecessary = function (gridRow, gridCol) {
Expand Down
7 changes: 7 additions & 0 deletions src/js/core/factories/GridOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,13 @@ angular.module('ui.grid')
* @propertyOf ui.grid.class:GridOptions
* @description True by default. When enabled, this setting displays a column
* menu within each column.
* By default column menu's trigger is hidden before mouse over, but you can always force it to be visible with CSS:
*
* <pre>
* .ui-grid-column-menu-button {
* display: block;
* }
* </pre>
*/
baseOptions.enableColumnMenus = baseOptions.enableColumnMenus !== false;

Expand Down
50 changes: 25 additions & 25 deletions src/js/core/services/rowSearcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.service('rowSearcher', ['gridUtil', 'uiGridConstants', function (gridUtil
*/
rowSearcher.getTerm = function getTerm(filter) {
if (typeof(filter.term) === 'undefined') { return filter.term; }

var term = filter.term;

// Strip leading and trailing whitespace if the term is a string
Expand Down Expand Up @@ -58,7 +58,7 @@ module.service('rowSearcher', ['gridUtil', 'uiGridConstants', function (gridUtil
return term;
}
};


/**
* @ngdoc function
Expand All @@ -77,7 +77,7 @@ module.service('rowSearcher', ['gridUtil', 'uiGridConstants', function (gridUtil
}

var term = rowSearcher.getTerm(filter);

if (/\*/.test(term)) {
var regexpFlags = '';
if (!filter.flags || !filter.flags.caseSensitive) {
Expand All @@ -92,37 +92,37 @@ module.service('rowSearcher', ['gridUtil', 'uiGridConstants', function (gridUtil
return defaultCondition;
}
};


/**
* @ngdoc function
* @name setupFilters
* @methodOf ui.grid.service:rowSearcher
* @description For a given columns filters (either col.filters, or [col.filter] can be passed in),
* do all the parsing and pre-processing and store that data into a new filters object. The object
* has the condition, the flags, the stripped term, and a parsed reg exp if there was one.
*
* We could use a forEach in here, since it's much less performance sensitive, but since we're using
*
* We could use a forEach in here, since it's much less performance sensitive, but since we're using
* for loops everywhere else in this module...
*
*
* @param {array} filters the filters from the column (col.filters or [col.filter])
* @returns {array} An array of parsed/preprocessed filters
*/
rowSearcher.setupFilters = function setupFilters( filters ){
var newFilters = [];

var filtersLength = filters.length;
for ( var i = 0; i < filtersLength; i++ ){
var filter = filters[i];

if ( filter.noTerm || !gridUtil.isNullOrUndefined(filter.term) ){
var newFilter = {};

var regexpFlags = '';
if (!filter.flags || !filter.flags.caseSensitive) {
regexpFlags += 'i';
}

if ( !gridUtil.isNullOrUndefined(filter.term) ){
// it is possible to have noTerm.
if ( filter.rawTerm ){
Expand All @@ -132,7 +132,7 @@ module.service('rowSearcher', ['gridUtil', 'uiGridConstants', function (gridUtil
}
}
newFilter.noTerm = filter.noTerm;

if ( filter.condition ){
newFilter.condition = filter.condition;
} else {
Expand All @@ -144,7 +144,7 @@ module.service('rowSearcher', ['gridUtil', 'uiGridConstants', function (gridUtil
if (newFilter.condition === uiGridConstants.filter.STARTS_WITH) {
newFilter.startswithRE = new RegExp('^' + newFilter.term, regexpFlags);
}

if (newFilter.condition === uiGridConstants.filter.ENDS_WITH) {
newFilter.endswithRE = new RegExp(newFilter.term + '$', regexpFlags);
}
Expand All @@ -156,24 +156,24 @@ module.service('rowSearcher', ['gridUtil', 'uiGridConstants', function (gridUtil
if (newFilter.condition === uiGridConstants.filter.EXACT) {
newFilter.exactRE = new RegExp('^' + newFilter.term + '$', regexpFlags);
}

newFilters.push(newFilter);
}
}
return newFilters;
};


/**
* @ngdoc function
* @name runColumnFilter
* @methodOf ui.grid.service:rowSearcher
* @description Runs a single pre-parsed filter against a cell, returning true
* if the cell matches that one filter.
*
*
* @param {Grid} grid the grid we're working against
* @param {GridRow} row the row we're matching against
* @param {GridCol} column the column that we're working against
* @param {GridColumn} column the column that we're working against
* @param {object} filter the specific, preparsed, filter that we want to test
* @returns {boolean} true if we match (row stays visible)
*/
Expand Down Expand Up @@ -266,19 +266,19 @@ module.service('rowSearcher', ['gridUtil', 'uiGridConstants', function (gridUtil
* @propertyOf ui.grid.class:GridOptions
* @description False by default. When enabled, this setting suppresses the internal filtering.
* All UI logic will still operate, allowing filter conditions to be set and modified.
*
*
* The external filter logic can listen for the `filterChange` event, which fires whenever
* a filter has been adjusted.
*/
/**
* @ngdoc function
* @name searchColumn
* @methodOf ui.grid.service:rowSearcher
* @description Process provided filters on provided column against a given row. If the row meets
* @description Process provided filters on provided column against a given row. If the row meets
* the conditions on all the filters, return true.
* @param {Grid} grid Grid to search in
* @param {GridRow} row Row to search on
* @param {GridCol} column Column with the filters to use
* @param {GridColumn} column Column with the filters to use
* @param {array} filters array of pre-parsed/preprocessed filters to apply
* @returns {boolean} Whether the column matches or not.
*/
Expand All @@ -291,7 +291,7 @@ module.service('rowSearcher', ['gridUtil', 'uiGridConstants', function (gridUtil
for (var i = 0; i < filtersLength; i++) {
var filter = filters[i];

if ( !gridUtil.isNullOrUndefined(filter.term) && filter.term !== '' || filter.noTerm ){
if ( !gridUtil.isNullOrUndefined(filter.term) && filter.term !== '' || filter.noTerm ){
var ret = rowSearcher.runColumnFilter(grid, row, column, filter);
if (!ret) {
return false;
Expand All @@ -307,7 +307,7 @@ module.service('rowSearcher', ['gridUtil', 'uiGridConstants', function (gridUtil
* @ngdoc function
* @name search
* @methodOf ui.grid.service:rowSearcher
* @description Run a search across the given rows and columns, marking any rows that don't
* @description Run a search across the given rows and columns, marking any rows that don't
* match the stored col.filters or col.filter as invisible.
* @param {Grid} grid Grid instance to search inside
* @param {Array[GridRow]} rows GridRows to filter
Expand Down Expand Up @@ -366,14 +366,14 @@ module.service('rowSearcher', ['gridUtil', 'uiGridConstants', function (gridUtil
var foreachFilterCol = function(grid, filterData){
var rowsLength = rows.length;
for ( var i = 0; i < rowsLength; i++){
foreachRow(grid, rows[i], filterData.col, filterData.filters);
foreachRow(grid, rows[i], filterData.col, filterData.filters);
}
};

// nested loop itself - foreachFilterCol, which in turn calls foreachRow
var filterDataLength = filterData.length;
for ( var j = 0; j < filterDataLength; j++){
foreachFilterCol( grid, filterData[j] );
foreachFilterCol( grid, filterData[j] );
}

if (grid.api.core.raise.rowsVisibleChanged) {
Expand Down
2 changes: 1 addition & 1 deletion src/js/core/services/rowSorter.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ module.service('rowSorter', ['$parse', 'uiGridConstants', function ($parse, uiGr
* that.
*
* @param {Grid} grid the grid to consider
* @param {GridCol} col the column to find a function for
* @param {GridColumn} col the column to find a function for
* @param {array} rows an array of grid rows. Currently unused, but presumably in future
* we might inspect the rows themselves to decide what sort of data might be there
* @returns {function} the sort function chosen for the column
Expand Down
Loading

0 comments on commit 10c3100

Please sign in to comment.