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

Commit 4f4a97f

Browse files
Ghislain BeaulacGhislain Beaulac
authored andcommitted
prepare release 0.5.1
1 parent ab5394c commit 4f4a97f

17 files changed

+376
-92
lines changed

dist/LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (c) 2016, Ghislain B.
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
"Software"), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be
12+
included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

dist/README.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,19 @@ The goal is of course to be able to run SlickGrid within Angular 4+ but also to
1313
### NPM Package
1414
[Angular-Slickgrid on NPM](https://www.npmjs.com/package/angular-slickgrid)
1515

16-
<a name="wiki"></a>
17-
1816
## Wiki / Documentation
1917
The Wiki is where all the documentation and instructions will go, so please consult the [Angular-Validation - Wiki](https://github.com/ghiscoding/angular-slickgrid/wiki) before opening any issues. The [Wiki - HOWTO](https://github.com/ghiscoding/angular-slickgrid/wiki/HOWTO---Step-by-Step) is a great place to start with.
2018

2119

22-
<a name="main-features"></a>
23-
2420
## Main features
2521
You can see some screenshots below and the instructions down below.
2622

2723
This is a work in progress, but so far here are some of the features that `angular-slickgrid` brings (on top of Slickgrid itself):
2824
- Easier use of SlickGrid within `Angular` as it is just a component (simply pass a column definitions and a dataset and you're good to go)
2925
- Bootstrap Theme with SASS variables for extra customization (if you create a theme, then please make a PR)
3026
- Auto-resize (boolean flag), will resize the datagrid viewport with available space even on browser resize (basically takes available space of it's container)
31-
- Integrated Plugins.
32-
- Column Picker (show/hide any column by doing `right+click` in the header, click [here to see print screen](/screenshots/columnPicker.png)).
33-
- ... more to come
27+
- Inline Editors
28+
- Support all SlickGrid Plugins.
3429
- Server side (backend) Services (filtering, sorting, pagination)
3530
- [GraphQL](https://github.com/ghiscoding/Angular-Slikgrid/wiki/GraphQL)
3631
- [OData](https://github.com/ghiscoding/Angular-Slickgrid/wiki/OData)
@@ -40,17 +35,18 @@ This is a work in progress, but so far here are some of the features that `angul
4035
- Formatters (a few default ones were added, and you can easily create custom ones too)
4136
- Optimized DataView which brings a lot of functionalities (sort, grouping, and more)
4237
- even server side data is saved into the SlickGrid DataView
38+
- All the [SlickGrid Events](https://github.com/6pac/SlickGrid/wiki/Grid-Events) are supported, see the [Wiki](https://github.com/ghiscoding/Angular-Slickgrid/wiki/Grid-&-DataView-Events)
4339
- ... more to come
4440

45-
<a name="missing-features"></a>
46-
4741
## Missing features (planned items, not necessarily in order of execution)
4842
The following are SlickGrid features which are not yet included in this library but will be in the eventual future.
49-
- Inline Editors
5043
- Filters to support multi-select dropdown and eventually custom filters
51-
- Plugins (Header Menu, Grid Menu, Column Header Buttons)
52-
- Row selection, will probably provide a `onRowsChanged()` in the `gridOptions` object
53-
- Cell click, will probably provide a `onCellClicked()` in the `gridOptions` object
44+
45+
### License
46+
[MIT License](LICENSE)
47+
48+
## Use it, like it?
49+
You like and use this great library `Angular-Slickgrid`? You can always upvote :star: and/or contribute :)
5450

5551
## Screenshots
5652

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: 102 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9387,8 +9387,8 @@ var numberFilterCondition = function (options) {
93879387
return testFilterCondition(options.operator || '==', parseFloat(options.cellValue), parseFloat(options.searchTerm));
93889388
};
93899389
var stringFilterCondition = function (options) {
9390-
// make sure the cell value is a string by casting it
9391-
options.cellValue = options.cellValue.toString();
9390+
// make sure the cell value is a string by casting it when possible
9391+
options.cellValue = (options.cellValue === undefined || options.cellValue === null) ? '' : options.cellValue.toString();
93929392
if (options.operator === '*') {
93939393
return options.cellValue.startsWith(options.searchTerm);
93949394
}
@@ -9543,13 +9543,13 @@ var Formatters = {
95439543
yesNo: yesNoFormatter
95449544
};
95459545
var moment$11 = moment_min || moment_; // patch to fix rollup "moment has no default export" issue, document here https://github.com/rollup/rollup/issues/670
9546-
var DATE_FORMAT = 'M/D/YY';
9546+
var FORMAT$8 = mapMomentDateFormatWithFieldType(FieldType.dateUsShort);
95479547
var dateUsShortSorter = function (value1, value2, sortDirection) {
9548-
if (!moment$11(value1, DATE_FORMAT, true).isValid() || !moment$11(value2, DATE_FORMAT, true).isValid()) {
9548+
if (!moment$11(value1, FORMAT$8, true).isValid() || !moment$11(value2, FORMAT$8, true).isValid()) {
95499549
return 0;
95509550
}
9551-
var /** @type {?} */ date1 = moment$11(value1, DATE_FORMAT, true);
9552-
var /** @type {?} */ date2 = moment$11(value2, DATE_FORMAT, true);
9551+
var /** @type {?} */ date1 = moment$11(value1, FORMAT$8, true);
9552+
var /** @type {?} */ date2 = moment$11(value2, FORMAT$8, true);
95539553
var /** @type {?} */ diff = parseInt(date1.format('X'), 10) - parseInt(date2.format('X'), 10);
95549554
return sortDirection * (diff === 0 ? 0 : (diff > 0 ? 1 : -1));
95559555
};
@@ -9564,24 +9564,24 @@ var dateSorter = function (value1, value2, sortDirection) {
95649564
return sortDirection * (diff === 0 ? 0 : (diff > 0 ? 1 : -1));
95659565
};
95669566
var moment$13 = moment_min || moment_; // patch to fix rollup "moment has no default export" issue, document here https://github.com/rollup/rollup/issues/670
9567-
var DATE_FORMAT$1 = 'YYYY-MM-DD';
9567+
var FORMAT$9 = mapMomentDateFormatWithFieldType(FieldType.dateIso);
95689568
var dateIsoSorter = function (value1, value2, sortDirection) {
9569-
if (!moment$13(value1, DATE_FORMAT$1, true).isValid() || !moment$13(value2, DATE_FORMAT$1, true).isValid()) {
9569+
if (!moment$13(value1, FORMAT$9, true).isValid() || !moment$13(value2, FORMAT$9, true).isValid()) {
95709570
return 0;
95719571
}
9572-
var /** @type {?} */ date1 = moment$13(value1, DATE_FORMAT$1, true);
9573-
var /** @type {?} */ date2 = moment$13(value2, DATE_FORMAT$1, true);
9572+
var /** @type {?} */ date1 = moment$13(value1, FORMAT$9, true);
9573+
var /** @type {?} */ date2 = moment$13(value2, FORMAT$9, true);
95749574
var /** @type {?} */ diff = parseInt(date1.format('X'), 10) - parseInt(date2.format('X'), 10);
95759575
return sortDirection * (diff === 0 ? 0 : (diff > 0 ? 1 : -1));
95769576
};
95779577
var moment$14 = moment_min || moment_; // patch to fix rollup "moment has no default export" issue, document here https://github.com/rollup/rollup/issues/670
9578-
var DATE_FORMAT$2 = 'M/D/YYYY';
9578+
var FORMAT$10 = mapMomentDateFormatWithFieldType(FieldType.dateUs);
95799579
var dateUsSorter = function (value1, value2, sortDirection) {
9580-
if (!moment$14(value1, DATE_FORMAT$2, true).isValid() || !moment$14(value2, DATE_FORMAT$2, true).isValid()) {
9580+
if (!moment$14(value1, FORMAT$10, true).isValid() || !moment$14(value2, FORMAT$10, true).isValid()) {
95819581
return 0;
95829582
}
9583-
var /** @type {?} */ date1 = moment$14(value1, DATE_FORMAT$2, true);
9584-
var /** @type {?} */ date2 = moment$14(value2, DATE_FORMAT$2, true);
9583+
var /** @type {?} */ date1 = moment$14(value1, FORMAT$10, true);
9584+
var /** @type {?} */ date2 = moment$14(value2, FORMAT$10, true);
95859585
var /** @type {?} */ diff = parseInt(date1.format('X'), 10) - parseInt(date2.format('X'), 10);
95869586
return sortDirection * (diff === 0 ? 0 : (diff > 0 ? 1 : -1));
95879587
};
@@ -9591,7 +9591,23 @@ var numericSorter = function (value1, value2, sortDirection) {
95919591
return sortDirection * (x === y ? 0 : (x > y ? 1 : -1));
95929592
};
95939593
var stringSorter = function (value1, value2, sortDirection) {
9594-
return sortDirection * (value1 === value2 ? 0 : (value1 > value2 ? 1 : -1));
9594+
var /** @type {?} */ position;
9595+
if (value1 === null) {
9596+
position = -1;
9597+
}
9598+
else if (value2 === null) {
9599+
position = 1;
9600+
}
9601+
else if (value1 === value2) {
9602+
position = 0;
9603+
}
9604+
else if (sortDirection) {
9605+
position = value1 < value2 ? -1 : 1;
9606+
}
9607+
else if (!sortDirection) {
9608+
position = value1 < value2 ? 1 : -1;
9609+
}
9610+
return sortDirection * position;
95959611
};
95969612
var Sorters = {
95979613
date: dateSorter,
@@ -9899,6 +9915,35 @@ var GridEventService = /** @class */ (function () {
98999915
e.preventDefault();
99009916
});
99019917
};
9918+
/**
9919+
* @param {?} grid
9920+
* @param {?} gridOptions
9921+
* @param {?} dataView
9922+
* @return {?}
9923+
*/
9924+
GridEventService.prototype.attachOnCellChange = function (grid, gridOptions, dataView) {
9925+
// subscribe to this Slickgrid event of onCellChange
9926+
grid.onCellChange.subscribe(function (e, args) {
9927+
if (!e || !args || !args.grid || args.cell === undefined || !args.grid.getColumns || !args.grid.getDataItem) {
9928+
return;
9929+
}
9930+
var /** @type {?} */ column = args.grid.getColumns()[args.cell];
9931+
// if the column definition has a onCellChange property (a callback function), then run it
9932+
if (typeof column.onCellChange === 'function') {
9933+
// add to the output gridOptions & dataView since we'll need them inside the AJAX column.onCellChange
9934+
var /** @type {?} */ returnedArgs = {
9935+
dataView: dataView,
9936+
gridDefinition: gridOptions,
9937+
grid: grid,
9938+
columnDef: column,
9939+
dataContext: args.grid.getDataItem(args.row)
9940+
};
9941+
// finally call up the Slick.column.onCellChanges.... function
9942+
column.onCellChange(returnedArgs);
9943+
// e.stopImmediatePropagation();
9944+
}
9945+
});
9946+
};
99029947
/**
99039948
* @param {?} grid
99049949
* @param {?} gridOptions
@@ -9911,18 +9956,18 @@ var GridEventService = /** @class */ (function () {
99119956
return;
99129957
}
99139958
var /** @type {?} */ column = args.grid.getColumns()[args.cell];
9914-
// so if the columns definition does have an column.onCellClick property (a function attached), then run it
9959+
// if the column definition has a onCellClick property (a callback function), then run it
99159960
if (typeof column.onCellClick === 'function') {
9916-
// attach both "this._gridOptions" and "_slickDataViewObj" since we'll need them inside the AJAX column.onClick
9917-
var /** @type {?} */ onCellClickArgs = {
9961+
// add to the output gridOptions & dataView since we'll need them inside the AJAX column.onClick
9962+
var /** @type {?} */ returnedArgs = {
99189963
dataView: dataView,
99199964
gridDefinition: gridOptions,
99209965
grid: grid,
99219966
columnDef: column,
99229967
dataContext: args.grid.getDataItem(args.row)
99239968
};
9924-
// finally call up the Slick.column.onClicks.... function
9925-
column.onCellClick(onCellClickArgs);
9969+
// finally call up the Slick.column.onCellClick.... function
9970+
column.onCellClick(returnedArgs);
99269971
e.stopImmediatePropagation();
99279972
}
99289973
// stop the click event bubbling
@@ -31756,6 +31801,7 @@ var GlobalGridOptions = {
3175631801
cellHighlightCssClass: 'slick-cell-modified',
3175731802
editable: false,
3175831803
enableCellNavigation: false,
31804+
enableColumnPicker: true,
3175931805
enableColumnReorder: true,
3176031806
enableMouseHoverHighlightRow: true,
3176131807
enablePagination: false,
@@ -31849,9 +31895,7 @@ var AngularSlickgridComponent = /** @class */ (function () {
3184931895
this.grid.setSelectionModel(new Slick.RowSelectionModel());
3185031896
this.gridChanged.emit(this.grid);
3185131897
this.dataviewChanged.emit(this._dataView);
31852-
if (this._gridOptions.enableColumnPicker) {
31853-
var /** @type {?} */ columnpicker = new Slick.Controls.ColumnPicker(this.columnDefinitions, this.grid, this._gridOptions);
31854-
}
31898+
this.attachDifferentControlOrPlugins(this.grid, this._gridOptions, this._dataView);
3185531899
this.grid.init();
3185631900
this._dataView.beginUpdate();
3185731901
this.attachDifferentHooks(this.grid, this._gridOptions, this._dataView);
@@ -31860,6 +31904,40 @@ var AngularSlickgridComponent = /** @class */ (function () {
3186031904
// attach resize ONLY after the dataView is ready
3186131905
this.attachResizeHook(this.grid, this._gridOptions);
3186231906
};
31907+
/**
31908+
* @param {?} grid
31909+
* @param {?} options
31910+
* @param {?} dataView
31911+
* @return {?}
31912+
*/
31913+
AngularSlickgridComponent.prototype.attachDifferentControlOrPlugins = function (grid, options, dataView) {
31914+
var _this = this;
31915+
if (options.enableColumnPicker) {
31916+
var /** @type {?} */ columnpicker = new Slick.Controls.ColumnPicker(this.columnDefinitions, this.grid, options);
31917+
}
31918+
if (options.enableAutoTooltip) {
31919+
var /** @type {?} */ columnpicker = new Slick.Controls.AutoTooltips(options.autoTooltipOptions || {});
31920+
}
31921+
if (options.enableRowSelection) {
31922+
var /** @type {?} */ columnpicker = new Slick.RowSelectionModel(options.rowSelectionOptions || {});
31923+
}
31924+
if (options.enableHeaderButton) {
31925+
var /** @type {?} */ columnpicker = new Slick.RowSelectionModel(options.headerMenuOptions || {});
31926+
}
31927+
if (options.enableHeaderMenu) {
31928+
var /** @type {?} */ columnpicker = new Slick.RowSelectionModel(options.headerMenuOptions || {});
31929+
}
31930+
if (options.registerPlugins !== undefined) {
31931+
if (Array.isArray(options.registerPlugins)) {
31932+
options.registerPlugins.forEach(function (plugin) {
31933+
_this.grid.registerPlugin(plugin);
31934+
});
31935+
}
31936+
else {
31937+
this.grid.registerPlugin(options.registerPlugins);
31938+
}
31939+
}
31940+
};
3186331941
/**
3186431942
* @param {?} grid
3186531943
* @param {?} options
@@ -31900,6 +31978,7 @@ var AngularSlickgridComponent = /** @class */ (function () {
3190031978
}); });
3190131979
}
3190231980
// on cell click, mainly used with the columnDef.action callback
31981+
this.gridEventService.attachOnCellChange(grid, this._gridOptions, dataView);
3190331982
this.gridEventService.attachOnClick(grid, this._gridOptions, dataView);
3190431983
// if enable, change background color on mouse over
3190531984
if (options.enableMouseHoverHighlightRow) {

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.

0 commit comments

Comments
 (0)