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,780 +0,0 @@
1
- import { Component, OnInit, ViewEncapsulation } from '@angular/core';
2
- import { HttpClient } from '@angular/common/http';
3
- import { ExcelExportService } from '@slickgrid-universal/excel-export';
4
-
5
- import { AngularGridInstance, Column, GridOption, Filters, Formatter, LongTextEditorOption, FieldType, Editors, Formatters, AutocompleteOption, EditCommand, formatNumber, SortComparers, SlickGrid, SlickNamespace } from '../modules/angular-slickgrid';
6
-
7
- const URL_COUNTRIES_COLLECTION = 'assets/data/countries.json';
8
- declare const Slick: SlickNamespace;
9
-
10
- /**
11
- * Check if the current item (cell) is editable or not
12
- * @param {*} dataContext - item data context object
13
- * @param {*} columnDef - column definition
14
- * @param {*} grid - slickgrid grid object
15
- * @returns {boolean} isEditable
16
- */
17
- function checkItemIsEditable(dataContext: any, columnDef: Column, grid: SlickGrid) {
18
- const gridOptions = grid && grid.getOptions && grid.getOptions();
19
- const hasEditor = columnDef.editor;
20
- const isGridEditable = gridOptions.editable;
21
- let isEditable = !!(isGridEditable && hasEditor);
22
-
23
- if (dataContext && columnDef && gridOptions && gridOptions.editable) {
24
- switch (columnDef.id) {
25
- case 'finish':
26
- isEditable = !!dataContext?.completed;
27
- break;
28
- }
29
- }
30
- return isEditable;
31
- }
32
-
33
- const customEditableInputFormatter: Formatter = (_row, _cell, value, columnDef, _dataContext, grid) => {
34
- const gridOptions = grid && grid.getOptions && grid.getOptions();
35
- const isEditableLine = gridOptions.editable && columnDef.editor;
36
- value = (value === null || value === undefined) ? '' : value;
37
- return isEditableLine ? { text: value, addClasses: 'editable-field', toolTip: 'Click to Edit' } : value;
38
- };
39
-
40
- // you can create custom validator to pass to an inline editor
41
- const myCustomTitleValidator = (value: any, args: any) => {
42
- if ((value === null || value === undefined || !value.length) && (args.compositeEditorOptions && args.compositeEditorOptions.modalType === 'create' || args.compositeEditorOptions.modalType === 'edit')) {
43
- // we will only check if the field is supplied when it's an inline editing OR a composite editor of type create/edit
44
- return { valid: false, msg: 'This is a required field.' };
45
- } else if (!/^(task\s\d+)*$/i.test(value)) {
46
- return { valid: false, msg: 'Your title is invalid, it must start with "Task" followed by a number.' };
47
- }
48
- return { valid: true, msg: '' };
49
- };
50
-
51
- @Component({
52
- templateUrl: './grid-resize-by-content.component.html',
53
- styleUrls: ['./grid-resize-by-content.component.scss'],
54
- encapsulation: ViewEncapsulation.None,
55
- })
56
- export class GridResizeByContentComponent implements OnInit {
57
- title = 'Example 31: Columns Resize by Content';
58
- subTitle = `The grid below uses the optional resize by cell content (with a fixed 950px for demo purposes), you can click on the 2 buttons to see the difference. The "autosizeColumns" is really the default option used by Angular-SlickGrid, the resize by cell content is optional because it requires to read the first thousand rows and do extra width calculation.`;
59
-
60
- angularGrid!: AngularGridInstance;
61
- gridOptions!: GridOption;
62
- columnDefinitions: Column[] = [];
63
- dataset: any[] = [];
64
- editQueue: any[] = [];
65
- editedItems: any = {};
66
- isUsingDefaultResize = false;
67
- isGridEditable = true;
68
- isCompositeDisabled = false;
69
- isMassSelectionDisabled = true;
70
- complexityLevelList = [
71
- { value: 0, label: 'Very Simple' },
72
- { value: 1, label: 'Simple' },
73
- { value: 2, label: 'Straightforward' },
74
- { value: 3, label: 'Complex' },
75
- { value: 4, label: 'Very Complex' },
76
- ];
77
-
78
- constructor(private http: HttpClient) { }
79
-
80
- angularGridReady(angularGrid: AngularGridInstance) {
81
- this.angularGrid = angularGrid;
82
- }
83
-
84
- ngOnInit(): void {
85
- this.defineGrid();
86
- this.dataset = this.loadData(5000);
87
- }
88
-
89
- // Grid2 definition
90
- defineGrid() {
91
- this.columnDefinitions = [
92
- {
93
- id: 'title', name: 'Title', field: 'title', sortable: true, type: FieldType.string, minWidth: 65,
94
- // you can adjust the resize calculation via multiple options
95
- resizeExtraWidthPadding: 4,
96
- resizeCharWidthInPx: 7.6,
97
- resizeCalcWidthRatio: 1,
98
- resizeMaxWidthThreshold: 200,
99
- filterable: true, columnGroup: 'Common Factor',
100
- filter: { model: Filters.compoundInputText },
101
- formatter: Formatters.multiple, params: { formatters: [Formatters.uppercase, Formatters.bold] },
102
- editor: {
103
- model: Editors.longText, required: true, alwaysSaveOnEnterKey: true,
104
- maxLength: 12,
105
- editorOptions: {
106
- cols: 45,
107
- rows: 6,
108
- buttonTexts: {
109
- cancel: 'Close',
110
- save: 'Done'
111
- }
112
- } as LongTextEditorOption,
113
- validator: myCustomTitleValidator,
114
- },
115
- },
116
- {
117
- id: 'duration', name: 'Duration', field: 'duration', sortable: true, filterable: true, minWidth: 65,
118
- type: FieldType.number, columnGroup: 'Common Factor',
119
- formatter: (_row, _cell, value) => {
120
- if (value === null || value === undefined || value === '') {
121
- return '';
122
- }
123
- return value > 1 ? `${value} days` : `${value} day`;
124
- },
125
- editor: { model: Editors.float, decimal: 2, valueStep: 1, minValue: 0, maxValue: 10000, alwaysSaveOnEnterKey: true, required: true },
126
- },
127
- {
128
- id: 'cost', name: 'Cost', field: 'cost', minWidth: 65,
129
- sortable: true, filterable: true, type: FieldType.number, columnGroup: 'Analysis',
130
- filter: { model: Filters.compoundInputNumber },
131
- formatter: Formatters.dollar,
132
- },
133
- {
134
- id: 'percentComplete', name: '% Complete', field: 'percentComplete', minWidth: 100,
135
- type: FieldType.number,
136
- sortable: true, filterable: true, columnGroup: 'Analysis',
137
- filter: { model: Filters.compoundSlider, operator: '>=' },
138
- editor: {
139
- model: Editors.slider,
140
- minValue: 0, maxValue: 100,
141
- },
142
- },
143
- {
144
- id: 'complexity', name: 'Complexity', field: 'complexity',
145
- resizeCalcWidthRatio: 0.82, // default calc ratio is 1 or 0.95 for field type of string
146
- sortable: true, filterable: true, columnGroup: 'Analysis',
147
- formatter: (_row, _cell, value) => this.complexityLevelList[value].label,
148
- exportCustomFormatter: (_row, _cell, value) => this.complexityLevelList[value].label,
149
- filter: {
150
- model: Filters.multipleSelect,
151
- collection: this.complexityLevelList
152
- },
153
- editor: {
154
- model: Editors.singleSelect,
155
- collection: this.complexityLevelList,
156
- },
157
- },
158
- {
159
- id: 'start', name: 'Start', field: 'start', sortable: true,
160
- formatter: Formatters.dateUs, columnGroup: 'Period',
161
- exportCustomFormatter: Formatters.dateUs,
162
- type: FieldType.date, outputType: FieldType.dateUs, saveOutputType: FieldType.dateUtc,
163
- filterable: true, filter: { model: Filters.compoundDate },
164
- editor: { model: Editors.date, params: { hideClearButton: false } },
165
- },
166
- {
167
- id: 'completed', name: 'Completed', field: 'completed', width: 80, minWidth: 75, maxWidth: 100,
168
- sortable: true, filterable: true, columnGroup: 'Period',
169
- formatter: Formatters.multiple,
170
- params: { formatters: [Formatters.checkmark, Formatters.center] },
171
- exportWithFormatter: false,
172
- filter: {
173
- collection: [{ value: '', label: '' }, { value: true, label: 'True' }, { value: false, label: 'False' }],
174
- model: Filters.singleSelect
175
- },
176
- editor: { model: Editors.checkbox, },
177
- // editor: { model: Editors.singleSelect, collection: [{ value: true, label: 'Yes' }, { value: false, label: 'No' }], },
178
- },
179
- {
180
- id: 'finish', name: 'Finish', field: 'finish', sortable: true,
181
- formatter: Formatters.dateUs, columnGroup: 'Period',
182
- type: FieldType.date, outputType: FieldType.dateUs, saveOutputType: FieldType.dateUtc,
183
- filterable: true, filter: { model: Filters.compoundDate },
184
- exportCustomFormatter: Formatters.dateUs,
185
- editor: {
186
- model: Editors.date,
187
- editorOptions: { minDate: 'today' },
188
- validator: (value, args) => {
189
- const dataContext = args && args.item;
190
- if (dataContext && (dataContext.completed && !value)) {
191
- return { valid: false, msg: 'You must provide a "Finish" date when "Completed" is checked.' };
192
- }
193
- return { valid: true, msg: '' };
194
- }
195
- },
196
- },
197
- {
198
- id: 'product', name: 'Product', field: 'product',
199
- filterable: true, columnGroup: 'Item',
200
- minWidth: 100,
201
- resizeCharWidthInPx: 8,
202
- exportWithFormatter: true,
203
- dataKey: 'id',
204
- labelKey: 'itemName',
205
- formatter: Formatters.complexObject,
206
- exportCustomFormatter: Formatters.complex, // without the Editing cell Formatter
207
- type: FieldType.object,
208
- sortComparer: SortComparers.objectString,
209
- editor: {
210
- model: Editors.autoComplete,
211
- alwaysSaveOnEnterKey: true,
212
-
213
- // example with a Remote API call
214
- editorOptions: {
215
- minLength: 1,
216
- source: (request, response) => {
217
- // const items = require('c://TEMP/items.json');
218
- const products = this.mockProducts();
219
- response(products.filter(product => product.itemName.toLowerCase().includes(request.term.toLowerCase())));
220
- },
221
- renderItem: {
222
- // layout: 'twoRows',
223
- // templateCallback: (item: any) => this.renderItemCallbackWith2Rows(item),
224
-
225
- layout: 'fourCorners',
226
- templateCallback: (item: any) => this.renderItemCallbackWith4Corners(item),
227
- },
228
- } as AutocompleteOption,
229
- },
230
- filter: {
231
- model: Filters.inputText,
232
- // placeholder: '🔎︎ search city',
233
- type: FieldType.string,
234
- queryField: 'product.itemName',
235
- }
236
- },
237
- {
238
- id: 'origin', name: 'Country of Origin', field: 'origin',
239
- formatter: Formatters.complexObject, columnGroup: 'Item',
240
- exportCustomFormatter: Formatters.complex, // without the Editing cell Formatter
241
- dataKey: 'code',
242
- labelKey: 'name',
243
- type: FieldType.object,
244
- sortComparer: SortComparers.objectString,
245
- filterable: true,
246
- sortable: true,
247
- minWidth: 100,
248
- editor: {
249
- model: Editors.autoComplete,
250
- customStructure: { label: 'name', value: 'code' },
251
- collectionAsync: this.http.get(URL_COUNTRIES_COLLECTION),
252
- },
253
- filter: {
254
- model: Filters.inputText,
255
- type: FieldType.string,
256
- queryField: 'origin.name',
257
- }
258
- },
259
- {
260
- id: 'action', name: 'Action', field: 'action', width: 70, minWidth: 70, maxWidth: 70,
261
- excludeFromExport: true,
262
- formatter: () => `<div class="button-style margin-auto" style="width: 35px;"><span class="fa fa-chevron-down text-primary"></span></div>`,
263
- cellMenu: {
264
- hideCloseButton: false,
265
- commandTitle: 'Commands',
266
- commandItems: [
267
- {
268
- command: 'help',
269
- title: 'Help!',
270
- iconCssClass: 'fa fa-question-circle',
271
- positionOrder: 66,
272
- action: () => alert('Please Help!'),
273
- },
274
- 'divider',
275
- {
276
- command: 'delete-row', title: 'Delete Row', positionOrder: 64,
277
- iconCssClass: 'fa fa-times color-danger', cssClass: 'red', textCssClass: 'text-italic color-danger-light',
278
- // only show command to 'Delete Row' when the task is not completed
279
- itemVisibilityOverride: (args) => {
280
- return !args.dataContext?.completed;
281
- },
282
- action: (_event, args) => {
283
- const dataContext = args.dataContext;
284
- const row = args?.row ?? 0;
285
- if (confirm(`Do you really want to delete row (${row + 1}) with "${dataContext.title}"`)) {
286
- this.angularGrid.gridService.deleteItemById(dataContext.id);
287
- }
288
- }
289
- },
290
- ],
291
- }
292
- },
293
- ];
294
-
295
- this.gridOptions = {
296
- editable: true,
297
- autoAddCustomEditorFormatter: customEditableInputFormatter,
298
- enableCellNavigation: true,
299
- autoEdit: true,
300
- autoCommitEdit: true,
301
- autoResize: {
302
- container: '#smaller-container',
303
- rightPadding: 10
304
- },
305
- enableAutoResize: true,
306
-
307
- // resizing by cell content is opt-in
308
- // we first need to disable the 2 default flags to autoFit/autosize
309
- autoFitColumnsOnFirstLoad: false,
310
- enableAutoSizeColumns: false,
311
- // then enable resize by content with these 2 flags
312
- autosizeColumnsByCellContentOnFirstLoad: true,
313
- enableAutoResizeColumnsByCellContent: true,
314
-
315
- resizeByContentOptions: {
316
- // optional resize calculation options
317
- defaultRatioForStringType: 0.92,
318
- formatterPaddingWidthInPx: 8, // optional editor formatter padding for resize calculation
319
- },
320
-
321
- enableExcelExport: true,
322
- excelExportOptions: {
323
- exportWithFormatter: false
324
- },
325
- registerExternalResources: [new ExcelExportService()],
326
- enableFiltering: true,
327
- enableRowSelection: true,
328
- enableCheckboxSelector: true,
329
- checkboxSelector: {
330
- hideInFilterHeaderRow: false,
331
- hideInColumnTitleRow: true,
332
- },
333
- rowSelectionOptions: {
334
- // True (Single Selection), False (Multiple Selections)
335
- selectActiveRow: false
336
- },
337
- createPreHeaderPanel: true,
338
- showPreHeaderPanel: true,
339
- preHeaderPanelHeight: 28,
340
- rowHeight: 33,
341
- headerRowHeight: 35,
342
- editCommandHandler: (item, column, editCommand) => {
343
- // composite editors values are saved as array, so let's convert to array in any case and we'll loop through these values
344
- const prevSerializedValues = Array.isArray(editCommand.prevSerializedValue) ? editCommand.prevSerializedValue : [editCommand.prevSerializedValue];
345
- const serializedValues = Array.isArray(editCommand.serializedValue) ? editCommand.serializedValue : [editCommand.serializedValue];
346
- const editorColumns = this.columnDefinitions.filter((col) => col.editor !== undefined);
347
-
348
- const modifiedColumns: Column[] = [];
349
- prevSerializedValues.forEach((_val, index) => {
350
- const prevSerializedValue = prevSerializedValues[index];
351
- const serializedValue = serializedValues[index];
352
-
353
- if (prevSerializedValue !== serializedValue) {
354
- const finalColumn = Array.isArray(editCommand.prevSerializedValue) ? editorColumns[index] : column;
355
- this.editedItems[this.gridOptions.datasetIdPropertyName || 'id'] = item; // keep items by their row indexes, if the row got edited twice then we'll keep only the last change
356
- this.angularGrid.slickGrid.invalidate();
357
- editCommand.execute();
358
-
359
- this.renderUnsavedCellStyling(item, finalColumn, editCommand);
360
- modifiedColumns.push(finalColumn);
361
- }
362
- });
363
-
364
- // queued editor only keeps 1 item object even when it's a composite editor,
365
- // so we'll push only 1 change at the end but with all columns modified
366
- // this way we can undo the entire row change (for example if user changes 3 field in the editor modal, then doing a undo last change will undo all 3 in 1 shot)
367
- this.editQueue.push({ item, columns: modifiedColumns, editCommand });
368
- },
369
- // when using the cellMenu, you can change some of the default options and all use some of the callback methods
370
- enableCellMenu: true,
371
- };
372
- }
373
-
374
- loadData(count: number) {
375
- // mock data
376
- const tmpArray: any[] = [];
377
- for (let i = 0; i < count; i++) {
378
- const randomItemId = Math.floor(Math.random() * this.mockProducts().length);
379
- const randomYear = 2000 + Math.floor(Math.random() * 10);
380
- const randomFinishYear = (new Date().getFullYear()) + Math.floor(Math.random() * 10); // use only years not lower than 3 years ago
381
- const randomMonth = Math.floor(Math.random() * 11);
382
- const randomDay = Math.floor((Math.random() * 29));
383
- const randomTime = Math.floor((Math.random() * 59));
384
- const randomFinish = new Date(randomFinishYear, (randomMonth + 1), randomDay, randomTime, randomTime, randomTime);
385
- const randomPercentComplete = Math.floor(Math.random() * 100) + 15; // make it over 15 for E2E testing purposes
386
- const percentCompletion = randomPercentComplete > 100 ? (i > 5 ? 100 : 88) : randomPercentComplete; // don't use 100 unless it's over index 5, for E2E testing purposes
387
- const isCompleted = percentCompletion === 100;
388
-
389
- tmpArray[i] = {
390
- id: i,
391
- title: 'Task ' + i,
392
- duration: Math.floor(Math.random() * 100) + 10,
393
- percentComplete: percentCompletion,
394
- analysis: {
395
- percentComplete: percentCompletion,
396
- },
397
- complexity: i % 3 ? 0 : 2,
398
- start: new Date(randomYear, randomMonth, randomDay, randomDay, randomTime, randomTime, randomTime),
399
- finish: (isCompleted || (i % 3 === 0 && (randomFinish > new Date() && i > 3)) ? (isCompleted ? new Date() : randomFinish) : ''), // make sure the random date is earlier than today and it's index is bigger than 3
400
- cost: (i % 33 === 0) ? null : Math.round(Math.random() * 10000) / 100,
401
- completed: (isCompleted || (i % 3 === 0 && (randomFinish > new Date() && i > 3))),
402
- product: { id: this.mockProducts()[randomItemId]?.id, itemName: this.mockProducts()[randomItemId]?.itemName, },
403
- origin: (i % 2) ? { code: 'CA', name: 'Canada' } : { code: 'US', name: 'United States' },
404
- };
405
-
406
- if (!(i % 8)) {
407
- delete tmpArray[i].finish; // also test with undefined properties
408
- delete tmpArray[i].percentComplete; // also test with undefined properties
409
- }
410
- }
411
- return tmpArray;
412
- }
413
-
414
- handleValidationError(_e: Event, args: any) {
415
- if (args.validationResults) {
416
- alert(args.validationResults.msg);
417
- }
418
- return false;
419
- }
420
-
421
- handleItemDeleted(_e: Event, args: any) {
422
- console.log('item deleted with id:', args.itemId);
423
- }
424
-
425
- handleOnBeforeEditCell(e: Event, args: any) {
426
- const { column, item, grid } = args;
427
-
428
- if (column && item) {
429
- if (!checkItemIsEditable(item, column, grid)) {
430
- // event.preventDefault();
431
- e.stopImmediatePropagation();
432
- }
433
- }
434
- return false;
435
- }
436
-
437
- handleOnCellChange(_e: Event, args: any) {
438
- const dataContext = args?.item;
439
-
440
- // when the field "completed" changes to false, we also need to blank out the "finish" date
441
- if (dataContext && !dataContext.completed) {
442
- dataContext.finish = null;
443
- this.angularGrid.gridService.updateItem(dataContext);
444
- }
445
- }
446
-
447
- handlePaginationChanged() {
448
- this.removeAllUnsavedStylingFromCell();
449
- this.renderUnsavedStylingOnAllVisibleCells();
450
- }
451
-
452
- handleDefaultResizeColumns() {
453
- // just for demo purposes, set it back to its original width
454
- const columns = this.angularGrid.slickGrid.getColumns() as Column[];
455
- columns.forEach(col => col.width = col.originalWidth);
456
- this.angularGrid.slickGrid.setColumns(columns);
457
- this.angularGrid.slickGrid.autosizeColumns();
458
- this.isUsingDefaultResize = true;
459
- }
460
-
461
- handleNewResizeColumns() {
462
- this.angularGrid.resizerService.resizeColumnsByCellContent(true);
463
- this.isUsingDefaultResize = false;
464
- }
465
-
466
- toggleGridEditReadonly() {
467
- // first need undo all edits
468
- this.undoAllEdits();
469
-
470
- // then change a single grid options to make the grid non-editable (readonly)
471
- this.isGridEditable = !this.isGridEditable;
472
- this.isCompositeDisabled = !this.isGridEditable;
473
- if (!this.isGridEditable) {
474
- this.isMassSelectionDisabled = true;
475
- }
476
- // dynamically change SlickGrid editable grid option
477
- this.angularGrid.slickGrid.setOptions({ editable: this.isGridEditable });
478
- }
479
-
480
- removeUnsavedStylingFromCell(_item: any, column: Column, row: number) {
481
- // remove unsaved css class from that cell
482
- this.angularGrid.slickGrid.removeCellCssStyles(`unsaved_highlight_${[column.id]}${row}`);
483
- }
484
-
485
- removeAllUnsavedStylingFromCell() {
486
- for (const lastEdit of this.editQueue) {
487
- const lastEditCommand = lastEdit?.editCommand;
488
- if (lastEditCommand) {
489
- // remove unsaved css class from that cell
490
- for (const lastEditColumn of lastEdit.columns) {
491
- this.removeUnsavedStylingFromCell(lastEdit.item, lastEditColumn, lastEditCommand.row);
492
- }
493
- }
494
- }
495
- }
496
-
497
- renderUnsavedStylingOnAllVisibleCells() {
498
- for (const lastEdit of this.editQueue) {
499
- if (lastEdit) {
500
- const { item, columns, editCommand } = lastEdit;
501
- if (Array.isArray(columns)) {
502
- columns.forEach((col) => {
503
- this.renderUnsavedCellStyling(item, col, editCommand);
504
- });
505
- }
506
- }
507
- }
508
- }
509
-
510
- renderUnsavedCellStyling(item: any, column: Column, editCommand: EditCommand) {
511
- if (editCommand && item && column) {
512
- const row = this.angularGrid.dataView.getRowByItem(item) as number;
513
- if (row >= 0) {
514
- const hash = { [row]: { [column.id]: 'unsaved-editable-field' } };
515
- this.angularGrid.slickGrid.setCellCssStyles(`unsaved_highlight_${[column.id]}${row}`, hash);
516
- }
517
- }
518
- }
519
-
520
-
521
- saveAll() {
522
- // Edit Queue (array increases every time a cell is changed, regardless of item object)
523
- console.log(this.editQueue);
524
-
525
- // Edit Items only keeps the merged data (an object with row index as the row properties)
526
- // if you change 2 different cells on 2 different cells then this editedItems will only contain 1 property
527
- // example: editedItems = { 0: { title: task 0, duration: 50, ... }}
528
- // ...means that row index 0 got changed and the final merged object is { title: task 0, duration: 50, ... }
529
- console.log(this.editedItems);
530
- // console.log(`We changed ${Object.keys(this.editedItems).length} rows`);
531
-
532
- // since we saved, we can now remove all the unsaved color styling and reset our array/object
533
- this.removeAllUnsavedStylingFromCell();
534
- this.editQueue = [];
535
- this.editedItems = {};
536
- }
537
-
538
- undoLastEdit(showLastEditor = false) {
539
- const lastEdit = this.editQueue.pop();
540
- const lastEditCommand = lastEdit?.editCommand;
541
- if (lastEdit && lastEditCommand && Slick.GlobalEditorLock.cancelCurrentEdit()) {
542
- lastEditCommand.undo();
543
-
544
- // remove unsaved css class from that cell
545
- for (const lastEditColumn of lastEdit.columns) {
546
- this.removeUnsavedStylingFromCell(lastEdit.item, lastEditColumn, lastEditCommand.row);
547
- }
548
- this.angularGrid.slickGrid.invalidate();
549
-
550
-
551
- // optionally open the last cell editor associated
552
- if (showLastEditor) {
553
- this.angularGrid?.slickGrid.gotoCell(lastEditCommand.row, lastEditCommand.cell, false);
554
- }
555
- }
556
- }
557
-
558
- undoAllEdits() {
559
- for (const lastEdit of this.editQueue) {
560
- const lastEditCommand = lastEdit?.editCommand;
561
- if (lastEditCommand && Slick.GlobalEditorLock.cancelCurrentEdit()) {
562
- lastEditCommand.undo();
563
-
564
- // remove unsaved css class from that cell
565
- for (const lastEditColumn of lastEdit.columns) {
566
- this.removeUnsavedStylingFromCell(lastEdit.item, lastEditColumn, lastEditCommand.row);
567
- }
568
- }
569
- }
570
- this.angularGrid.slickGrid.invalidate(); // re-render the grid only after every cells got rolled back
571
- this.editQueue = [];
572
- }
573
-
574
- mockProducts() {
575
- return [
576
- {
577
- id: 0,
578
- itemName: 'Sleek Metal Computer',
579
- itemNameTranslated: 'some fantastic sleek metal computer description',
580
- listPrice: 2100.23,
581
- itemTypeName: 'I',
582
- image: 'http://i.stack.imgur.com/pC1Tv.jpg',
583
- icon: `mdi ${this.getRandomIcon(0)}`,
584
- },
585
- {
586
- id: 1,
587
- itemName: 'Tasty Granite Table',
588
- itemNameTranslated: 'an extremely huge and heavy table',
589
- listPrice: 3200.12,
590
- itemTypeName: 'I',
591
- image: 'https://i.imgur.com/Fnm7j6h.jpg',
592
- icon: `mdi ${this.getRandomIcon(1)}`,
593
- },
594
- {
595
- id: 2,
596
- itemName: 'Awesome Wooden Mouse',
597
- itemNameTranslated: 'super old mouse',
598
- listPrice: 15.00,
599
- itemTypeName: 'I',
600
- image: 'https://i.imgur.com/RaVJuLr.jpg',
601
- icon: `mdi ${this.getRandomIcon(2)}`,
602
- },
603
- {
604
- id: 3,
605
- itemName: 'Gorgeous Fresh Shirt',
606
- itemNameTranslated: 'what a gorgeous shirt seriously',
607
- listPrice: 25.76,
608
- itemTypeName: 'I',
609
- image: 'http://i.stack.imgur.com/pC1Tv.jpg',
610
- icon: `mdi ${this.getRandomIcon(3)}`,
611
- },
612
- {
613
- id: 4,
614
- itemName: 'Refined Cotton Table',
615
- itemNameTranslated: 'super light table that will fall apart amazingly fast',
616
- listPrice: 13.35,
617
- itemTypeName: 'I',
618
- image: 'https://i.imgur.com/Fnm7j6h.jpg',
619
- icon: `mdi ${this.getRandomIcon(4)}`,
620
- },
621
- {
622
- id: 5,
623
- itemName: 'Intelligent Wooden Pizza',
624
- itemNameTranslated: 'wood not included',
625
- listPrice: 23.33,
626
- itemTypeName: 'I',
627
- image: 'https://i.imgur.com/RaVJuLr.jpg',
628
- icon: `mdi ${this.getRandomIcon(5)}`,
629
- },
630
- {
631
- id: 6,
632
- itemName: 'Licensed Cotton Chips',
633
- itemNameTranslated: 'not sure what that is',
634
- listPrice: 71.21,
635
- itemTypeName: 'I',
636
- image: 'http://i.stack.imgur.com/pC1Tv.jpg',
637
- icon: `mdi ${this.getRandomIcon(6)}`,
638
- },
639
- {
640
- id: 7,
641
- itemName: 'Ergonomic Rubber Soap',
642
- itemNameTranslated: `so good you'll want to use it every night`,
643
- listPrice: 2.43,
644
- itemTypeName: 'I',
645
- image: 'https://i.imgur.com/Fnm7j6h.jpg',
646
- icon: `mdi ${this.getRandomIcon(7)}`,
647
- },
648
- {
649
- id: 8,
650
- itemName: 'Handcrafted Steel Car',
651
- itemNameTranslated: `aka tesla truck`,
652
- listPrice: 31288.39,
653
- itemTypeName: 'I',
654
- image: 'https://i.imgur.com/RaVJuLr.jpg',
655
- icon: `mdi ${this.getRandomIcon(8)}`,
656
- },
657
- ];
658
- }
659
-
660
- /** List of icons that are supported in this lib Material Design Icons */
661
- getRandomIcon(iconIndex?: number) {
662
- const icons = [
663
- 'fa-500px',
664
- 'fa-address-book',
665
- 'fa-address-book-o',
666
- 'fa-address-card',
667
- 'fa-address-card-o',
668
- 'fa-adjust',
669
- 'fa-adn',
670
- 'fa-align-center',
671
- 'fa-align-justify',
672
- 'fa-align-left',
673
- 'fa-align-right',
674
- 'fa-amazon',
675
- 'fa-ambulance',
676
- 'fa-american-sign-language-interpreting',
677
- 'fa-anchor',
678
- 'fa-android',
679
- 'fa-angellist',
680
- 'fa-angle-double-down',
681
- 'fa-angle-double-left',
682
- 'fa-angle-double-right',
683
- 'fa-angle-double-up',
684
- 'fa-angle-down',
685
- 'fa-angle-left',
686
- 'fa-angle-right',
687
- 'fa-angle-up',
688
- 'fa-apple',
689
- 'fa-archive',
690
- 'fa-area-chart',
691
- 'fa-arrow-circle-down',
692
- 'fa-arrow-circle-left',
693
- 'fa-arrow-circle-o-down',
694
- 'fa-arrow-circle-o-left',
695
- 'fa-arrow-circle-o-right',
696
- 'fa-arrow-circle-o-up',
697
- 'fa-arrow-circle-right',
698
- 'fa-arrow-circle-up',
699
- 'fa-arrow-down',
700
- 'fa-arrow-left',
701
- 'fa-arrow-right',
702
- 'fa-arrow-up',
703
- 'fa-arrows',
704
- 'fa-arrows-alt',
705
- 'fa-arrows-h',
706
- 'fa-arrows-v',
707
- 'fa-assistive-listening-systems',
708
- 'fa-asterisk',
709
- 'fa-at',
710
- 'fa-audio-description',
711
- 'fa-backward',
712
- 'fa-balance-scale',
713
- 'fa-ban',
714
- 'fa-bandcamp',
715
- 'fa-bank (alias)',
716
- 'fa-bar-chart',
717
- 'fa-barcode',
718
- 'fa-bars',
719
- 'fa-bath',
720
- 'fa-battery-empty',
721
- 'fa-battery-full',
722
- 'fa-battery-half',
723
- 'fa-battery-quarter',
724
- 'fa-battery-three-quarters',
725
- 'fa-bed',
726
- 'fa-beer',
727
- 'fa-behance',
728
- 'fa-behance-square',
729
- 'fa-bell',
730
- 'fa-bell-o',
731
- 'fa-bell-slash',
732
- 'fa-bell-slash-o',
733
- 'fa-bicycle',
734
- 'fa-binoculars',
735
- 'fa-birthday-cake',
736
- 'fa-bitbucket',
737
- 'fa-bitbucket-square',
738
- ];
739
- const randomNumber = Math.floor((Math.random() * icons.length - 1));
740
- return icons[iconIndex ?? randomNumber];
741
- }
742
-
743
- renderItemCallbackWith2Rows(item: any): string {
744
- return `<div class="autocomplete-container-list">
745
- <div class="autocomplete-left">
746
- <!--<img src="http://i.stack.imgur.com/pC1Tv.jpg" width="50" />-->
747
- <span class="fa ${item.icon}"></span>
748
- </div>
749
- <div>
750
- <span class="autocomplete-top-left">
751
- <span class="mdfai ${item.itemTypeName === 'I' ? 'fa-info-circle' : 'fa-copy'}"></span>
752
- ${item.itemName}
753
- </span>
754
- <div>
755
- </div>
756
- <div>
757
- <div class="autocomplete-bottom-left">${item.itemNameTranslated}</div>
758
- </div>`;
759
- }
760
-
761
- renderItemCallbackWith4Corners(item: any): string {
762
- return `<div class="autocomplete-container-list">
763
- <div class="autocomplete-left">
764
- <!--<img src="http://i.stack.imgur.com/pC1Tv.jpg" width="50" />-->
765
- <span class="fa ${item.icon}"></span>
766
- </div>
767
- <div>
768
- <span class="autocomplete-top-left">
769
- <span class="fa ${item.itemTypeName === 'I' ? 'fa-info-circle' : 'fa-copy'}"></span>
770
- ${item.itemName}
771
- </span>
772
- <span class="autocomplete-top-right">${formatNumber(item.listPrice, 2, 2, false, '$')}</span>
773
- <div>
774
- </div>
775
- <div>
776
- <div class="autocomplete-bottom-left">${item.itemNameTranslated}</div>
777
- <span class="autocomplete-bottom-right">Type: <b>${item.itemTypeName === 'I' ? 'Item' : item.itemTypeName === 'C' ? 'PdCat' : 'Cat'}</b></span>
778
- </div>`;
779
- }
780
- }