angular-slickgrid 4.2.0 → 4.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{dist/angular-slickgrid.d.ts → angular-slickgrid.d.ts} +0 -0
- package/{dist/app → app}/modules/angular-slickgrid/components/angular-slickgrid.component.d.ts +0 -0
- package/{dist/app → app}/modules/angular-slickgrid/constants.d.ts +0 -0
- package/{dist/app → app}/modules/angular-slickgrid/extensions/index.d.ts +0 -0
- package/{dist/app → app}/modules/angular-slickgrid/extensions/slickRowDetailView.d.ts +0 -0
- package/{dist/app → app}/modules/angular-slickgrid/global-grid-options.d.ts +0 -0
- package/{dist/app → app}/modules/angular-slickgrid/index.d.ts +0 -0
- package/{dist/app → app}/modules/angular-slickgrid/models/angularComponentOutput.interface.d.ts +0 -0
- package/{dist/app → app}/modules/angular-slickgrid/models/angularGridInstance.interface.d.ts +0 -0
- package/{dist/app → app}/modules/angular-slickgrid/models/externalTestingDependencies.interface.d.ts +0 -0
- package/{dist/app → app}/modules/angular-slickgrid/models/gridOption.interface.d.ts +0 -0
- package/{dist/app → app}/modules/angular-slickgrid/models/index.d.ts +0 -0
- package/{dist/app → app}/modules/angular-slickgrid/models/rowDetailView.interface.d.ts +0 -0
- package/{dist/app → app}/modules/angular-slickgrid/models/slickGrid.interface.d.ts +0 -0
- package/{dist/app → app}/modules/angular-slickgrid/modules/angular-slickgrid.module.d.ts +0 -0
- package/{dist/app → app}/modules/angular-slickgrid/services/angularUtil.service.d.ts +0 -0
- package/{dist/app → app}/modules/angular-slickgrid/services/bsDropdown.service.d.ts +0 -0
- package/{dist/app → app}/modules/angular-slickgrid/services/container.service.d.ts +0 -0
- package/{dist/app → app}/modules/angular-slickgrid/services/index.d.ts +0 -0
- package/{dist/app → app}/modules/angular-slickgrid/services/translater.service.d.ts +0 -0
- package/{dist/app → app}/modules/angular-slickgrid/services/utilities.d.ts +0 -0
- package/{dist/app → app}/modules/angular-slickgrid/slickgrid-config.d.ts +0 -0
- package/docs/assets/lib/multiple-select/README.md +17 -0
- package/{dist/esm2020 → esm2020}/angular-slickgrid.mjs +0 -0
- package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/components/angular-slickgrid.component.mjs +0 -0
- package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/constants.mjs +0 -0
- package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/extensions/index.mjs +0 -0
- package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/extensions/slickRowDetailView.mjs +0 -0
- package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/global-grid-options.mjs +0 -0
- package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/index.mjs +0 -0
- package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/models/angularComponentOutput.interface.mjs +0 -0
- package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/models/angularGridInstance.interface.mjs +0 -0
- package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/models/externalTestingDependencies.interface.mjs +0 -0
- package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/models/gridOption.interface.mjs +0 -0
- package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/models/index.mjs +0 -0
- package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/models/rowDetailView.interface.mjs +0 -0
- package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/models/slickGrid.interface.mjs +0 -0
- package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/modules/angular-slickgrid.module.mjs +0 -0
- package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/services/angularUtil.service.mjs +0 -0
- package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/services/bsDropdown.service.mjs +0 -0
- package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/services/container.service.mjs +0 -0
- package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/services/index.mjs +0 -0
- package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/services/translater.service.mjs +0 -0
- package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/services/utilities.mjs +0 -0
- package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/slickgrid-config.mjs +0 -0
- package/{dist/esm2020 → esm2020}/public_api.mjs +0 -0
- package/{dist/fesm2015 → fesm2015}/angular-slickgrid.mjs +0 -0
- package/{dist/fesm2015 → fesm2015}/angular-slickgrid.mjs.map +0 -0
- package/{dist/fesm2020 → fesm2020}/angular-slickgrid.mjs +0 -0
- package/{dist/fesm2020 → fesm2020}/angular-slickgrid.mjs.map +0 -0
- package/{dist/i18n → i18n}/en.json +0 -0
- package/{dist/i18n → i18n}/fr.json +0 -0
- package/package.json +25 -110
- package/{dist/public_api.d.ts → public_api.d.ts} +0 -0
- package/.browserslistrc +0 -12
- package/.codecov.yml +0 -17
- package/.editorconfig +0 -18
- package/.eslintrc.json +0 -50
- package/.github/CODE_OF_CONDUCT.md +0 -76
- package/.github/FUNDING.yml +0 -8
- package/.github/ISSUE_TEMPLATE/bug_report.yml +0 -54
- package/.github/ISSUE_TEMPLATE/config.yml +0 -5
- package/.github/ISSUE_TEMPLATE/feature_request.yml +0 -44
- package/.github/renovate.json5 +0 -26
- package/.github/stale.yml +0 -7
- package/.github/workflows/main.yml +0 -83
- package/.vscode/extensions.json +0 -9
- package/.vscode/launch.json +0 -72
- package/.vscode/settings.json +0 -7
- package/.vscode/tasks.json +0 -77
- package/CHANGELOG.md +0 -1172
- package/angular.json +0 -148
- package/dist/LICENSE +0 -20
- package/dist/README.md +0 -182
- package/dist/package.json +0 -79
- package/global.d.ts +0 -1
- package/ngcc.config.js +0 -13
- package/screenshots/column-picker.png +0 -0
- package/screenshots/composite-editor.png +0 -0
- package/screenshots/draggable-grouping.png +0 -0
- package/screenshots/editors.png +0 -0
- package/screenshots/export-to-file.png +0 -0
- package/screenshots/filter_and_sort.png +0 -0
- package/screenshots/formatters.png +0 -0
- package/screenshots/frozen.png +0 -0
- package/screenshots/multipleSelectFilter.png +0 -0
- package/screenshots/pagination.png +0 -0
- package/screenshots/selectFilter.png +0 -0
- package/screenshots/singleFilter.png +0 -0
- package/src/app/app-routing.module.ts +0 -83
- package/src/app/app.component.html +0 -160
- package/src/app/app.component.scss +0 -65
- package/src/app/app.component.ts +0 -10
- package/src/app/app.module.ts +0 -175
- package/src/app/examples/custom-angularComponentEditor.ts +0 -184
- package/src/app/examples/custom-angularComponentFilter.ts +0 -126
- package/src/app/examples/custom-inputEditor.ts +0 -124
- package/src/app/examples/custom-inputFilter.ts +0 -142
- package/src/app/examples/custom-titleFormatter.component.ts +0 -8
- package/src/app/examples/editor-ng-select.component.ts +0 -37
- package/src/app/examples/filter-ng-select.component.ts +0 -32
- package/src/app/examples/grid-additem.component.html +0 -48
- package/src/app/examples/grid-additem.component.ts +0 -272
- package/src/app/examples/grid-angular.component.html +0 -79
- package/src/app/examples/grid-angular.component.scss +0 -28
- package/src/app/examples/grid-angular.component.ts +0 -370
- package/src/app/examples/grid-autoheight.component.html +0 -52
- package/src/app/examples/grid-autoheight.component.ts +0 -147
- package/src/app/examples/grid-basic.component.html +0 -29
- package/src/app/examples/grid-basic.component.ts +0 -82
- package/src/app/examples/grid-clientside.component.html +0 -51
- package/src/app/examples/grid-clientside.component.ts +0 -293
- package/src/app/examples/grid-colspan.component.html +0 -39
- package/src/app/examples/grid-colspan.component.scss +0 -11
- package/src/app/examples/grid-colspan.component.ts +0 -155
- package/src/app/examples/grid-composite-editor.component.html +0 -79
- package/src/app/examples/grid-composite-editor.component.scss +0 -19
- package/src/app/examples/grid-composite-editor.component.ts +0 -948
- package/src/app/examples/grid-contextmenu.component.html +0 -62
- package/src/app/examples/grid-contextmenu.component.scss +0 -44
- package/src/app/examples/grid-contextmenu.component.ts +0 -473
- package/src/app/examples/grid-custom-tooltip.component.html +0 -25
- package/src/app/examples/grid-custom-tooltip.component.scss +0 -77
- package/src/app/examples/grid-custom-tooltip.component.ts +0 -483
- package/src/app/examples/grid-draggrouping.component.html +0 -93
- package/src/app/examples/grid-draggrouping.component.ts +0 -397
- package/src/app/examples/grid-editor.component.html +0 -88
- package/src/app/examples/grid-editor.component.ts +0 -699
- package/src/app/examples/grid-formatter.component.html +0 -26
- package/src/app/examples/grid-formatter.component.ts +0 -162
- package/src/app/examples/grid-frozen.component.html +0 -65
- package/src/app/examples/grid-frozen.component.scss +0 -11
- package/src/app/examples/grid-frozen.component.ts +0 -303
- package/src/app/examples/grid-graphql-nopage.component.html +0 -33
- package/src/app/examples/grid-graphql-nopage.component.scss +0 -9
- package/src/app/examples/grid-graphql-nopage.component.ts +0 -242
- package/src/app/examples/grid-graphql.component.html +0 -87
- package/src/app/examples/grid-graphql.component.ts +0 -304
- package/src/app/examples/grid-grouping.component.html +0 -80
- package/src/app/examples/grid-grouping.component.ts +0 -313
- package/src/app/examples/grid-headerbutton.component.html +0 -31
- package/src/app/examples/grid-headerbutton.component.scss +0 -10
- package/src/app/examples/grid-headerbutton.component.ts +0 -233
- package/src/app/examples/grid-headermenu.component.html +0 -31
- package/src/app/examples/grid-headermenu.component.scss +0 -25
- package/src/app/examples/grid-headermenu.component.ts +0 -159
- package/src/app/examples/grid-localization.component.html +0 -54
- package/src/app/examples/grid-localization.component.ts +0 -293
- package/src/app/examples/grid-menu.component.html +0 -37
- package/src/app/examples/grid-menu.component.scss +0 -28
- package/src/app/examples/grid-menu.component.ts +0 -229
- package/src/app/examples/grid-odata.component.html +0 -116
- package/src/app/examples/grid-odata.component.ts +0 -441
- package/src/app/examples/grid-range.component.html +0 -74
- package/src/app/examples/grid-range.component.ts +0 -291
- package/src/app/examples/grid-remote.component.html +0 -37
- package/src/app/examples/grid-remote.component.ts +0 -153
- package/src/app/examples/grid-resize-by-content.component.html +0 -62
- package/src/app/examples/grid-resize-by-content.component.scss +0 -19
- package/src/app/examples/grid-resize-by-content.component.ts +0 -780
- package/src/app/examples/grid-rowdetail.component.html +0 -35
- package/src/app/examples/grid-rowdetail.component.ts +0 -205
- package/src/app/examples/grid-rowmove.component.html +0 -49
- package/src/app/examples/grid-rowmove.component.ts +0 -234
- package/src/app/examples/grid-rowselection.component.html +0 -76
- package/src/app/examples/grid-rowselection.component.ts +0 -267
- package/src/app/examples/grid-state.component.html +0 -36
- package/src/app/examples/grid-state.component.ts +0 -259
- package/src/app/examples/grid-tabs.component.html +0 -35
- package/src/app/examples/grid-tabs.component.ts +0 -115
- package/src/app/examples/grid-trading.component.html +0 -58
- package/src/app/examples/grid-trading.component.scss +0 -49
- package/src/app/examples/grid-trading.component.ts +0 -319
- package/src/app/examples/grid-tree-data-hierarchical.component.html +0 -79
- package/src/app/examples/grid-tree-data-hierarchical.component.scss +0 -47
- package/src/app/examples/grid-tree-data-hierarchical.component.ts +0 -311
- package/src/app/examples/grid-tree-data-parent-child.component.html +0 -108
- package/src/app/examples/grid-tree-data-parent-child.component.scss +0 -10
- package/src/app/examples/grid-tree-data-parent-child.component.ts +0 -351
- package/src/app/examples/home.component.html +0 -41
- package/src/app/examples/home.component.ts +0 -9
- package/src/app/examples/rowdetail-preload.component.ts +0 -10
- package/src/app/examples/rowdetail-view.component.html +0 -36
- package/src/app/examples/rowdetail-view.component.ts +0 -54
- package/src/app/examples/swt-common-grid-pagination.component.ts +0 -156
- package/src/app/examples/swt-common-grid-test.component.html +0 -30
- package/src/app/examples/swt-common-grid-test.component.ts +0 -219
- package/src/app/examples/swt-common-grid.component.ts +0 -436
- package/src/app/examples/swt-logger.service.ts +0 -165
- package/src/app/modules/angular-slickgrid/components/angular-slickgrid.component.html +0 -4
- package/src/app/modules/angular-slickgrid/components/angular-slickgrid.component.ts +0 -1395
- package/src/app/modules/angular-slickgrid/constants.ts +0 -97
- package/src/app/modules/angular-slickgrid/extensions/index.ts +0 -1
- package/src/app/modules/angular-slickgrid/extensions/slickRowDetailView.ts +0 -375
- package/src/app/modules/angular-slickgrid/global-grid-options.ts +0 -245
- package/src/app/modules/angular-slickgrid/index.ts +0 -11
- package/src/app/modules/angular-slickgrid/models/angularComponentOutput.interface.ts +0 -6
- package/src/app/modules/angular-slickgrid/models/angularGridInstance.interface.ts +0 -68
- package/src/app/modules/angular-slickgrid/models/externalTestingDependencies.interface.ts +0 -37
- package/src/app/modules/angular-slickgrid/models/gridOption.interface.ts +0 -12
- package/src/app/modules/angular-slickgrid/models/index.ts +0 -6
- package/src/app/modules/angular-slickgrid/models/rowDetailView.interface.ts +0 -33
- package/src/app/modules/angular-slickgrid/models/slickGrid.interface.ts +0 -7
- package/src/app/modules/angular-slickgrid/modules/angular-slickgrid.module.ts +0 -37
- package/src/app/modules/angular-slickgrid/services/angularUtil.service.ts +0 -48
- package/src/app/modules/angular-slickgrid/services/bsDropdown.service.ts +0 -142
- package/src/app/modules/angular-slickgrid/services/container.service.ts +0 -24
- package/src/app/modules/angular-slickgrid/services/index.ts +0 -5
- package/src/app/modules/angular-slickgrid/services/translater.service.ts +0 -38
- package/src/app/modules/angular-slickgrid/services/utilities.ts +0 -19
- package/src/app/modules/angular-slickgrid/slickgrid-config.ts +0 -10
- package/src/app/slickgrid-custom-variables.scss +0 -10
- package/src/assets/.gitkeep +0 -0
- package/src/assets/data/collection_100_numbers.json +0 -12
- package/src/assets/data/collection_500_numbers.json +0 -52
- package/src/assets/data/countries.json +0 -245
- package/src/assets/data/country_names.json +0 -245
- package/src/assets/data/customers_100.json +0 -102
- package/src/assets/i18n/en.json +0 -90
- package/src/assets/i18n/fr.json +0 -91
- package/src/environments/environment.prod.ts +0 -3
- package/src/environments/environment.ts +0 -8
- package/src/favicon.ico +0 -0
- package/src/index.html +0 -18
- package/src/main.ts +0 -13
- package/src/polyfills.ts +0 -52
- package/src/public_api.ts +0 -1
- package/src/styles.scss +0 -66
- package/src/typings.d.ts +0 -10
- package/tsconfig.app.json +0 -25
- package/tsconfig.json +0 -40
- package/tsconfig.spec.json +0 -23
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
|
2
|
-
import { AngularGridInstance, Column, Editors, FieldType, Formatters, GridOption, GridService, OnEventArgs, SlickDataView, SlickGrid } from './../modules/angular-slickgrid';
|
|
3
|
-
|
|
4
|
-
@Component({
|
|
5
|
-
styles: ['.duration-bg { background-color: #e9d4f1 !important }'],
|
|
6
|
-
encapsulation: ViewEncapsulation.None,
|
|
7
|
-
templateUrl: './grid-additem.component.html'
|
|
8
|
-
})
|
|
9
|
-
export class GridAddItemComponent implements OnInit {
|
|
10
|
-
title = 'Example 11: Add / Update / Highlight a Datagrid Item';
|
|
11
|
-
subTitle = `
|
|
12
|
-
Add / Update / Hightlight an Item from the Datagrid (<a href="https://github.com/ghiscoding/Angular-Slickgrid/wiki/Add,-Update-or-Highlight-a-Datagrid-Item" target="_blank">Wiki docs</a>).
|
|
13
|
-
<ul>
|
|
14
|
-
<li><b>Note:</b> this demo is <b>only</b> on the datagrid (client) side, you still need to deal with the backend yourself</li>
|
|
15
|
-
<li>Adding an item, will always be showing as the 1st item in the grid because that is the best visual place to add it</li>
|
|
16
|
-
<li>Add/Update an item requires a valid Slickgrid Selection Model, you have 2 choices to deal with this:</li>
|
|
17
|
-
<ul><li>You can enable "enableCheckboxSelector" or "enableRowSelection" to True</li></ul>
|
|
18
|
-
<li>Click on any of the buttons below to test this out</li>
|
|
19
|
-
<li>You can change the highlighted color & animation by changing the <a href="https://github.com/ghiscoding/Angular-Slickgrid/blob/master/src/app/modules/angular-slickgrid/styles/_variables.scss" target="_blank">SASS Variables</a>:</li>
|
|
20
|
-
<ul>
|
|
21
|
-
<li>"$row-highlight-background-color" or "$row-highlight-fade-animation"</li>
|
|
22
|
-
</ul>
|
|
23
|
-
<li>You can also add CSS class(es) on the fly (or on page load) on rows with certain criteria, (e.g. click on last button)
|
|
24
|
-
<ul>
|
|
25
|
-
<li>Example, click on button "Highlight Rows with Duration over 50" to see row styling changing. <a href="https://github.com/ghiscoding/Angular-Slickgrid/wiki/Dynamically-Add-CSS-Classes-to-Item-Rows" target="_blank">Wiki doc</a></li>
|
|
26
|
-
</ul>
|
|
27
|
-
</ul>
|
|
28
|
-
`;
|
|
29
|
-
|
|
30
|
-
angularGrid!: AngularGridInstance;
|
|
31
|
-
grid!: SlickGrid;
|
|
32
|
-
gridService!: GridService;
|
|
33
|
-
dataView!: SlickDataView;
|
|
34
|
-
columnDefinitions: Column[] = [];
|
|
35
|
-
gridOptions!: GridOption;
|
|
36
|
-
dataset: any[];
|
|
37
|
-
updatedObject: any;
|
|
38
|
-
|
|
39
|
-
constructor() {
|
|
40
|
-
// mock a dataset
|
|
41
|
-
this.dataset = this.mockDataset(1000);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
angularGridReady(angularGrid: AngularGridInstance) {
|
|
45
|
-
this.angularGrid = angularGrid;
|
|
46
|
-
this.dataView = angularGrid.dataView;
|
|
47
|
-
this.grid = angularGrid.slickGrid as SlickGrid;
|
|
48
|
-
this.gridService = angularGrid.gridService;
|
|
49
|
-
|
|
50
|
-
// if you want to change background color of Duration over 50 right after page load,
|
|
51
|
-
// you would put the code here, also make sure to re-render the grid for the styling to be applied right away
|
|
52
|
-
/*
|
|
53
|
-
this.dataView.getItemMetadata = this.updateItemMetadataForDurationOver50(this.dataView.getItemMetadata);
|
|
54
|
-
this.grid.invalidate();
|
|
55
|
-
this.grid.render();
|
|
56
|
-
*/
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
ngOnInit(): void {
|
|
60
|
-
this.columnDefinitions = [
|
|
61
|
-
{
|
|
62
|
-
id: 'delete',
|
|
63
|
-
field: 'id',
|
|
64
|
-
excludeFromHeaderMenu: true,
|
|
65
|
-
formatter: Formatters.deleteIcon,
|
|
66
|
-
minWidth: 30,
|
|
67
|
-
maxWidth: 30,
|
|
68
|
-
// use onCellClick OR grid.onClick.subscribe which you can see down below
|
|
69
|
-
onCellClick: (e: Event, args: OnEventArgs) => {
|
|
70
|
-
console.log(args);
|
|
71
|
-
if (confirm('Are you sure?')) {
|
|
72
|
-
this.angularGrid.gridService.deleteItemById(args.dataContext.id);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
id: 'title', name: 'Title', field: 'title',
|
|
78
|
-
sortable: true,
|
|
79
|
-
type: FieldType.string,
|
|
80
|
-
editor: {
|
|
81
|
-
model: Editors.longText
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
id: 'duration', name: 'Duration (days)', field: 'duration',
|
|
86
|
-
sortable: true,
|
|
87
|
-
type: FieldType.number,
|
|
88
|
-
editor: {
|
|
89
|
-
model: Editors.text
|
|
90
|
-
},
|
|
91
|
-
onCellChange: (e: Event, args: OnEventArgs) => {
|
|
92
|
-
alert('onCellChange directly attached to the column definition');
|
|
93
|
-
console.log(args);
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
id: 'complete', name: '% Complete', field: 'percentComplete',
|
|
98
|
-
formatter: Formatters.percentCompleteBar,
|
|
99
|
-
type: FieldType.number,
|
|
100
|
-
editor: {
|
|
101
|
-
model: Editors.integer
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
id: 'start', name: 'Start', field: 'start',
|
|
106
|
-
formatter: Formatters.dateIso,
|
|
107
|
-
sortable: true,
|
|
108
|
-
type: FieldType.date,
|
|
109
|
-
/*
|
|
110
|
-
editor: {
|
|
111
|
-
model: Editors.date
|
|
112
|
-
}
|
|
113
|
-
*/
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
id: 'finish', name: 'Finish', field: 'finish',
|
|
117
|
-
formatter: Formatters.dateIso, sortable: true,
|
|
118
|
-
type: FieldType.date
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
id: 'effort-driven', name: 'Effort Driven', field: 'effortDriven',
|
|
122
|
-
formatter: Formatters.checkmark,
|
|
123
|
-
type: FieldType.number,
|
|
124
|
-
editor: {
|
|
125
|
-
model: Editors.checkbox
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
];
|
|
129
|
-
|
|
130
|
-
this.gridOptions = {
|
|
131
|
-
asyncEditorLoading: false,
|
|
132
|
-
autoResize: {
|
|
133
|
-
container: '#demo-container',
|
|
134
|
-
rightPadding: 10
|
|
135
|
-
},
|
|
136
|
-
editable: true,
|
|
137
|
-
enableColumnPicker: true,
|
|
138
|
-
enableCellNavigation: true,
|
|
139
|
-
enableRowSelection: true
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
mockDataset(itemCount: number) {
|
|
144
|
-
// mock a dataset
|
|
145
|
-
const mockedDataset = [];
|
|
146
|
-
for (let i = 0; i < itemCount; i++) {
|
|
147
|
-
const randomYear = 2000 + Math.floor(Math.random() * 10);
|
|
148
|
-
const randomMonth = Math.floor(Math.random() * 11);
|
|
149
|
-
const randomDay = Math.floor((Math.random() * 29));
|
|
150
|
-
const randomPercent = Math.round(Math.random() * 100);
|
|
151
|
-
mockedDataset[i] = {
|
|
152
|
-
id: i,
|
|
153
|
-
title: 'Task ' + i,
|
|
154
|
-
duration: Math.round(Math.random() * 100) + '',
|
|
155
|
-
percentComplete: randomPercent,
|
|
156
|
-
percentCompleteNumber: randomPercent,
|
|
157
|
-
start: new Date(randomYear, randomMonth, randomDay),
|
|
158
|
-
finish: new Date(randomYear, (randomMonth + 1), randomDay),
|
|
159
|
-
effortDriven: (i % 5 === 0)
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
return mockedDataset;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
addNewItem(insertPosition?: 'top' | 'bottom') {
|
|
166
|
-
const newItem1 = this.createNewItem(1);
|
|
167
|
-
const newItem2 = this.createNewItem(2);
|
|
168
|
-
|
|
169
|
-
// single insert
|
|
170
|
-
this.angularGrid.gridService.addItem(newItem1, { position: insertPosition });
|
|
171
|
-
|
|
172
|
-
// OR multiple inserts
|
|
173
|
-
// this.angularGrid.gridService.addItems([newItem1, newItem2], { position: insertPosition });
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
createNewItem(incrementIdByHowMany = 1) {
|
|
177
|
-
const dataset = this.angularGrid.dataView.getItems();
|
|
178
|
-
let highestId = 0;
|
|
179
|
-
dataset.forEach((item: any) => {
|
|
180
|
-
if (item.id > highestId) {
|
|
181
|
-
highestId = item.id;
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
const newId = highestId + incrementIdByHowMany;
|
|
185
|
-
const randomYear = 2000 + Math.floor(Math.random() * 10);
|
|
186
|
-
const randomMonth = Math.floor(Math.random() * 11);
|
|
187
|
-
const randomDay = Math.floor((Math.random() * 29));
|
|
188
|
-
const randomPercent = Math.round(Math.random() * 100);
|
|
189
|
-
|
|
190
|
-
return {
|
|
191
|
-
id: newId,
|
|
192
|
-
title: 'Task ' + newId,
|
|
193
|
-
duration: Math.round(Math.random() * 100) + '',
|
|
194
|
-
percentComplete: randomPercent,
|
|
195
|
-
percentCompleteNumber: randomPercent,
|
|
196
|
-
start: new Date(randomYear, randomMonth, randomDay),
|
|
197
|
-
finish: new Date(randomYear, (randomMonth + 2), randomDay),
|
|
198
|
-
effortDriven: true
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
highlighFifthRow() {
|
|
203
|
-
this.scrollGridTop();
|
|
204
|
-
this.angularGrid.gridService.highlightRow(4, 1500);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
/** Change the Duration Rows Background Color */
|
|
208
|
-
changeDurationBackgroundColor() {
|
|
209
|
-
this.dataView.getItemMetadata = this.updateItemMetadataForDurationOver40(this.dataView.getItemMetadata);
|
|
210
|
-
|
|
211
|
-
// also re-render the grid for the styling to be applied right away
|
|
212
|
-
this.grid.invalidate();
|
|
213
|
-
this.grid.render();
|
|
214
|
-
|
|
215
|
-
// or use the Angular-SlickGrid GridService
|
|
216
|
-
// this.gridService.renderGrid();
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Change the SlickGrid Item Metadata, we will add a CSS class on all rows with a Duration over 50
|
|
221
|
-
* For more info, you can see this SO https://stackoverflow.com/a/19985148/1212166
|
|
222
|
-
*/
|
|
223
|
-
updateItemMetadataForDurationOver40(previousItemMetadata: any) {
|
|
224
|
-
const newCssClass = 'duration-bg';
|
|
225
|
-
|
|
226
|
-
return (rowNumber: number) => {
|
|
227
|
-
const item = this.dataView.getItem(rowNumber);
|
|
228
|
-
let meta = {
|
|
229
|
-
cssClasses: ''
|
|
230
|
-
};
|
|
231
|
-
if (typeof previousItemMetadata === 'object') {
|
|
232
|
-
meta = previousItemMetadata(rowNumber);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
if (meta && item && item.duration) {
|
|
236
|
-
const duration = +item.duration; // convert to number
|
|
237
|
-
if (duration > 40) {
|
|
238
|
-
meta.cssClasses = (meta.cssClasses || '') + ' ' + newCssClass;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
return meta;
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
updateSecondItem() {
|
|
247
|
-
this.scrollGridTop();
|
|
248
|
-
const updatedItem = this.angularGrid.gridService.getDataItemByRowNumber(1);
|
|
249
|
-
updatedItem.duration = Math.round(Math.random() * 100);
|
|
250
|
-
this.angularGrid.gridService.updateItem(updatedItem);
|
|
251
|
-
|
|
252
|
-
// OR by id
|
|
253
|
-
// this.angularGrid.gridService.updateItemById(updatedItem.id, updatedItem);
|
|
254
|
-
|
|
255
|
-
// OR multiple changes
|
|
256
|
-
/*
|
|
257
|
-
const updatedItem1 = this.angularGrid.gridService.getDataItemByRowNumber(1);
|
|
258
|
-
const updatedItem2 = this.angularGrid.gridService.getDataItemByRowNumber(2);
|
|
259
|
-
updatedItem1.duration = Math.round(Math.random() * 100);
|
|
260
|
-
updatedItem2.duration = Math.round(Math.random() * 100);
|
|
261
|
-
this.angularGrid.gridService.updateItems([updatedItem1, updatedItem2], { highlightRow: true });
|
|
262
|
-
*/
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
scrollGridBottom() {
|
|
266
|
-
this.angularGrid.slickGrid.navigateBottom();
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
scrollGridTop() {
|
|
270
|
-
this.angularGrid.slickGrid.navigateTop();
|
|
271
|
-
}
|
|
272
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
<div id="demo-container" class="container-fluid">
|
|
2
|
-
<h2>
|
|
3
|
-
{{title}}
|
|
4
|
-
<span class="float-end">
|
|
5
|
-
<a style="font-size: 18px"
|
|
6
|
-
target="_blank"
|
|
7
|
-
href="https://github.com/ghiscoding/Angular-Slickgrid/blob/master/src/app/examples/grid-angular.component.ts">
|
|
8
|
-
<span class="fa fa-link"></span> code
|
|
9
|
-
</a>
|
|
10
|
-
</span>
|
|
11
|
-
</h2>
|
|
12
|
-
<div class="subtitle"
|
|
13
|
-
[innerHTML]="subTitle"></div>
|
|
14
|
-
|
|
15
|
-
<div class="col-sm-6">
|
|
16
|
-
<label>autoEdit setting: </label>
|
|
17
|
-
<span id="radioAutoEdit">
|
|
18
|
-
<label class="radio-inline control-label"
|
|
19
|
-
for="radioTrue">
|
|
20
|
-
<input type="radio"
|
|
21
|
-
name="inlineRadioOptions"
|
|
22
|
-
id="radioTrue"
|
|
23
|
-
checked
|
|
24
|
-
[value]="isAutoEdit"
|
|
25
|
-
(change)="setAutoEdit(true)"> ON (single-click)
|
|
26
|
-
</label>
|
|
27
|
-
<label class="radio-inline control-label"
|
|
28
|
-
for="radioFalse">
|
|
29
|
-
<input type="radio"
|
|
30
|
-
name="inlineRadioOptions"
|
|
31
|
-
id="radioFalse"
|
|
32
|
-
[value]="isAutoEdit"
|
|
33
|
-
(change)="setAutoEdit(false)"> OFF (double-click)
|
|
34
|
-
</label>
|
|
35
|
-
</span>
|
|
36
|
-
<div class="row col-sm-12">
|
|
37
|
-
<span>
|
|
38
|
-
<button class="btn btn-outline-secondary btn-sm" (click)="undo()">
|
|
39
|
-
<i class="fa fa-undo"></i>
|
|
40
|
-
Undo last edit(s)
|
|
41
|
-
</button>
|
|
42
|
-
<button class="btn btn-outline-secondary btn-sm" (click)="angularGrid.filterService.clearFilters()">
|
|
43
|
-
Clear Filters
|
|
44
|
-
</button>
|
|
45
|
-
<button class="btn btn-outline-secondary btn-sm" (click)="angularGrid.sortService.clearSorting()">
|
|
46
|
-
Clear Sorting
|
|
47
|
-
</button>
|
|
48
|
-
<label class="checkbox-inline control-label" for="autoCommitEdit">
|
|
49
|
-
<input type="checkbox" id="autoCommitEdit" data-test="auto-commit"
|
|
50
|
-
[checked]="gridOptions.autoCommitEdit"
|
|
51
|
-
(click)="changeAutoCommit()">
|
|
52
|
-
Auto Commit Edit
|
|
53
|
-
</label>
|
|
54
|
-
</span>
|
|
55
|
-
</div>
|
|
56
|
-
</div>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
<div class="col-sm-6">
|
|
60
|
-
<div class="alert alert-info" *ngIf="updatedObject">
|
|
61
|
-
<strong>Updated Item:</strong> {{updatedObject | json}}
|
|
62
|
-
</div>
|
|
63
|
-
<div class="alert alert-warning" *ngIf="alertWarning">
|
|
64
|
-
<strong>Updated Item:</strong> {{alertWarning}}
|
|
65
|
-
</div>
|
|
66
|
-
</div>
|
|
67
|
-
|
|
68
|
-
<div class="col-sm-12">
|
|
69
|
-
<angular-slickgrid gridId="grid22"
|
|
70
|
-
[columnDefinitions]="columnDefinitions"
|
|
71
|
-
[gridOptions]="gridOptions"
|
|
72
|
-
[dataset]="dataset"
|
|
73
|
-
(onAngularGridCreated)="angularGridReady($event.detail)"
|
|
74
|
-
(onCellChange)="onCellChanged($event.detail.eventData, $event.detail.args)"
|
|
75
|
-
(onClick)="onCellClicked($event.detail.eventData, $event.detail.args)"
|
|
76
|
-
(onValidationError)="onCellValidationError($event.detail.eventData, $event.detail.args)">
|
|
77
|
-
</angular-slickgrid>
|
|
78
|
-
</div>
|
|
79
|
-
</div>
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
h3 {
|
|
2
|
-
font-style: normal;
|
|
3
|
-
color: #3d3d3d;
|
|
4
|
-
}
|
|
5
|
-
.fake-hyperlink {
|
|
6
|
-
color: #0d6efd;
|
|
7
|
-
text-decoration: underline;
|
|
8
|
-
text-decoration-color: #0d6efd;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
#slickGridContainer-grid22 {
|
|
12
|
-
.slickgrid-container {
|
|
13
|
-
.slick-headerrow-column {
|
|
14
|
-
.ng-input {
|
|
15
|
-
padding-top: -4px !important;
|
|
16
|
-
padding-left: 4px !important;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
.slick-cell {
|
|
20
|
-
line-height: 30px !important;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
input.slider-filter-input[type=range],
|
|
25
|
-
.form-control {
|
|
26
|
-
height: 34px !important;
|
|
27
|
-
}
|
|
28
|
-
}
|