Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.

Commit d148b20

Browse files
Ghislain BeaulacGhislain Beaulac
authored andcommitted
start adding onClick action callback
1 parent a2fbc95 commit d148b20

Some content is hidden

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

56 files changed

+369
-169
lines changed

.angular-cli.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"styles": [
2222
"../node_modules/bootstrap/dist/css/bootstrap.css",
2323
"../node_modules/font-awesome/css/font-awesome.css",
24-
"app/styles/slickgrid-custom-variables.scss",
24+
"app/slickgrid-custom-variables.scss",
2525
"styles.scss"
2626
],
2727
"scripts": [

dist/angular-slickgrid.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
* Generated bundle index. Do not edit.
33
*/
44
export * from './public_api';
5-
export { FilterService as ɵd, MouseService as ɵc, ResizerService as ɵb, SortService as ɵe } from './src/app/modules/angular-slickgrid/services';
5+
export { FilterService as ɵd, GridEventService as ɵc, ResizerService as ɵb, SortService as ɵe } from './src/app/modules/angular-slickgrid/services';
66
export { OdataService as ɵa } from './src/app/modules/angular-slickgrid/services/odata.service';

dist/angular-slickgrid.metadata.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

dist/angular-slickgrid/angular-slickgrid.es5.js

Lines changed: 55 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,7 @@ var Formatters = {
896896
percentComplete: percentCompleteFormatter,
897897
percentCompleteBar: percentCompleteBarFormatter,
898898
progressBar: progressBarFormatter,
899-
yesNoFormatter: yesNoFormatter
899+
yesNo: yesNoFormatter
900900
};
901901
var moment$10 = moment_min || moment_; // patch to fix rollup "moment has no default export" issue, document here https://github.com/rollup/rollup/issues/670
902902
var DATE_FORMAT$3 = 'M/D/YY';
@@ -9095,6 +9095,7 @@ var FilterService = /** @class */ (function () {
90959095
case '=':
90969096
case '==': return (value1 === value2) ? true : false;
90979097
}
9098+
return true;
90989099
};
90999100
/**
91009101
* Attach a local filter hook to the grid
@@ -9271,14 +9272,14 @@ var FilterService = /** @class */ (function () {
92719272
};
92729273
return FilterService;
92739274
}());
9274-
var MouseService = /** @class */ (function () {
9275-
function MouseService() {
9275+
var GridEventService = /** @class */ (function () {
9276+
function GridEventService() {
92769277
}
92779278
/**
92789279
* @param {?} grid
92799280
* @return {?}
92809281
*/
9281-
MouseService.prototype.attachOnMouseHover = function (grid) {
9282+
GridEventService.prototype.attachOnMouseHover = function (grid) {
92829283
grid.onMouseEnter.subscribe(function (e) {
92839284
var /** @type {?} */ cell = grid.getCellFromEvent(e);
92849285
if (cell && cell.row >= 0) {
@@ -9291,7 +9292,43 @@ var MouseService = /** @class */ (function () {
92919292
e.preventDefault();
92929293
});
92939294
};
9294-
return MouseService;
9295+
/**
9296+
* @param {?} grid
9297+
* @param {?} gridOptions
9298+
* @param {?} dataView
9299+
* @return {?}
9300+
*/
9301+
GridEventService.prototype.attachOnClick = function (grid, gridOptions, dataView) {
9302+
grid.onClick.subscribe(function (e, args) {
9303+
if (!e || !args || !args.grid || !args.cell || !args.grid.getColumns || !args.grid.getDataItem) {
9304+
return;
9305+
}
9306+
var /** @type {?} */ column = args.grid.getColumns()[args.cell];
9307+
var /** @type {?} */ action = column.action;
9308+
// so if the columns definition does have an action property (a function attached), then run it
9309+
if (typeof action === 'function') {
9310+
// attach both "this._gridOptions" and "_slickDataViewObj" since we'll need them inside the AJAX action
9311+
var /** @type {?} */ actionArgs = {
9312+
dataView: dataView,
9313+
gridDefinition: gridOptions,
9314+
grid: grid,
9315+
columnDef: args.grid.getColumns()[args.cell],
9316+
dataContext: args.grid.getDataItem(args.row)
9317+
};
9318+
// AngularJS with SlickGrid action is possible via a few defined arguments passed as an object
9319+
// args.angular = (this._gridOptions.hasOwnProperty('angular')) ? this._gridOptions.angular : null;
9320+
// finally call up the Slick.Actions.... function
9321+
action(actionArgs);
9322+
e.stopImmediatePropagation();
9323+
}
9324+
// stop the click event bubbling
9325+
// NOTE: We don't want to stop bubbling when doing an input edit, if we do the autoEdit which has intent of doing singleClick edit will become doubleClick edit
9326+
if (grid && grid.getOptions && grid.getOptions().autoEdit) {
9327+
e.stopImmediatePropagation();
9328+
}
9329+
});
9330+
};
9331+
return GridEventService;
92959332
}());
92969333
// global constants, height/width are in pixels
92979334
var DATAGRID_MIN_HEIGHT = 180;
@@ -9814,7 +9851,7 @@ var GraphqlService = /** @class */ (function () {
98149851
if (args.columnFilters.hasOwnProperty(columnId)) {
98159852
var /** @type {?} */ columnFilter = args.columnFilters[columnId];
98169853
var /** @type {?} */ columnDef = columnFilter.columnDef;
9817-
var /** @type {?} */ fieldName = columnDef.field || columnDef.name;
9854+
var /** @type {?} */ fieldName = columnDef.field || columnDef.name || '';
98189855
var /** @type {?} */ fieldSearchValue = columnFilter.searchTerm;
98199856
if (typeof fieldSearchValue === 'undefined') {
98209857
fieldSearchValue = '';
@@ -10703,13 +10740,13 @@ var __awaiter$3 = (this && this.__awaiter) || function (thisArg, _arguments, P,
1070310740
var AngularSlickgridComponent = /** @class */ (function () {
1070410741
/**
1070510742
* @param {?} resizer
10706-
* @param {?} mouseService
10743+
* @param {?} gridEventService
1070710744
* @param {?} filterService
1070810745
* @param {?} sortService
1070910746
*/
10710-
function AngularSlickgridComponent(resizer, mouseService, filterService, sortService) {
10747+
function AngularSlickgridComponent(resizer, gridEventService, filterService, sortService) {
1071110748
this.resizer = resizer;
10712-
this.mouseService = mouseService;
10749+
this.gridEventService = gridEventService;
1071310750
this.filterService = filterService;
1071410751
this.sortService = sortService;
1071510752
this._columnFilters = {};
@@ -10753,7 +10790,9 @@ var AngularSlickgridComponent = /** @class */ (function () {
1075310790
this._dataView = new Slick.Data.DataView();
1075410791
this.grid = new Slick.Grid("#" + this.gridId, this._dataView, this.columnDefinitions, this._gridOptions);
1075510792
this.grid.setSelectionModel(new Slick.RowSelectionModel());
10756-
var /** @type {?} */ columnpicker = new Slick.Controls.ColumnPicker(this.columnDefinitions, this.grid, this._gridOptions);
10793+
if (this._gridOptions.enableColumnPicker) {
10794+
var /** @type {?} */ columnpicker = new Slick.Controls.ColumnPicker(this.columnDefinitions, this.grid, this._gridOptions);
10795+
}
1075710796
this.grid.init();
1075810797
this._dataView.beginUpdate();
1075910798
this.attachDifferentHooks(this.grid, this._gridOptions, this._dataView);
@@ -10801,9 +10840,11 @@ var AngularSlickgridComponent = /** @class */ (function () {
1080110840
});
1080210841
}); });
1080310842
}
10843+
// on cell click, mainly used with the columnDef.action callback
10844+
this.gridEventService.attachOnClick(grid, this._gridOptions, dataView);
1080410845
// if enable, change background color on mouse over
1080510846
if (options.enableMouseOverRow) {
10806-
this.mouseService.attachOnMouseHover(grid);
10847+
this.gridEventService.attachOnMouseHover(grid);
1080710848
}
1080810849
dataView.onRowCountChanged.subscribe(function (e, args) {
1080910850
grid.updateRowCount();
@@ -10903,7 +10944,7 @@ AngularSlickgridComponent.decorators = [
1090310944
*/
1090410945
AngularSlickgridComponent.ctorParameters = function () { return [
1090510946
{ type: ResizerService, },
10906-
{ type: MouseService, },
10947+
{ type: GridEventService, },
1090710948
{ type: FilterService, },
1090810949
{ type: SortService, },
1090910950
]; };
@@ -10935,7 +10976,7 @@ AngularSlickgridModule.decorators = [
1093510976
],
1093610977
providers: [
1093710978
GraphqlService,
10938-
MouseService,
10979+
GridEventService,
1093910980
OdataService,
1094010981
FilterService,
1094110982
SortService,
@@ -10951,5 +10992,5 @@ AngularSlickgridModule.ctorParameters = function () { return []; };
1095110992
/**
1095210993
* Generated bundle index. Do not edit.
1095310994
*/
10954-
export { CaseType, FormElementType, FieldType, FilterConditions, FilterTemplates, Formatters, Sorters, FilterService, MouseService, ResizerService, SortService, GraphqlService, GridOdataService, SlickPaginationComponent, AngularSlickgridComponent, AngularSlickgridModule, FilterService as ɵd, MouseService as ɵc, ResizerService as ɵb, SortService as ɵe, OdataService as ɵa };
10995+
export { CaseType, FormElementType, FieldType, FilterConditions, FilterTemplates, Formatters, Sorters, FilterService, GridEventService, ResizerService, SortService, GraphqlService, GridOdataService, SlickPaginationComponent, AngularSlickgridComponent, AngularSlickgridModule, FilterService as ɵd, GridEventService as ɵc, ResizerService as ɵb, SortService as ɵe, OdataService as ɵa };
1095510996
//# sourceMappingURL=angular-slickgrid.es5.js.map

dist/angular-slickgrid/angular-slickgrid.es5.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-slickgrid/angular-slickgrid.js

Lines changed: 61 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-slickgrid/angular-slickgrid.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)