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.
Files changed (232) hide show
  1. package/{dist/angular-slickgrid.d.ts → angular-slickgrid.d.ts} +0 -0
  2. package/{dist/app → app}/modules/angular-slickgrid/components/angular-slickgrid.component.d.ts +0 -0
  3. package/{dist/app → app}/modules/angular-slickgrid/constants.d.ts +0 -0
  4. package/{dist/app → app}/modules/angular-slickgrid/extensions/index.d.ts +0 -0
  5. package/{dist/app → app}/modules/angular-slickgrid/extensions/slickRowDetailView.d.ts +0 -0
  6. package/{dist/app → app}/modules/angular-slickgrid/global-grid-options.d.ts +0 -0
  7. package/{dist/app → app}/modules/angular-slickgrid/index.d.ts +0 -0
  8. package/{dist/app → app}/modules/angular-slickgrid/models/angularComponentOutput.interface.d.ts +0 -0
  9. package/{dist/app → app}/modules/angular-slickgrid/models/angularGridInstance.interface.d.ts +0 -0
  10. package/{dist/app → app}/modules/angular-slickgrid/models/externalTestingDependencies.interface.d.ts +0 -0
  11. package/{dist/app → app}/modules/angular-slickgrid/models/gridOption.interface.d.ts +0 -0
  12. package/{dist/app → app}/modules/angular-slickgrid/models/index.d.ts +0 -0
  13. package/{dist/app → app}/modules/angular-slickgrid/models/rowDetailView.interface.d.ts +0 -0
  14. package/{dist/app → app}/modules/angular-slickgrid/models/slickGrid.interface.d.ts +0 -0
  15. package/{dist/app → app}/modules/angular-slickgrid/modules/angular-slickgrid.module.d.ts +0 -0
  16. package/{dist/app → app}/modules/angular-slickgrid/services/angularUtil.service.d.ts +0 -0
  17. package/{dist/app → app}/modules/angular-slickgrid/services/bsDropdown.service.d.ts +0 -0
  18. package/{dist/app → app}/modules/angular-slickgrid/services/container.service.d.ts +0 -0
  19. package/{dist/app → app}/modules/angular-slickgrid/services/index.d.ts +0 -0
  20. package/{dist/app → app}/modules/angular-slickgrid/services/translater.service.d.ts +0 -0
  21. package/{dist/app → app}/modules/angular-slickgrid/services/utilities.d.ts +0 -0
  22. package/{dist/app → app}/modules/angular-slickgrid/slickgrid-config.d.ts +0 -0
  23. package/docs/assets/lib/multiple-select/README.md +17 -0
  24. package/{dist/esm2020 → esm2020}/angular-slickgrid.mjs +0 -0
  25. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/components/angular-slickgrid.component.mjs +0 -0
  26. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/constants.mjs +0 -0
  27. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/extensions/index.mjs +0 -0
  28. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/extensions/slickRowDetailView.mjs +0 -0
  29. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/global-grid-options.mjs +0 -0
  30. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/index.mjs +0 -0
  31. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/models/angularComponentOutput.interface.mjs +0 -0
  32. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/models/angularGridInstance.interface.mjs +0 -0
  33. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/models/externalTestingDependencies.interface.mjs +0 -0
  34. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/models/gridOption.interface.mjs +0 -0
  35. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/models/index.mjs +0 -0
  36. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/models/rowDetailView.interface.mjs +0 -0
  37. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/models/slickGrid.interface.mjs +0 -0
  38. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/modules/angular-slickgrid.module.mjs +0 -0
  39. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/services/angularUtil.service.mjs +0 -0
  40. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/services/bsDropdown.service.mjs +0 -0
  41. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/services/container.service.mjs +0 -0
  42. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/services/index.mjs +0 -0
  43. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/services/translater.service.mjs +0 -0
  44. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/services/utilities.mjs +0 -0
  45. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/slickgrid-config.mjs +0 -0
  46. package/{dist/esm2020 → esm2020}/public_api.mjs +0 -0
  47. package/{dist/fesm2015 → fesm2015}/angular-slickgrid.mjs +0 -0
  48. package/{dist/fesm2015 → fesm2015}/angular-slickgrid.mjs.map +0 -0
  49. package/{dist/fesm2020 → fesm2020}/angular-slickgrid.mjs +0 -0
  50. package/{dist/fesm2020 → fesm2020}/angular-slickgrid.mjs.map +0 -0
  51. package/{dist/i18n → i18n}/en.json +0 -0
  52. package/{dist/i18n → i18n}/fr.json +0 -0
  53. package/package.json +25 -110
  54. package/{dist/public_api.d.ts → public_api.d.ts} +0 -0
  55. package/.browserslistrc +0 -12
  56. package/.codecov.yml +0 -17
  57. package/.editorconfig +0 -18
  58. package/.eslintrc.json +0 -50
  59. package/.github/CODE_OF_CONDUCT.md +0 -76
  60. package/.github/FUNDING.yml +0 -8
  61. package/.github/ISSUE_TEMPLATE/bug_report.yml +0 -54
  62. package/.github/ISSUE_TEMPLATE/config.yml +0 -5
  63. package/.github/ISSUE_TEMPLATE/feature_request.yml +0 -44
  64. package/.github/renovate.json5 +0 -26
  65. package/.github/stale.yml +0 -7
  66. package/.github/workflows/main.yml +0 -83
  67. package/.vscode/extensions.json +0 -9
  68. package/.vscode/launch.json +0 -72
  69. package/.vscode/settings.json +0 -7
  70. package/.vscode/tasks.json +0 -77
  71. package/CHANGELOG.md +0 -1172
  72. package/angular.json +0 -148
  73. package/dist/LICENSE +0 -20
  74. package/dist/README.md +0 -182
  75. package/dist/package.json +0 -79
  76. package/global.d.ts +0 -1
  77. package/ngcc.config.js +0 -13
  78. package/screenshots/column-picker.png +0 -0
  79. package/screenshots/composite-editor.png +0 -0
  80. package/screenshots/draggable-grouping.png +0 -0
  81. package/screenshots/editors.png +0 -0
  82. package/screenshots/export-to-file.png +0 -0
  83. package/screenshots/filter_and_sort.png +0 -0
  84. package/screenshots/formatters.png +0 -0
  85. package/screenshots/frozen.png +0 -0
  86. package/screenshots/multipleSelectFilter.png +0 -0
  87. package/screenshots/pagination.png +0 -0
  88. package/screenshots/selectFilter.png +0 -0
  89. package/screenshots/singleFilter.png +0 -0
  90. package/src/app/app-routing.module.ts +0 -83
  91. package/src/app/app.component.html +0 -160
  92. package/src/app/app.component.scss +0 -65
  93. package/src/app/app.component.ts +0 -10
  94. package/src/app/app.module.ts +0 -175
  95. package/src/app/examples/custom-angularComponentEditor.ts +0 -184
  96. package/src/app/examples/custom-angularComponentFilter.ts +0 -126
  97. package/src/app/examples/custom-inputEditor.ts +0 -124
  98. package/src/app/examples/custom-inputFilter.ts +0 -142
  99. package/src/app/examples/custom-titleFormatter.component.ts +0 -8
  100. package/src/app/examples/editor-ng-select.component.ts +0 -37
  101. package/src/app/examples/filter-ng-select.component.ts +0 -32
  102. package/src/app/examples/grid-additem.component.html +0 -48
  103. package/src/app/examples/grid-additem.component.ts +0 -272
  104. package/src/app/examples/grid-angular.component.html +0 -79
  105. package/src/app/examples/grid-angular.component.scss +0 -28
  106. package/src/app/examples/grid-angular.component.ts +0 -370
  107. package/src/app/examples/grid-autoheight.component.html +0 -52
  108. package/src/app/examples/grid-autoheight.component.ts +0 -147
  109. package/src/app/examples/grid-basic.component.html +0 -29
  110. package/src/app/examples/grid-basic.component.ts +0 -82
  111. package/src/app/examples/grid-clientside.component.html +0 -51
  112. package/src/app/examples/grid-clientside.component.ts +0 -293
  113. package/src/app/examples/grid-colspan.component.html +0 -39
  114. package/src/app/examples/grid-colspan.component.scss +0 -11
  115. package/src/app/examples/grid-colspan.component.ts +0 -155
  116. package/src/app/examples/grid-composite-editor.component.html +0 -79
  117. package/src/app/examples/grid-composite-editor.component.scss +0 -19
  118. package/src/app/examples/grid-composite-editor.component.ts +0 -948
  119. package/src/app/examples/grid-contextmenu.component.html +0 -62
  120. package/src/app/examples/grid-contextmenu.component.scss +0 -44
  121. package/src/app/examples/grid-contextmenu.component.ts +0 -473
  122. package/src/app/examples/grid-custom-tooltip.component.html +0 -25
  123. package/src/app/examples/grid-custom-tooltip.component.scss +0 -77
  124. package/src/app/examples/grid-custom-tooltip.component.ts +0 -483
  125. package/src/app/examples/grid-draggrouping.component.html +0 -93
  126. package/src/app/examples/grid-draggrouping.component.ts +0 -397
  127. package/src/app/examples/grid-editor.component.html +0 -88
  128. package/src/app/examples/grid-editor.component.ts +0 -699
  129. package/src/app/examples/grid-formatter.component.html +0 -26
  130. package/src/app/examples/grid-formatter.component.ts +0 -162
  131. package/src/app/examples/grid-frozen.component.html +0 -65
  132. package/src/app/examples/grid-frozen.component.scss +0 -11
  133. package/src/app/examples/grid-frozen.component.ts +0 -303
  134. package/src/app/examples/grid-graphql-nopage.component.html +0 -33
  135. package/src/app/examples/grid-graphql-nopage.component.scss +0 -9
  136. package/src/app/examples/grid-graphql-nopage.component.ts +0 -242
  137. package/src/app/examples/grid-graphql.component.html +0 -87
  138. package/src/app/examples/grid-graphql.component.ts +0 -304
  139. package/src/app/examples/grid-grouping.component.html +0 -80
  140. package/src/app/examples/grid-grouping.component.ts +0 -313
  141. package/src/app/examples/grid-headerbutton.component.html +0 -31
  142. package/src/app/examples/grid-headerbutton.component.scss +0 -10
  143. package/src/app/examples/grid-headerbutton.component.ts +0 -233
  144. package/src/app/examples/grid-headermenu.component.html +0 -31
  145. package/src/app/examples/grid-headermenu.component.scss +0 -25
  146. package/src/app/examples/grid-headermenu.component.ts +0 -159
  147. package/src/app/examples/grid-localization.component.html +0 -54
  148. package/src/app/examples/grid-localization.component.ts +0 -293
  149. package/src/app/examples/grid-menu.component.html +0 -37
  150. package/src/app/examples/grid-menu.component.scss +0 -28
  151. package/src/app/examples/grid-menu.component.ts +0 -229
  152. package/src/app/examples/grid-odata.component.html +0 -116
  153. package/src/app/examples/grid-odata.component.ts +0 -441
  154. package/src/app/examples/grid-range.component.html +0 -74
  155. package/src/app/examples/grid-range.component.ts +0 -291
  156. package/src/app/examples/grid-remote.component.html +0 -37
  157. package/src/app/examples/grid-remote.component.ts +0 -153
  158. package/src/app/examples/grid-resize-by-content.component.html +0 -62
  159. package/src/app/examples/grid-resize-by-content.component.scss +0 -19
  160. package/src/app/examples/grid-resize-by-content.component.ts +0 -780
  161. package/src/app/examples/grid-rowdetail.component.html +0 -35
  162. package/src/app/examples/grid-rowdetail.component.ts +0 -205
  163. package/src/app/examples/grid-rowmove.component.html +0 -49
  164. package/src/app/examples/grid-rowmove.component.ts +0 -234
  165. package/src/app/examples/grid-rowselection.component.html +0 -76
  166. package/src/app/examples/grid-rowselection.component.ts +0 -267
  167. package/src/app/examples/grid-state.component.html +0 -36
  168. package/src/app/examples/grid-state.component.ts +0 -259
  169. package/src/app/examples/grid-tabs.component.html +0 -35
  170. package/src/app/examples/grid-tabs.component.ts +0 -115
  171. package/src/app/examples/grid-trading.component.html +0 -58
  172. package/src/app/examples/grid-trading.component.scss +0 -49
  173. package/src/app/examples/grid-trading.component.ts +0 -319
  174. package/src/app/examples/grid-tree-data-hierarchical.component.html +0 -79
  175. package/src/app/examples/grid-tree-data-hierarchical.component.scss +0 -47
  176. package/src/app/examples/grid-tree-data-hierarchical.component.ts +0 -311
  177. package/src/app/examples/grid-tree-data-parent-child.component.html +0 -108
  178. package/src/app/examples/grid-tree-data-parent-child.component.scss +0 -10
  179. package/src/app/examples/grid-tree-data-parent-child.component.ts +0 -351
  180. package/src/app/examples/home.component.html +0 -41
  181. package/src/app/examples/home.component.ts +0 -9
  182. package/src/app/examples/rowdetail-preload.component.ts +0 -10
  183. package/src/app/examples/rowdetail-view.component.html +0 -36
  184. package/src/app/examples/rowdetail-view.component.ts +0 -54
  185. package/src/app/examples/swt-common-grid-pagination.component.ts +0 -156
  186. package/src/app/examples/swt-common-grid-test.component.html +0 -30
  187. package/src/app/examples/swt-common-grid-test.component.ts +0 -219
  188. package/src/app/examples/swt-common-grid.component.ts +0 -436
  189. package/src/app/examples/swt-logger.service.ts +0 -165
  190. package/src/app/modules/angular-slickgrid/components/angular-slickgrid.component.html +0 -4
  191. package/src/app/modules/angular-slickgrid/components/angular-slickgrid.component.ts +0 -1395
  192. package/src/app/modules/angular-slickgrid/constants.ts +0 -97
  193. package/src/app/modules/angular-slickgrid/extensions/index.ts +0 -1
  194. package/src/app/modules/angular-slickgrid/extensions/slickRowDetailView.ts +0 -375
  195. package/src/app/modules/angular-slickgrid/global-grid-options.ts +0 -245
  196. package/src/app/modules/angular-slickgrid/index.ts +0 -11
  197. package/src/app/modules/angular-slickgrid/models/angularComponentOutput.interface.ts +0 -6
  198. package/src/app/modules/angular-slickgrid/models/angularGridInstance.interface.ts +0 -68
  199. package/src/app/modules/angular-slickgrid/models/externalTestingDependencies.interface.ts +0 -37
  200. package/src/app/modules/angular-slickgrid/models/gridOption.interface.ts +0 -12
  201. package/src/app/modules/angular-slickgrid/models/index.ts +0 -6
  202. package/src/app/modules/angular-slickgrid/models/rowDetailView.interface.ts +0 -33
  203. package/src/app/modules/angular-slickgrid/models/slickGrid.interface.ts +0 -7
  204. package/src/app/modules/angular-slickgrid/modules/angular-slickgrid.module.ts +0 -37
  205. package/src/app/modules/angular-slickgrid/services/angularUtil.service.ts +0 -48
  206. package/src/app/modules/angular-slickgrid/services/bsDropdown.service.ts +0 -142
  207. package/src/app/modules/angular-slickgrid/services/container.service.ts +0 -24
  208. package/src/app/modules/angular-slickgrid/services/index.ts +0 -5
  209. package/src/app/modules/angular-slickgrid/services/translater.service.ts +0 -38
  210. package/src/app/modules/angular-slickgrid/services/utilities.ts +0 -19
  211. package/src/app/modules/angular-slickgrid/slickgrid-config.ts +0 -10
  212. package/src/app/slickgrid-custom-variables.scss +0 -10
  213. package/src/assets/.gitkeep +0 -0
  214. package/src/assets/data/collection_100_numbers.json +0 -12
  215. package/src/assets/data/collection_500_numbers.json +0 -52
  216. package/src/assets/data/countries.json +0 -245
  217. package/src/assets/data/country_names.json +0 -245
  218. package/src/assets/data/customers_100.json +0 -102
  219. package/src/assets/i18n/en.json +0 -90
  220. package/src/assets/i18n/fr.json +0 -91
  221. package/src/environments/environment.prod.ts +0 -3
  222. package/src/environments/environment.ts +0 -8
  223. package/src/favicon.ico +0 -0
  224. package/src/index.html +0 -18
  225. package/src/main.ts +0 -13
  226. package/src/polyfills.ts +0 -52
  227. package/src/public_api.ts +0 -1
  228. package/src/styles.scss +0 -66
  229. package/src/typings.d.ts +0 -10
  230. package/tsconfig.app.json +0 -25
  231. package/tsconfig.json +0 -40
  232. package/tsconfig.spec.json +0 -23
@@ -1,370 +0,0 @@
1
- import { Component, OnInit, ViewEncapsulation } from '@angular/core';
2
- import { TranslateService } from '@ngx-translate/core';
3
-
4
- import {
5
- AngularGridInstance,
6
- AngularUtilService,
7
- BsDropDownService,
8
- Column,
9
- Editors,
10
- FieldType,
11
- Filters,
12
- Formatters,
13
- GridOption,
14
- OnEventArgs,
15
- SlickNamespace,
16
- } from './../modules/angular-slickgrid';
17
- import { EditorNgSelectComponent } from './editor-ng-select.component';
18
- import { CustomAngularComponentEditor } from './custom-angularComponentEditor';
19
- import { CustomAngularComponentFilter } from './custom-angularComponentFilter';
20
- import { CustomTitleFormatterComponent } from './custom-titleFormatter.component';
21
- import { FilterNgSelectComponent } from './filter-ng-select.component';
22
-
23
- // using external non-typed js libraries
24
- declare const Slick: SlickNamespace;
25
- declare const $: any;
26
-
27
- const NB_ITEMS = 100;
28
-
29
- @Component({
30
- templateUrl: './grid-angular.component.html',
31
- styleUrls: ['./grid-angular.component.scss'],
32
- encapsulation: ViewEncapsulation.None
33
- })
34
- export class GridAngularComponent implements OnInit {
35
- title = 'Example 22: Use of Angular Components';
36
- subTitle = `
37
- <h3>Filters, Editors, AsyncPostRender with Angular Components</h3>
38
- Grid with usage of Angular Components as Editor &amp; AsyncPostRender (similar to Formatter).
39
- <ul>
40
- <li>Support of Angular Component as Custom Editor (click on any "Assignee" name cell)</li>
41
- <ul>
42
- <li>That column uses <a href="https://github.com/ng-select/ng-select" target="_blank">ng-select</a> as a custom editor as an Angular Component
43
- <li>Increased Grid Options "rowHeight" &amp; "headerRowHeight" to 45 so that the "ng-select" fits in the cell. Ideally it would be better to override the ng-select css styling to change it's max height</li>
44
- </ul>
45
- <li>Support of Angular Component as Custom Filter ("Assignee" columns), which also uses "ng-select"
46
- <li>The 2nd "Assignee" column (showing in bold text) uses "asyncPostRender" with an Angular Component</li>
47
- <ul>
48
- <li>Why can't we use Angular Component as Customer Formatter and why do I see a slight delay in loading the data?</li>
49
- <li>It's totally normal since SlickGrid Formatters only accept strings (synchronously),
50
- so we cannot use that (Angular requires at least 1 full cycle to render the element), so we are left with SlickGrid "asyncPostRender" and
51
- it works but as the name suggest it's async users might see noticeable delay in loading the data
52
- </li>
53
- </ul>
54
- </ul>
55
- `;
56
-
57
- private _commandQueue: any[] = [];
58
- angularGrid!: AngularGridInstance;
59
- columnDefinitions: Column[] = [];
60
- gridOptions!: GridOption;
61
- dataset!: any[];
62
- gridObj: any;
63
- isAutoEdit = true;
64
- alertWarning: any;
65
- updatedObject: any;
66
- selectedLanguage = 'en';
67
- assignees = [
68
- { id: '', name: '' },
69
- { id: '1', name: 'John' },
70
- { id: '2', name: 'Pierre' },
71
- { id: '3', name: 'Paul' },
72
- ];
73
-
74
- constructor(private angularUtilService: AngularUtilService, private bsDropdown: BsDropDownService, private translate: TranslateService) { }
75
-
76
- ngOnInit(): void {
77
- this.prepareGrid();
78
- }
79
-
80
- angularGridReady(angularGrid: AngularGridInstance) {
81
- this.angularGrid = angularGrid;
82
- this.gridObj = angularGrid.slickGrid;
83
- }
84
-
85
- prepareGrid() {
86
- this.columnDefinitions = [
87
- {
88
- id: 'title',
89
- name: 'Title',
90
- field: 'title',
91
- minWidth: 100,
92
- filterable: true,
93
- sortable: true,
94
- type: FieldType.string,
95
- editor: {
96
- model: Editors.longText,
97
- minLength: 5,
98
- maxLength: 255,
99
- },
100
- onCellChange: (e: Event, args: OnEventArgs) => {
101
- console.log(args);
102
- this.alertWarning = `Updated Title: ${args.dataContext.title}`;
103
- }
104
- }, {
105
- id: 'assignee',
106
- name: 'Assignee',
107
- field: 'assignee',
108
- minWidth: 100,
109
- filterable: true,
110
- sortable: true,
111
- filter: {
112
- model: new CustomAngularComponentFilter(), // create a new instance to make each Filter independent from each other
113
- collection: this.assignees,
114
- params: {
115
- component: FilterNgSelectComponent,
116
- }
117
- },
118
- queryFieldFilter: 'assignee.id', // for a complex object it's important to tell the Filter which field to query and our CustomAngularComponentFilter returns the "id" property
119
- queryFieldSorter: 'assignee.name',
120
- formatter: Formatters.complexObject,
121
- params: {
122
- complexFieldLabel: 'assignee.name',
123
- },
124
- exportWithFormatter: true,
125
- editor: {
126
- model: CustomAngularComponentEditor,
127
- collection: this.assignees,
128
- params: {
129
- component: EditorNgSelectComponent,
130
- }
131
- },
132
- onCellChange: (e: Event, args: OnEventArgs) => {
133
- console.log(args);
134
- this.alertWarning = `Updated Title: ${args.dataContext.title}`;
135
- }
136
- }, {
137
- id: 'assignee2',
138
- name: 'Assignee with Angular Component',
139
- field: 'assignee',
140
- minWidth: 125,
141
- filterable: true,
142
- sortable: true,
143
- filter: {
144
- model: new CustomAngularComponentFilter(), // create a new instance to make each Filter independent from each other
145
- collection: this.assignees,
146
- params: {
147
- component: FilterNgSelectComponent,
148
- }
149
- },
150
- queryFieldFilter: 'assignee.id', // for a complex object it's important to tell the Filter which field to query and our CustomAngularComponentFilter returns the "id" property
151
- queryFieldSorter: 'assignee.name',
152
-
153
- // loading formatter, text to display while Post Render gets processed
154
- formatter: () => '...',
155
-
156
- // to load an Angular Component, you cannot use a Formatter since Angular needs at least 1 cycle to render everything
157
- // you can use a PostRenderer but you will visually see the data appearing,
158
- // which is why it's still better to use regular Formatter (with jQuery if need be) instead of Angular Component
159
- asyncPostRender: this.renderAngularComponent.bind(this),
160
- params: {
161
- component: CustomTitleFormatterComponent,
162
- angularUtilService: this.angularUtilService,
163
- complexFieldLabel: 'assignee.name' // for the exportCustomFormatter
164
- },
165
- exportCustomFormatter: Formatters.complexObject,
166
- }, {
167
- id: 'complete',
168
- name: '% Complete',
169
- field: 'percentComplete',
170
- minWidth: 100,
171
- filterable: true,
172
- formatter: Formatters.multiple,
173
- type: FieldType.number,
174
- editor: {
175
- model: Editors.singleSelect,
176
-
177
- // We can also add HTML text to be rendered (any bad script will be sanitized) but we have to opt-in, else it will be sanitized
178
- enableRenderHtml: true,
179
- collection: Array.from(Array(101).keys()).map(k => ({ value: k, label: k, symbol: '<i class="fa fa-percent" style="color:cadetblue"></i>' })),
180
- customStructure: {
181
- value: 'value',
182
- label: 'label',
183
- labelSuffix: 'symbol'
184
- },
185
- editorOptions: {
186
- maxHeight: 400
187
- }
188
- },
189
- filter: {
190
- model: Filters.slider,
191
- operator: '>=',
192
- params: { hideSliderNumber: false }
193
- },
194
- params: {
195
- formatters: [Formatters.collectionEditor, Formatters.percentCompleteBar],
196
- }
197
- }, {
198
- id: 'start',
199
- name: 'Start',
200
- field: 'start',
201
- minWidth: 100,
202
- filterable: true,
203
- filter: { model: Filters.compoundDate },
204
- formatter: Formatters.dateIso,
205
- exportWithFormatter: true,
206
- sortable: true,
207
- type: FieldType.date,
208
- editor: {
209
- model: Editors.date
210
- },
211
- }, {
212
- id: 'finish',
213
- name: 'Finish',
214
- field: 'finish',
215
- minWidth: 100,
216
- filterable: true,
217
- sortable: true,
218
- filter: { model: Filters.compoundDate },
219
- formatter: Formatters.dateIso,
220
- exportWithFormatter: true,
221
- type: FieldType.date,
222
- editor: {
223
- model: Editors.date
224
- },
225
- },
226
- {
227
- id: 'action',
228
- name: 'Action',
229
- field: 'id',
230
- formatter: () => `<div class="fake-hyperlink">Action <i class="fa fa-caret-down"></i></div>`,
231
- cellMenu: {
232
- commandTitle: 'Commands',
233
- commandItems: [
234
- {
235
- command: 'help',
236
- title: 'Help',
237
- iconCssClass: 'fa fa-question-circle text-info',
238
- positionOrder: 66,
239
- action: () => alert('Please Help!'),
240
- },
241
- {
242
- command: 'delete-row', title: 'Delete Row', positionOrder: 64,
243
- iconCssClass: 'fa fa-times color-danger', cssClass: 'red', textCssClass: 'text-italic color-danger-light',
244
- action: (_event, args) => this.angularGrid.gridService.deleteItemById(args.dataContext.id)
245
- },
246
- ]
247
- }
248
- }
249
- ];
250
-
251
- this.gridOptions = {
252
- asyncEditorLoading: false,
253
- autoEdit: this.isAutoEdit,
254
- autoCommitEdit: false,
255
- autoResize: {
256
- container: '#demo-container',
257
- rightPadding: 10
258
- },
259
- headerRowHeight: 45,
260
- rowHeight: 45, // increase row height so that the ng-select fits in the cell
261
- editable: true,
262
- enableCellMenu: true,
263
- enableCellNavigation: true,
264
- enableColumnPicker: true,
265
- enableExcelCopyBuffer: true,
266
- enableFiltering: true,
267
- enableAsyncPostRender: true, // for the Angular PostRenderer, don't forget to enable it
268
- asyncPostRenderDelay: 0, // also make sure to remove any delay to render it
269
- editCommandHandler: (item, column, editCommand) => {
270
- this._commandQueue.push(editCommand);
271
- editCommand.execute();
272
- },
273
- i18n: this.translate,
274
- params: {
275
- angularUtilService: this.angularUtilService // provide the service to all at once (Editor, Filter, AsyncPostRender)
276
- }
277
- };
278
-
279
- this.dataset = this.mockData(NB_ITEMS);
280
- }
281
-
282
- mockData(itemCount: number, startingIndex = 0) {
283
- // mock a dataset
284
- const tempDataset = [];
285
- for (let i = startingIndex; i < (startingIndex + itemCount); i++) {
286
- const randomYear = 2000 + Math.floor(Math.random() * 10);
287
- const randomMonth = Math.floor(Math.random() * 11);
288
- const randomDay = Math.floor((Math.random() * 29));
289
- const randomPercent = Math.round(Math.random() * 100);
290
-
291
- tempDataset.push({
292
- id: i,
293
- title: 'Task ' + i,
294
- assignee: i % 3 ? this.assignees[3] : i % 2 ? this.assignees[2] : this.assignees[1],
295
- duration: Math.round(Math.random() * 100) + '',
296
- percentComplete: randomPercent,
297
- percentCompleteNumber: randomPercent,
298
- start: new Date(randomYear, randomMonth, randomDay),
299
- finish: new Date(randomYear, (randomMonth + 1), randomDay),
300
- effortDriven: (i % 5 === 0),
301
- });
302
- }
303
- return tempDataset;
304
- }
305
-
306
- onCellChanged(e: Event, args: any) {
307
- this.updatedObject = args.item;
308
- }
309
-
310
- onCellClicked(e: Event, args: any) {
311
- const metadata = this.angularGrid.gridService.getColumnFromEventArguments(args);
312
- console.log(metadata);
313
-
314
- if (metadata.columnDef.id === 'edit') {
315
- this.alertWarning = `open a modal window to edit: ${metadata.dataContext.title}`;
316
-
317
- // highlight the row, to customize the color, you can change the SASS variable $row-highlight-background-color
318
- this.angularGrid.gridService.highlightRow(args.row, 1500);
319
-
320
- // you could also select the row, when using "enableCellNavigation: true", it automatically selects the row
321
- // this.angularGrid.gridService.setSelectedRow(args.row);
322
- } else if (metadata.columnDef.id === 'delete') {
323
- if (confirm('Are you sure?')) {
324
- this.angularGrid.gridService.deleteItemById(metadata.dataContext.id);
325
- }
326
- }
327
- }
328
-
329
- onCellValidationError(e: Event, args: any) {
330
- alert(args.validationResults.msg);
331
- }
332
-
333
- changeAutoCommit() {
334
- this.gridOptions.autoCommitEdit = !this.gridOptions.autoCommitEdit;
335
- this.gridObj.setOptions({
336
- autoCommitEdit: this.gridOptions.autoCommitEdit
337
- });
338
- return true;
339
- }
340
-
341
- setAutoEdit(isAutoEdit: boolean) {
342
- this.isAutoEdit = isAutoEdit;
343
- this.gridObj.setOptions({ autoEdit: isAutoEdit }); // change the grid option dynamically
344
- return true;
345
- }
346
-
347
- undo() {
348
- const command = this._commandQueue.pop();
349
- if (command && Slick.GlobalEditorLock.cancelCurrentEdit()) {
350
- command.undo();
351
- this.gridObj.gotoCell(command.row, command.cell, false);
352
- }
353
- }
354
-
355
- renderAngularComponent(cellNode: HTMLElement, row: number, dataContext: any, colDef: Column) {
356
- if (colDef.params.component) {
357
- const componentOutput = this.angularUtilService.createAngularComponent(colDef.params.component);
358
- Object.assign(componentOutput.componentRef.instance, { item: dataContext });
359
-
360
- // use a delay to make sure Angular ran at least a full cycle and make sure it finished rendering the Component
361
- setTimeout(() => $(cellNode).empty().html(componentOutput.domElement));
362
- }
363
- }
364
-
365
- /* Create an Action Dropdown Menu */
366
- deleteCell(rowNumber: number) {
367
- const item = this.angularGrid.dataView.getItem(rowNumber);
368
- this.angularGrid.gridService.deleteItemById(item.id);
369
- }
370
- }
@@ -1,52 +0,0 @@
1
- <div 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-autoheight.component.ts">
8
- <span class="fa fa-link"></span> code
9
- </a>
10
- </span>
11
- </h2>
12
- <div class="subtitle" [innerHTML]="subTitle"></div>
13
-
14
- <div class="row row-cols-lg-auto g-1 align-items-center">
15
- <div class="col">
16
- <label for="columnSelect">Single Search:</label>
17
- </div>
18
- <div class="col">
19
- <select class="form-select" class="form-select" data-test="search-column-list" name="selectedColumn"
20
- [(ngModel)]="selectedColumn"
21
- (ngModelChange)="updateFilter()">
22
- <option [ngValue]="field" *ngFor="let field of columnDefinitions">{{field.name}}</option>
23
- </select>
24
- </div>
25
- <div class="col">
26
- <select class="form-select" data-test="search-operator-list" name="selectedOperator"
27
- [(ngModel)]="selectedOperator" (ngModelChange)="updateFilter()">
28
- <option [ngValue]="operator" *ngFor="let operator of operatorList">{{operator}}</option>
29
- </select>
30
- </div>
31
-
32
- <div class="col">
33
- <div class="input-group">
34
- <input type="text" class="form-control" data-test="search-value-input" name="searchValue"
35
- placeholder="search value" autocomplete="off" (input)="updateFilter()" [(ngModel)]="searchValue">
36
- <button class="btn btn-outline-secondary d-flex align-items-center pl-2 pr-2" data-test="clear-search-value"
37
- (click)="cleargridSearchInput()">
38
- <span class="fa fa-times"></span>
39
- </button>
40
- </div>
41
- </div>
42
- </div>
43
-
44
- <hr />
45
-
46
- <angular-slickgrid gridId="grid23"
47
- [columnDefinitions]="columnDefinitions"
48
- [gridOptions]="gridOptions"
49
- [dataset]="dataset"
50
- (onAngularGridCreated)="angularGridReady($event.detail)">
51
- </angular-slickgrid>
52
- </div>
@@ -1,147 +0,0 @@
1
- import { Component, OnInit, ViewEncapsulation } from '@angular/core';
2
- import {
3
- AngularGridInstance,
4
- Column,
5
- FieldType,
6
- Formatters,
7
- GridOption,
8
- OperatorString,
9
- SlickDataView,
10
- SlickGrid,
11
- } from './../modules/angular-slickgrid';
12
-
13
- @Component({
14
- styles: ['.duration-bg { background-color: #e9d4f1 !important }'],
15
- encapsulation: ViewEncapsulation.None,
16
- templateUrl: './grid-autoheight.component.html'
17
- })
18
- export class GridAutoHeightComponent implements OnInit {
19
- title = 'Example 23: Grid AutoHeight';
20
- subTitle = `
21
- The SlickGrid option "autoHeight" can be used if you wish to keep the full height of the grid without any scrolling
22
- <ul>
23
- <li>You define a fixed grid width via "gridWidth" in the View</li>
24
- <li>You can still use the "autoResize" for the width to be resized automatically (the height will never change in this case)</li>
25
- <li>This dataset has 25 rows, if you scroll down the page you can see the entire set is shown without any grid scrolling (though you might have browser scrolling)</li>
26
- </ul>
27
- `;
28
-
29
- angularGrid!: AngularGridInstance;
30
- grid!: SlickGrid;
31
- dataView!: SlickDataView;
32
- columnDefinitions: Column[] = [];
33
- gridOptions!: GridOption;
34
- dataset!: any[];
35
- operatorList: OperatorString[] = ['=', '<', '<=', '>', '>=', '<>', 'StartsWith', 'EndsWith'];
36
- selectedOperator = '=';
37
- searchValue = '';
38
- selectedColumn?: Column;
39
-
40
- constructor() { }
41
-
42
- ngOnInit() {
43
- this.prepareGrid();
44
- }
45
-
46
- angularGridReady(angularGrid: AngularGridInstance) {
47
- this.angularGrid = angularGrid;
48
- }
49
-
50
- prepareGrid() {
51
- this.columnDefinitions = [
52
- {
53
- id: 'title', name: 'Title', field: 'title',
54
- sortable: true,
55
- type: FieldType.string
56
- },
57
- {
58
- id: 'duration', name: 'Duration (days)', field: 'duration',
59
- sortable: true,
60
- type: FieldType.number
61
- },
62
- {
63
- id: 'complete', name: '% Complete', field: 'percentComplete',
64
- formatter: Formatters.percentCompleteBar,
65
- type: FieldType.number
66
- },
67
- {
68
- id: 'start', name: 'Start', field: 'start',
69
- formatter: Formatters.dateIso,
70
- sortable: true,
71
- type: FieldType.date
72
- },
73
- {
74
- id: 'finish', name: 'Finish', field: 'finish',
75
- formatter: Formatters.dateIso, sortable: true,
76
- type: FieldType.date
77
- },
78
- {
79
- id: 'effort-driven', name: 'Effort Driven', field: 'effortDriven',
80
- formatter: Formatters.checkmark,
81
- type: FieldType.number
82
- }
83
- ];
84
- this.selectedColumn = this.columnDefinitions[0];
85
-
86
- this.gridOptions = {
87
- // if you want to disable autoResize and use a fixed width which requires horizontal scrolling
88
- // it's advised to disable the autoFitColumnsOnFirstLoad as well
89
- // enableAutoResize: false,
90
- // autoFitColumnsOnFirstLoad: false,
91
-
92
- autoHeight: true,
93
- autoResize: {
94
- container: '#demo-container',
95
- rightPadding: 10
96
- },
97
-
98
- // enable the filtering but hide the user filter row since we use our own single filter
99
- enableFiltering: true,
100
- showHeaderRow: false, // hide the filter row (header row)
101
-
102
- enableGridMenu: false, // disable grid menu & remove vertical scroll
103
- alwaysShowVerticalScroll: false,
104
- enableColumnPicker: true,
105
- enableCellNavigation: true,
106
- enableRowSelection: true
107
- };
108
-
109
- // mock a dataset
110
- const mockedDataset = [];
111
- for (let i = 0; i < 25; i++) {
112
- const randomYear = 2000 + Math.floor(Math.random() * 10);
113
- const randomMonth = Math.floor(Math.random() * 11);
114
- const randomDay = Math.floor((Math.random() * 29));
115
- const randomPercent = Math.round(Math.random() * 100);
116
-
117
- mockedDataset[i] = {
118
- id: i,
119
- title: 'Task ' + i,
120
- duration: Math.round(Math.random() * 100) + '',
121
- percentComplete: randomPercent,
122
- percentCompleteNumber: randomPercent,
123
- start: new Date(randomYear, randomMonth, randomDay),
124
- finish: new Date(randomYear, (randomMonth + 1), randomDay),
125
- effortDriven: (i % 5 === 0)
126
- };
127
- }
128
- this.dataset = mockedDataset;
129
- }
130
-
131
- //
132
- // -- if any of the Search form input changes, we'll call the updateFilter() method
133
- //
134
-
135
- cleargridSearchInput() {
136
- this.searchValue = '';
137
- this.updateFilter();
138
- }
139
-
140
- updateFilter() {
141
- this.angularGrid.filterService.updateSingleFilter({
142
- columnId: `${this.selectedColumn!.id || ''}`,
143
- operator: this.selectedOperator as OperatorString,
144
- searchTerms: [this.searchValue || '']
145
- });
146
- }
147
- }
@@ -1,29 +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-basic.component.ts">
8
- <span class="fa fa-link"></span> code
9
- </a>
10
- </span>
11
- </h2>
12
- <div class="subtitle" [innerHTML]="subTitle"></div>
13
-
14
- <h3>Grid 1</h3>
15
- <angular-slickgrid gridId="grid1"
16
- [columnDefinitions]="columnDefinitions1"
17
- [gridOptions]="gridOptions1"
18
- [dataset]="dataset1">
19
- </angular-slickgrid>
20
-
21
- <hr />
22
-
23
- <h3>Grid 2 <small>(with local Pagination)</small></h3>
24
- <angular-slickgrid gridId="grid2"
25
- [columnDefinitions]="columnDefinitions2"
26
- [gridOptions]="gridOptions2"
27
- [dataset]="dataset2">
28
- </angular-slickgrid>
29
- </div>
@@ -1,82 +0,0 @@
1
- import { Component, OnInit } from '@angular/core';
2
- import { Column, GridOption, Formatters } from './../modules/angular-slickgrid';
3
-
4
- const NB_ITEMS = 995;
5
-
6
- @Component({
7
- templateUrl: './grid-basic.component.html'
8
- })
9
- export class GridBasicComponent implements OnInit {
10
- title = 'Example 1: Basic Grids';
11
- subTitle = `
12
- Basic Grids with fixed sizes (800 x 225) set by "gridHeight" &amp; "gridWidth"
13
- <ul>
14
- <li><a href="https://github.com/ghiscoding/Angular-Slickgrid/wiki/HOWTO---Step-by-Step" target="_blank">Wiki HOWTO link</a></li>
15
- </ul>
16
- `;
17
-
18
- columnDefinitions1: Column[] = [];
19
- columnDefinitions2: Column[] = [];
20
- gridOptions1!: GridOption;
21
- gridOptions2!: GridOption;
22
- dataset1!: any[];
23
- dataset2!: any[];
24
-
25
- ngOnInit(): void {
26
- this.columnDefinitions1 = [
27
- { id: 'title', name: 'Title', field: 'title', sortable: true },
28
- { id: 'duration', name: 'Duration (days)', field: 'duration', sortable: true },
29
- { id: '%', name: '% Complete', field: 'percentComplete', sortable: true },
30
- { id: 'start', name: 'Start', field: 'start', formatter: Formatters.dateIso },
31
- { id: 'finish', name: 'Finish', field: 'finish', formatter: Formatters.dateIso },
32
- { id: 'effort-driven', name: 'Effort Driven', field: 'effortDriven', sortable: true }
33
- ];
34
- this.gridOptions1 = {
35
- enableAutoResize: false,
36
- enableSorting: true,
37
- gridHeight: 225,
38
- gridWidth: 800,
39
- };
40
-
41
- // copy the same Grid Options and Column Definitions to 2nd grid
42
- // but also add Pagination in this grid
43
- this.columnDefinitions2 = this.columnDefinitions1;
44
- this.gridOptions2 = {
45
- ...this.gridOptions1,
46
- ...{
47
- enablePagination: true,
48
- pagination: {
49
- pageSizes: [5, 10, 20, 25, 50],
50
- pageSize: 5
51
- },
52
- }
53
- };
54
-
55
- // mock some data (different in each dataset)
56
- this.dataset1 = this.mockData(NB_ITEMS);
57
- this.dataset2 = this.mockData(NB_ITEMS);
58
- }
59
-
60
- mockData(count: number) {
61
- // mock a dataset
62
- const mockDataset = [];
63
- for (let i = 0; i < count; i++) {
64
- const randomYear = 2000 + Math.floor(Math.random() * 10);
65
- const randomMonth = Math.floor(Math.random() * 11);
66
- const randomDay = Math.floor((Math.random() * 29));
67
- const randomPercent = Math.round(Math.random() * 100);
68
-
69
- mockDataset[i] = {
70
- id: i,
71
- title: 'Task ' + i,
72
- duration: Math.round(Math.random() * 100) + '',
73
- percentComplete: randomPercent,
74
- start: new Date(randomYear, randomMonth + 1, randomDay),
75
- finish: new Date(randomYear + 1, randomMonth + 1, randomDay),
76
- effortDriven: (i % 5 === 0)
77
- };
78
- }
79
-
80
- return mockDataset;
81
- }
82
- }