angular-slickgrid 9.0.0 → 9.0.2

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 (395) hide show
  1. package/LICENSE +1 -1
  2. package/{dist/fesm2022 → fesm2022}/angular-slickgrid.mjs +16 -16
  3. package/package.json +27 -14
  4. package/.gitbook.yaml +0 -5
  5. package/CHANGELOG.md +0 -1691
  6. package/CONTRIBUTING.md +0 -17
  7. package/angular.json +0 -133
  8. package/coverage/base.css +0 -224
  9. package/coverage/block-navigation.js +0 -87
  10. package/coverage/clover.xml +0 -1620
  11. package/coverage/coverage-final.json +0 -9
  12. package/coverage/favicon.png +0 -0
  13. package/coverage/index.html +0 -176
  14. package/coverage/library/components/angular-slickgrid.component.ts.html +0 -5074
  15. package/coverage/library/components/index.html +0 -116
  16. package/coverage/library/constants.ts.html +0 -397
  17. package/coverage/library/extensions/index.html +0 -116
  18. package/coverage/library/extensions/slickRowDetailView.ts.html +0 -1261
  19. package/coverage/library/index.html +0 -116
  20. package/coverage/library/modules/angular-slickgrid.module.ts.html +0 -166
  21. package/coverage/library/modules/index.html +0 -116
  22. package/coverage/library/services/angularUtil.service.ts.html +0 -445
  23. package/coverage/library/services/container.service.ts.html +0 -163
  24. package/coverage/library/services/index.html +0 -161
  25. package/coverage/library/services/translater.service.ts.html +0 -199
  26. package/coverage/library/services/utilities.ts.html +0 -142
  27. package/coverage/prettify.css +0 -1
  28. package/coverage/prettify.js +0 -2
  29. package/coverage/sort-arrow-sprite.png +0 -0
  30. package/coverage/sorter.js +0 -196
  31. package/dist/LICENSE +0 -21
  32. package/dist/README.md +0 -142
  33. package/docs/README.md +0 -5
  34. package/docs/TOC.md +0 -105
  35. package/docs/backend-services/Custom-Backend-Service.md +0 -50
  36. package/docs/backend-services/GraphQL.md +0 -276
  37. package/docs/backend-services/OData.md +0 -245
  38. package/docs/backend-services/graphql/GraphQL-Filtering.md +0 -156
  39. package/docs/backend-services/graphql/GraphQL-JSON-Result.md +0 -85
  40. package/docs/backend-services/graphql/GraphQL-Pagination.md +0 -77
  41. package/docs/backend-services/graphql/GraphQL-Sorting.md +0 -78
  42. package/docs/column-functionalities/cell-menu.md +0 -212
  43. package/docs/column-functionalities/editors/autocomplete-editor.md +0 -466
  44. package/docs/column-functionalities/editors/date-editor-flatpickr.md +0 -71
  45. package/docs/column-functionalities/editors/date-editor-vanilla-calendar.md +0 -91
  46. package/docs/column-functionalities/editors/longtext-editor-textarea.md +0 -80
  47. package/docs/column-functionalities/editors/select-dropdown-editor.md +0 -227
  48. package/docs/column-functionalities/editors.md +0 -604
  49. package/docs/column-functionalities/filters/autocomplete-filter.md +0 -183
  50. package/docs/column-functionalities/filters/compound-filters.md +0 -234
  51. package/docs/column-functionalities/filters/custom-filter.md +0 -117
  52. package/docs/column-functionalities/filters/filter-intro.md +0 -81
  53. package/docs/column-functionalities/filters/input-filter.md +0 -260
  54. package/docs/column-functionalities/filters/range-filters.md +0 -188
  55. package/docs/column-functionalities/filters/select-filter.md +0 -695
  56. package/docs/column-functionalities/filters/single-search-filter.md +0 -77
  57. package/docs/column-functionalities/filters/styling-filled-filters.md +0 -45
  58. package/docs/column-functionalities/formatters.md +0 -325
  59. package/docs/column-functionalities/sorting.md +0 -200
  60. package/docs/developer-guides/csp-compliance.md +0 -64
  61. package/docs/events/Available-Events.md +0 -223
  62. package/docs/events/Grid-&-DataView-Events.md +0 -211
  63. package/docs/getting-started/quick-start.md +0 -230
  64. package/docs/getting-started/troubleshooting.md +0 -80
  65. package/docs/grid-functionalities/Column-Picker.md +0 -22
  66. package/docs/grid-functionalities/Composite-Editor-Modal.md +0 -627
  67. package/docs/grid-functionalities/Context-Menu.md +0 -226
  68. package/docs/grid-functionalities/Custom-Footer.md +0 -80
  69. package/docs/grid-functionalities/Custom-Tooltip-(plugin).md +0 -258
  70. package/docs/grid-functionalities/Export-to-Excel.md +0 -457
  71. package/docs/grid-functionalities/Export-to-Text-File.md +0 -165
  72. package/docs/grid-functionalities/FAQ.md +0 -53
  73. package/docs/grid-functionalities/Global-Options.md +0 -29
  74. package/docs/grid-functionalities/Grid-Auto-Resize.md +0 -218
  75. package/docs/grid-functionalities/Grid-Menu.md +0 -134
  76. package/docs/grid-functionalities/Grid-State-&-Preset.md +0 -245
  77. package/docs/grid-functionalities/Header-Menu-&-Header-Buttons.md +0 -125
  78. package/docs/grid-functionalities/Resize-by-Cell-Content.md +0 -138
  79. package/docs/grid-functionalities/Row-Selection.md +0 -247
  80. package/docs/grid-functionalities/Row-based-edit.md +0 -71
  81. package/docs/grid-functionalities/add-update-highlight.md +0 -258
  82. package/docs/grid-functionalities/column-row-spanning.md +0 -74
  83. package/docs/grid-functionalities/dynamic-item-metadata.md +0 -124
  84. package/docs/grid-functionalities/excel-copy-buffer.md +0 -145
  85. package/docs/grid-functionalities/frozen-columns-rows.md +0 -164
  86. package/docs/grid-functionalities/grouping-and-aggregators.md +0 -269
  87. package/docs/grid-functionalities/header-footer-slots.md +0 -22
  88. package/docs/grid-functionalities/infinite-scroll.md +0 -150
  89. package/docs/grid-functionalities/providing-grid-data.md +0 -61
  90. package/docs/grid-functionalities/row-detail.md +0 -530
  91. package/docs/grid-functionalities/tree-data-grid.md +0 -391
  92. package/docs/localization/Localization---Component-Sample.md +0 -87
  93. package/docs/localization/Localization-with-Custom-Locales.md +0 -66
  94. package/docs/localization/Localization-with-ngx-translate.md +0 -148
  95. package/docs/migrations/migration-to-2.x.md +0 -304
  96. package/docs/migrations/migration-to-3.x.md +0 -295
  97. package/docs/migrations/migration-to-4.x.md +0 -83
  98. package/docs/migrations/migration-to-5.x.md +0 -160
  99. package/docs/migrations/migration-to-6.x.md +0 -128
  100. package/docs/migrations/migration-to-7.x.md +0 -294
  101. package/docs/migrations/migration-to-8.x.md +0 -316
  102. package/docs/migrations/migration-to-9.x.md +0 -219
  103. package/docs/slick-grid-dataview-objects/slickgrid-dataview-objects.md +0 -79
  104. package/docs/styling/dark-mode.md +0 -100
  105. package/docs/styling/styling.md +0 -250
  106. package/docs/testing/testing-patterns.md +0 -73
  107. package/eslint.config.mjs +0 -60
  108. package/ng-package.json +0 -10
  109. package/src/assets/angular-logo.png +0 -0
  110. package/src/assets/angular-logo2.png +0 -0
  111. package/src/assets/data/collection_100_numbers.json +0 -12
  112. package/src/assets/data/collection_500_numbers.json +0 -52
  113. package/src/assets/data/countries.json +0 -245
  114. package/src/assets/data/country_names.json +0 -245
  115. package/src/assets/data/customers_100.json +0 -102
  116. package/src/assets/data/users.csv +0 -5
  117. package/src/assets/i18n/en.json +0 -102
  118. package/src/assets/i18n/fr.json +0 -103
  119. package/src/demos/app-routing.module.ts +0 -108
  120. package/src/demos/app.component.html +0 -187
  121. package/src/demos/app.component.scss +0 -79
  122. package/src/demos/app.component.ts +0 -11
  123. package/src/demos/app.module.ts +0 -196
  124. package/src/demos/environments/environment.dev.ts +0 -3
  125. package/src/demos/environments/environment.prod.ts +0 -3
  126. package/src/demos/environments/environment.ts +0 -8
  127. package/src/demos/examples/custom-angularComponentEditor.ts +0 -187
  128. package/src/demos/examples/custom-angularComponentFilter.ts +0 -123
  129. package/src/demos/examples/custom-buttonFormatter.component.ts +0 -13
  130. package/src/demos/examples/custom-inputEditor.ts +0 -132
  131. package/src/demos/examples/custom-inputFilter.ts +0 -134
  132. package/src/demos/examples/custom-titleFormatter.component.ts +0 -9
  133. package/src/demos/examples/data/collection_100_numbers.json +0 -12
  134. package/src/demos/examples/data/collection_500_numbers.json +0 -52
  135. package/src/demos/examples/data/countries.json +0 -245
  136. package/src/demos/examples/data/country_names.json +0 -245
  137. package/src/demos/examples/data/customers_100.json +0 -102
  138. package/src/demos/examples/data/users.csv +0 -5
  139. package/src/demos/examples/editor-ng-select.component.ts +0 -38
  140. package/src/demos/examples/example01.component.html +0 -48
  141. package/src/demos/examples/example01.component.ts +0 -109
  142. package/src/demos/examples/example02.component.html +0 -45
  143. package/src/demos/examples/example02.component.ts +0 -218
  144. package/src/demos/examples/example03.component.html +0 -118
  145. package/src/demos/examples/example03.component.ts +0 -694
  146. package/src/demos/examples/example04.component.html +0 -87
  147. package/src/demos/examples/example04.component.ts +0 -326
  148. package/src/demos/examples/example05.component.html +0 -151
  149. package/src/demos/examples/example05.component.ts +0 -474
  150. package/src/demos/examples/example06.component.html +0 -163
  151. package/src/demos/examples/example06.component.ts +0 -446
  152. package/src/demos/examples/example07.component.html +0 -56
  153. package/src/demos/examples/example07.component.scss +0 -10
  154. package/src/demos/examples/example07.component.ts +0 -216
  155. package/src/demos/examples/example08.component.html +0 -51
  156. package/src/demos/examples/example08.component.scss +0 -23
  157. package/src/demos/examples/example08.component.ts +0 -195
  158. package/src/demos/examples/example09.component.html +0 -55
  159. package/src/demos/examples/example09.component.scss +0 -22
  160. package/src/demos/examples/example09.component.ts +0 -302
  161. package/src/demos/examples/example10.component.html +0 -103
  162. package/src/demos/examples/example10.component.ts +0 -309
  163. package/src/demos/examples/example11.component.html +0 -91
  164. package/src/demos/examples/example11.component.ts +0 -276
  165. package/src/demos/examples/example12.component.html +0 -98
  166. package/src/demos/examples/example12.component.ts +0 -317
  167. package/src/demos/examples/example13.component.html +0 -96
  168. package/src/demos/examples/example13.component.ts +0 -370
  169. package/src/demos/examples/example14.component.html +0 -50
  170. package/src/demos/examples/example14.component.scss +0 -11
  171. package/src/demos/examples/example14.component.ts +0 -156
  172. package/src/demos/examples/example15.component.html +0 -56
  173. package/src/demos/examples/example15.component.ts +0 -304
  174. package/src/demos/examples/example16.component.html +0 -77
  175. package/src/demos/examples/example16.component.ts +0 -277
  176. package/src/demos/examples/example17.component.html +0 -50
  177. package/src/demos/examples/example17.component.ts +0 -109
  178. package/src/demos/examples/example18.component.html +0 -132
  179. package/src/demos/examples/example18.component.ts +0 -445
  180. package/src/demos/examples/example19-rowdetail.component.html +0 -40
  181. package/src/demos/examples/example19-rowdetail.component.ts +0 -54
  182. package/src/demos/examples/example19.component.html +0 -79
  183. package/src/demos/examples/example19.component.ts +0 -316
  184. package/src/demos/examples/example20.component.html +0 -76
  185. package/src/demos/examples/example20.component.scss +0 -11
  186. package/src/demos/examples/example20.component.ts +0 -341
  187. package/src/demos/examples/example21.component.html +0 -86
  188. package/src/demos/examples/example21.component.scss +0 -16
  189. package/src/demos/examples/example21.component.ts +0 -140
  190. package/src/demos/examples/example22.component.html +0 -41
  191. package/src/demos/examples/example22.component.ts +0 -117
  192. package/src/demos/examples/example23.component.html +0 -111
  193. package/src/demos/examples/example23.component.ts +0 -323
  194. package/src/demos/examples/example24.component.html +0 -120
  195. package/src/demos/examples/example24.component.scss +0 -62
  196. package/src/demos/examples/example24.component.ts +0 -641
  197. package/src/demos/examples/example25.component.html +0 -60
  198. package/src/demos/examples/example25.component.scss +0 -8
  199. package/src/demos/examples/example25.component.ts +0 -255
  200. package/src/demos/examples/example26.component.html +0 -98
  201. package/src/demos/examples/example26.component.scss +0 -42
  202. package/src/demos/examples/example26.component.ts +0 -383
  203. package/src/demos/examples/example27.component.html +0 -138
  204. package/src/demos/examples/example27.component.scss +0 -10
  205. package/src/demos/examples/example27.component.ts +0 -369
  206. package/src/demos/examples/example28.component.html +0 -143
  207. package/src/demos/examples/example28.component.scss +0 -54
  208. package/src/demos/examples/example28.component.ts +0 -453
  209. package/src/demos/examples/example29.component.html +0 -30
  210. package/src/demos/examples/example29.component.ts +0 -70
  211. package/src/demos/examples/example30.component.html +0 -116
  212. package/src/demos/examples/example30.component.scss +0 -20
  213. package/src/demos/examples/example30.component.ts +0 -1070
  214. package/src/demos/examples/example32.component.html +0 -77
  215. package/src/demos/examples/example32.component.scss +0 -8
  216. package/src/demos/examples/example32.component.ts +0 -905
  217. package/src/demos/examples/example33.component.html +0 -50
  218. package/src/demos/examples/example33.component.scss +0 -46
  219. package/src/demos/examples/example33.component.ts +0 -571
  220. package/src/demos/examples/example34.component.html +0 -82
  221. package/src/demos/examples/example34.component.scss +0 -77
  222. package/src/demos/examples/example34.component.ts +0 -434
  223. package/src/demos/examples/example35.component.html +0 -77
  224. package/src/demos/examples/example35.component.scss +0 -18
  225. package/src/demos/examples/example35.component.ts +0 -264
  226. package/src/demos/examples/example36.component.html +0 -56
  227. package/src/demos/examples/example36.component.scss +0 -26
  228. package/src/demos/examples/example36.component.ts +0 -504
  229. package/src/demos/examples/example37.component.html +0 -30
  230. package/src/demos/examples/example37.component.ts +0 -123
  231. package/src/demos/examples/example38.component.html +0 -104
  232. package/src/demos/examples/example38.component.scss +0 -8
  233. package/src/demos/examples/example38.component.ts +0 -420
  234. package/src/demos/examples/example39.component.html +0 -112
  235. package/src/demos/examples/example39.component.scss +0 -8
  236. package/src/demos/examples/example39.component.ts +0 -371
  237. package/src/demos/examples/example40.component.html +0 -76
  238. package/src/demos/examples/example40.component.ts +0 -226
  239. package/src/demos/examples/example41.component.html +0 -50
  240. package/src/demos/examples/example41.component.scss +0 -42
  241. package/src/demos/examples/example41.component.ts +0 -229
  242. package/src/demos/examples/example42.component.html +0 -47
  243. package/src/demos/examples/example42.component.ts +0 -203
  244. package/src/demos/examples/example43.component.html +0 -94
  245. package/src/demos/examples/example43.component.scss +0 -30
  246. package/src/demos/examples/example43.component.ts +0 -449
  247. package/src/demos/examples/example44.component.html +0 -78
  248. package/src/demos/examples/example44.component.scss +0 -50
  249. package/src/demos/examples/example44.component.ts +0 -375
  250. package/src/demos/examples/example45-detail.component.html +0 -15
  251. package/src/demos/examples/example45-detail.component.ts +0 -97
  252. package/src/demos/examples/example45.component.html +0 -110
  253. package/src/demos/examples/example45.component.scss +0 -50
  254. package/src/demos/examples/example45.component.ts +0 -243
  255. package/src/demos/examples/filter-ng-select.component.ts +0 -33
  256. package/src/demos/examples/grid-custom-pager.component.html +0 -60
  257. package/src/demos/examples/grid-custom-pager.component.scss +0 -57
  258. package/src/demos/examples/grid-custom-pager.component.ts +0 -107
  259. package/src/demos/examples/grid-remote.component.html +0 -44
  260. package/src/demos/examples/grid-remote.component.ts +0 -164
  261. package/src/demos/examples/home.component.html +0 -39
  262. package/src/demos/examples/home.component.ts +0 -10
  263. package/src/demos/examples/jsonp.ts +0 -89
  264. package/src/demos/examples/rowdetail-preload.component.ts +0 -10
  265. package/src/demos/examples/swt-common-grid-pagination.component.ts +0 -160
  266. package/src/demos/examples/swt-common-grid-test.component.html +0 -37
  267. package/src/demos/examples/swt-common-grid-test.component.ts +0 -214
  268. package/src/demos/examples/swt-common-grid.component.ts +0 -436
  269. package/src/demos/examples/swt-logger.service.ts +0 -173
  270. package/src/demos/examples/utilities.ts +0 -9
  271. package/src/favicon.ico +0 -0
  272. package/src/index.html +0 -17
  273. package/src/library/components/__tests__/angular-slickgrid.component.spec.ts +0 -2638
  274. package/src/library/components/angular-slickgrid.component.html +0 -5
  275. package/src/library/components/angular-slickgrid.component.ts +0 -1662
  276. package/src/library/constants.ts +0 -105
  277. package/src/library/extensions/__tests__/slickRowDetailView.spec.ts +0 -751
  278. package/src/library/extensions/index.ts +0 -1
  279. package/src/library/extensions/slickRowDetailView.ts +0 -395
  280. package/src/library/global-grid-options.ts +0 -273
  281. package/src/library/index.ts +0 -11
  282. package/src/library/models/angularComponentOutput.interface.ts +0 -6
  283. package/src/library/models/angularGridInstance.interface.ts +0 -76
  284. package/src/library/models/externalTestingDependencies.interface.ts +0 -37
  285. package/src/library/models/gridOption.interface.ts +0 -15
  286. package/src/library/models/index.ts +0 -5
  287. package/src/library/models/rowDetailView.interface.ts +0 -16
  288. package/src/library/modules/angular-slickgrid.module.spec.ts +0 -25
  289. package/src/library/modules/angular-slickgrid.module.ts +0 -27
  290. package/src/library/services/__tests__/angularUtilService.spec.ts +0 -156
  291. package/src/library/services/__tests__/container.service.spec.ts +0 -25
  292. package/src/library/services/__tests__/translater.service.spec.ts +0 -43
  293. package/src/library/services/__tests__/utilities.spec.ts +0 -22
  294. package/src/library/services/angularUtil.service.ts +0 -120
  295. package/src/library/services/container.service.ts +0 -26
  296. package/src/library/services/index.ts +0 -4
  297. package/src/library/services/translater.service.ts +0 -38
  298. package/src/library/services/utilities.ts +0 -19
  299. package/src/library/slickgrid-config.ts +0 -10
  300. package/src/main.ts +0 -13
  301. package/src/public_api.ts +0 -1
  302. package/src/styles.scss +0 -178
  303. package/test/cypress/e2e/example01.cy.ts +0 -367
  304. package/test/cypress/e2e/example02.cy.ts +0 -60
  305. package/test/cypress/e2e/example03.cy.ts +0 -268
  306. package/test/cypress/e2e/example04.cy.ts +0 -254
  307. package/test/cypress/e2e/example05.cy.ts +0 -804
  308. package/test/cypress/e2e/example06.cy.ts +0 -890
  309. package/test/cypress/e2e/example07.cy.ts +0 -384
  310. package/test/cypress/e2e/example08.cy.ts +0 -190
  311. package/test/cypress/e2e/example09.cy.ts +0 -392
  312. package/test/cypress/e2e/example10.cy.ts +0 -650
  313. package/test/cypress/e2e/example11.cy.ts +0 -86
  314. package/test/cypress/e2e/example12.cy.ts +0 -269
  315. package/test/cypress/e2e/example13.cy.ts +0 -246
  316. package/test/cypress/e2e/example14.cy.ts +0 -122
  317. package/test/cypress/e2e/example15.cy.ts +0 -598
  318. package/test/cypress/e2e/example16.cy.ts +0 -427
  319. package/test/cypress/e2e/example17.cy.ts +0 -83
  320. package/test/cypress/e2e/example18.cy.ts +0 -431
  321. package/test/cypress/e2e/example19.cy.ts +0 -263
  322. package/test/cypress/e2e/example20.cy.ts +0 -264
  323. package/test/cypress/e2e/example21.cy.ts +0 -77
  324. package/test/cypress/e2e/example22.cy.ts +0 -94
  325. package/test/cypress/e2e/example23.cy.ts +0 -259
  326. package/test/cypress/e2e/example24.cy.ts +0 -707
  327. package/test/cypress/e2e/example25.cy.ts +0 -193
  328. package/test/cypress/e2e/example26.cy.ts +0 -111
  329. package/test/cypress/e2e/example27.cy.ts +0 -261
  330. package/test/cypress/e2e/example28.cy.ts +0 -740
  331. package/test/cypress/e2e/example29.cy.ts +0 -30
  332. package/test/cypress/e2e/example30.cy.ts +0 -757
  333. package/test/cypress/e2e/example31.cy.ts +0 -69
  334. package/test/cypress/e2e/example32.cy.ts +0 -272
  335. package/test/cypress/e2e/example33.cy.ts +0 -278
  336. package/test/cypress/e2e/example34.cy.ts +0 -84
  337. package/test/cypress/e2e/example35.cy.ts +0 -178
  338. package/test/cypress/e2e/example36.cy.ts +0 -219
  339. package/test/cypress/e2e/example37.cy.ts +0 -52
  340. package/test/cypress/e2e/example38.cy.ts +0 -160
  341. package/test/cypress/e2e/example39.cy.ts +0 -150
  342. package/test/cypress/e2e/example40.cy.ts +0 -126
  343. package/test/cypress/e2e/example41.cy.ts +0 -90
  344. package/test/cypress/e2e/example42.cy.ts +0 -82
  345. package/test/cypress/e2e/example43.cy.ts +0 -482
  346. package/test/cypress/e2e/example44.cy.ts +0 -458
  347. package/test/cypress/e2e/example45.cy.ts +0 -455
  348. package/test/cypress/e2e/home.cy.ts +0 -7
  349. package/test/cypress/fixtures/example.json +0 -5
  350. package/test/cypress/plugins/index.ts +0 -17
  351. package/test/cypress/plugins/utilities.ts +0 -28
  352. package/test/cypress/support/commands.ts +0 -88
  353. package/test/cypress/support/common.ts +0 -47
  354. package/test/cypress/support/drag.ts +0 -101
  355. package/test/cypress/support/index.ts +0 -20
  356. package/test/cypress/tsconfig.json +0 -9
  357. package/test/cypress.config.ts +0 -34
  358. package/test/mockSlickEvent.ts +0 -77
  359. package/test/rxjsResourceStub.ts +0 -69
  360. package/test/test-setup.ts +0 -6
  361. package/test/translateServiceStub.ts +0 -230
  362. package/test/translaterServiceStub.ts +0 -239
  363. package/test/tsconfig.json +0 -17
  364. package/test/vitest-global-mocks.ts +0 -41
  365. package/test/vitest-global-setup.ts +0 -3
  366. package/test/vitest-pretest.ts +0 -5
  367. package/tsconfig.app.json +0 -14
  368. package/tsconfig.json +0 -31
  369. package/tsconfig.spec.json +0 -11
  370. package/types/sortablejs.d.ts +0 -4
  371. package/vite.config.mts +0 -51
  372. /package/{dist/fesm2022 → fesm2022}/angular-slickgrid.mjs.map +0 -0
  373. /package/{dist/i18n → i18n}/en.json +0 -0
  374. /package/{dist/i18n → i18n}/fr.json +0 -0
  375. /package/{dist/index.d.ts → index.d.ts} +0 -0
  376. /package/{dist/library → library}/components/angular-slickgrid.component.d.ts +0 -0
  377. /package/{dist/library → library}/constants.d.ts +0 -0
  378. /package/{dist/library → library}/extensions/index.d.ts +0 -0
  379. /package/{dist/library → library}/extensions/slickRowDetailView.d.ts +0 -0
  380. /package/{dist/library → library}/global-grid-options.d.ts +0 -0
  381. /package/{dist/library → library}/index.d.ts +0 -0
  382. /package/{dist/library → library}/models/angularComponentOutput.interface.d.ts +0 -0
  383. /package/{dist/library → library}/models/angularGridInstance.interface.d.ts +0 -0
  384. /package/{dist/library → library}/models/externalTestingDependencies.interface.d.ts +0 -0
  385. /package/{dist/library → library}/models/gridOption.interface.d.ts +0 -0
  386. /package/{dist/library → library}/models/index.d.ts +0 -0
  387. /package/{dist/library → library}/models/rowDetailView.interface.d.ts +0 -0
  388. /package/{dist/library → library}/modules/angular-slickgrid.module.d.ts +0 -0
  389. /package/{dist/library → library}/services/angularUtil.service.d.ts +0 -0
  390. /package/{dist/library → library}/services/container.service.d.ts +0 -0
  391. /package/{dist/library → library}/services/index.d.ts +0 -0
  392. /package/{dist/library → library}/services/translater.service.d.ts +0 -0
  393. /package/{dist/library → library}/services/utilities.d.ts +0 -0
  394. /package/{dist/library → library}/slickgrid-config.d.ts +0 -0
  395. /package/{dist/public_api.d.ts → public_api.d.ts} +0 -0
@@ -1,905 +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 {
6
- type AngularGridInstance,
7
- type Column,
8
- type GridOption,
9
- Filters,
10
- type Formatter,
11
- type LongTextEditorOption,
12
- Editors,
13
- Formatters,
14
- type AutocompleterOption,
15
- type EditCommand,
16
- formatNumber,
17
- SortComparers,
18
- type SlickGrid,
19
- SlickGlobalEditorLock,
20
- type VanillaCalendarOption,
21
- type SearchTerm,
22
- } from '../../library';
23
-
24
- const URL_COUNTRIES_COLLECTION = 'assets/data/countries.json';
25
-
26
- /**
27
- * Check if the current item (cell) is editable or not
28
- * @param {*} dataContext - item data context object
29
- * @param {*} columnDef - column definition
30
- * @param {*} grid - slickgrid grid object
31
- * @returns {boolean} isEditable
32
- */
33
- function checkItemIsEditable(dataContext: any, columnDef: Column, grid: SlickGrid) {
34
- const gridOptions = grid && grid.getOptions && grid.getOptions();
35
- const hasEditor = columnDef.editor;
36
- const isGridEditable = gridOptions.editable;
37
- let isEditable = !!(isGridEditable && hasEditor);
38
-
39
- if (dataContext && columnDef && gridOptions && gridOptions.editable) {
40
- switch (columnDef.id) {
41
- case 'finish':
42
- isEditable = !!dataContext?.completed;
43
- break;
44
- }
45
- }
46
- return isEditable;
47
- }
48
-
49
- const customEditableInputFormatter: Formatter = (_row, _cell, value, columnDef, _dataContext, grid) => {
50
- const gridOptions = grid && grid.getOptions && grid.getOptions();
51
- const isEditableLine = gridOptions.editable && columnDef.editor;
52
- value = value === null || value === undefined ? '' : value;
53
- return isEditableLine ? { text: value, addClasses: 'editable-field', toolTip: 'Click to Edit' } : value;
54
- };
55
-
56
- // you can create custom validator to pass to an inline editor
57
- const myCustomTitleValidator = (value: any) => {
58
- if (value === null || value === undefined || !value.length) {
59
- // we will only check if the field is supplied when it's an inline editing
60
- return { valid: false, msg: 'This is a required field.' };
61
- } else if (!/^(task\s\d+)*$/i.test(value)) {
62
- return { valid: false, msg: 'Your title is invalid, it must start with "Task" followed by a number.' };
63
- }
64
- return { valid: true, msg: '' };
65
- };
66
-
67
- @Component({
68
- templateUrl: './example32.component.html',
69
- styleUrls: ['./example32.component.scss'],
70
- encapsulation: ViewEncapsulation.None,
71
- standalone: false,
72
- })
73
- export class Example32Component implements OnInit {
74
- angularGrid!: AngularGridInstance;
75
- gridOptions!: GridOption;
76
- columnDefinitions: Column[] = [];
77
- dataset: any[] = [];
78
- editQueue: any[] = [];
79
- editedItems: any = {};
80
- isUsingDefaultResize = false;
81
- isGridEditable = true;
82
- isMassSelectionDisabled = true;
83
- complexityLevelList = [
84
- { value: 0, label: 'Very Simple' },
85
- { value: 1, label: 'Simple' },
86
- { value: 2, label: 'Straightforward' },
87
- { value: 3, label: 'Complex' },
88
- { value: 4, label: 'Very Complex' },
89
- ];
90
-
91
- constructor(private http: HttpClient) {}
92
-
93
- angularGridReady(angularGrid: AngularGridInstance) {
94
- this.angularGrid = angularGrid;
95
- }
96
-
97
- ngOnInit(): void {
98
- this.defineGrid();
99
- this.dataset = this.loadData(400);
100
- }
101
-
102
- // Grid2 definition
103
- defineGrid() {
104
- this.columnDefinitions = [
105
- {
106
- id: 'title',
107
- name: 'Title',
108
- field: 'title',
109
- sortable: true,
110
- minWidth: 65,
111
- // you can adjust the resize calculation via multiple options
112
- resizeExtraWidthPadding: 4,
113
- resizeCharWidthInPx: 7.6,
114
- resizeCalcWidthRatio: 1,
115
- resizeMaxWidthThreshold: 200,
116
- columnGroup: 'Common Factor',
117
- cssClass: 'text-uppercase fw-bold',
118
- filterable: true,
119
- filter: {
120
- model: Filters.inputText,
121
- // you can use your own custom filter predicate when built-in filters aren't working for you
122
- // for example the example below will function similarly to an SQL LIKE to answer this SO: https://stackoverflow.com/questions/78471412/angular-slickgrid-filter
123
- filterPredicate: (dataContext, searchFilterArgs) => {
124
- const searchVals = (searchFilterArgs.parsedSearchTerms || []) as SearchTerm[];
125
- if (searchVals?.length) {
126
- const columnId = searchFilterArgs.columnId;
127
- const searchVal = searchVals[0] as string;
128
- const cellValue = dataContext[columnId].toLowerCase();
129
- const results = searchVal.matchAll(/^%([^%\r\n]+)[^%\r\n]*$|(.*)%(.+)%(.*)|(.+)%(.+)|([^%\r\n]+)%$/gi);
130
- const arrayOfMatches = Array.from(results);
131
- const matches = arrayOfMatches.length ? arrayOfMatches[0] : [];
132
- const [_, endW, containSW, contain, containEndW, comboSW, comboEW, startW] = matches;
133
-
134
- if (endW) {
135
- // example: "%001" ends with A
136
- return cellValue.endsWith(endW.toLowerCase());
137
- } else if (containSW && contain) {
138
- // example: "%Ti%001", contains A + ends with B
139
- return cellValue.startsWith(containSW.toLowerCase()) && cellValue.includes(contain.toLowerCase());
140
- } else if (contain && containEndW) {
141
- // example: "%Ti%001", contains A + ends with B
142
- return cellValue.includes(contain) && cellValue.endsWith(containEndW.toLowerCase());
143
- } else if (contain && !containEndW) {
144
- // example: "%Ti%", contains A anywhere
145
- return cellValue.includes(contain.toLowerCase());
146
- } else if (comboSW && comboEW) {
147
- // example: "Ti%001", combo starts with A + ends with B
148
- return cellValue.startsWith(comboSW.toLowerCase()) && cellValue.endsWith(comboEW.toLowerCase());
149
- } else if (startW) {
150
- // example: "Ti%", starts with A
151
- return cellValue.startsWith(startW.toLowerCase());
152
- }
153
- // anything else
154
- return cellValue.includes(searchVal.toLowerCase());
155
- }
156
-
157
- // if we fall here then the value is not filtered out
158
- return true;
159
- },
160
- },
161
- editor: {
162
- model: Editors.longText,
163
- required: true,
164
- alwaysSaveOnEnterKey: true,
165
- maxLength: 12,
166
- options: {
167
- cols: 45,
168
- rows: 6,
169
- buttonTexts: {
170
- cancel: 'Close',
171
- save: 'Done',
172
- },
173
- } as LongTextEditorOption,
174
- validator: myCustomTitleValidator,
175
- },
176
- },
177
- {
178
- id: 'duration',
179
- name: 'Duration',
180
- field: 'duration',
181
- sortable: true,
182
- filterable: true,
183
- minWidth: 65,
184
- type: 'number',
185
- columnGroup: 'Common Factor',
186
- formatter: (_row, _cell, value) => {
187
- if (value === null || value === undefined || value === '') {
188
- return '';
189
- }
190
- return value > 1 ? `${value} days` : `${value} day`;
191
- },
192
- editor: {
193
- model: Editors.float,
194
- decimal: 2,
195
- valueStep: 1,
196
- minValue: 0,
197
- maxValue: 10000,
198
- alwaysSaveOnEnterKey: true,
199
- required: true,
200
- },
201
- },
202
- {
203
- id: 'cost',
204
- name: 'Cost',
205
- field: 'cost',
206
- minWidth: 65,
207
- sortable: true,
208
- filterable: true,
209
- type: 'number',
210
- columnGroup: 'Analysis',
211
- filter: { model: Filters.compoundInputNumber },
212
- formatter: Formatters.dollar,
213
- },
214
- {
215
- id: 'percentComplete',
216
- name: '% Complete',
217
- field: 'percentComplete',
218
- minWidth: 100,
219
- type: 'number',
220
- sortable: true,
221
- filterable: true,
222
- columnGroup: 'Analysis',
223
- filter: { model: Filters.compoundSlider, operator: '>=' },
224
- editor: {
225
- model: Editors.slider,
226
- minValue: 0,
227
- maxValue: 100,
228
- },
229
- },
230
- {
231
- id: 'complexity',
232
- name: 'Complexity',
233
- field: 'complexity',
234
- resizeCalcWidthRatio: 0.82, // default calc ratio is 1 or 0.95 for field type of string
235
- sortable: true,
236
- filterable: true,
237
- columnGroup: 'Analysis',
238
- formatter: (_row, _cell, value) => this.complexityLevelList[value]?.label,
239
- exportCustomFormatter: (_row, _cell, value) => this.complexityLevelList[value]?.label,
240
- filter: {
241
- model: Filters.multipleSelect,
242
- collection: this.complexityLevelList,
243
- },
244
- editor: {
245
- model: Editors.singleSelect,
246
- collection: this.complexityLevelList,
247
- },
248
- },
249
- {
250
- id: 'start',
251
- name: 'Start',
252
- field: 'start',
253
- sortable: true,
254
- formatter: Formatters.dateUs,
255
- columnGroup: 'Period',
256
- exportCustomFormatter: Formatters.dateUs,
257
- type: 'date',
258
- outputType: 'dateUs',
259
- saveOutputType: 'dateUtc',
260
- filterable: true,
261
- filter: { model: Filters.compoundDate },
262
- editor: { model: Editors.date, params: { hideClearButton: false } },
263
- },
264
- {
265
- id: 'completed',
266
- name: 'Completed',
267
- field: 'completed',
268
- width: 80,
269
- minWidth: 75,
270
- maxWidth: 100,
271
- cssClass: 'text-center',
272
- columnGroup: 'Period',
273
- formatter: Formatters.checkmarkMaterial,
274
- exportWithFormatter: false,
275
- filterable: true,
276
- sortable: true,
277
- filter: {
278
- collection: [
279
- { value: '', label: '' },
280
- { value: true, label: 'True' },
281
- { value: false, label: 'False' },
282
- ],
283
- model: Filters.singleSelect,
284
- },
285
- editor: { model: Editors.checkbox },
286
- // editor: { model: Editors.singleSelect, collection: [{ value: true, label: 'Yes' }, { value: false, label: 'No' }], },
287
- },
288
- {
289
- id: 'finish',
290
- name: 'Finish',
291
- field: 'finish',
292
- sortable: true,
293
- formatter: Formatters.dateUs,
294
- columnGroup: 'Period',
295
- type: 'date',
296
- outputType: 'dateUs',
297
- saveOutputType: 'dateUtc',
298
- filterable: true,
299
- filter: { model: Filters.compoundDate },
300
- exportCustomFormatter: Formatters.dateUs,
301
- editor: {
302
- model: Editors.date,
303
- options: { displayDateMin: 'today' } as VanillaCalendarOption,
304
- validator: (value, args) => {
305
- const dataContext = args && args.item;
306
- if (dataContext && dataContext.completed && !value) {
307
- return { valid: false, msg: 'You must provide a "Finish" date when "Completed" is checked.' };
308
- }
309
- return { valid: true, msg: '' };
310
- },
311
- },
312
- },
313
- {
314
- id: 'product',
315
- name: 'Product',
316
- field: 'product',
317
- filterable: true,
318
- columnGroup: 'Item',
319
- minWidth: 100,
320
- resizeCharWidthInPx: 8,
321
- exportWithFormatter: true,
322
- dataKey: 'id',
323
- labelKey: 'itemName',
324
- formatter: Formatters.complexObject,
325
- exportCustomFormatter: Formatters.complex, // without the Editing cell Formatter
326
- type: 'object',
327
- sortComparer: SortComparers.objectString,
328
- editor: {
329
- model: Editors.autocompleter,
330
- alwaysSaveOnEnterKey: true,
331
-
332
- // example with a Remote API call
333
- options: {
334
- minLength: 1,
335
- fetch: (searchTerm: string, callback: (items: false | any[]) => void) => {
336
- // const items = require('c://TEMP/items.json');
337
- const products = this.mockProducts();
338
- callback(products.filter((product) => product.itemName.toLowerCase().includes(searchTerm.toLowerCase())));
339
- },
340
- renderItem: {
341
- // layout: 'twoRows',
342
- // templateCallback: (item: any) => this.renderItemCallbackWith2Rows(item),
343
-
344
- layout: 'fourCorners',
345
- templateCallback: (item: any) => this.renderItemCallbackWith4Corners(item),
346
- },
347
- } as AutocompleterOption,
348
- },
349
- filter: {
350
- model: Filters.inputText,
351
- // placeholder: '🔎︎ search product',
352
- queryField: 'product.itemName',
353
- },
354
- },
355
- {
356
- id: 'origin',
357
- name: 'Country of Origin',
358
- field: 'origin',
359
- formatter: Formatters.complexObject,
360
- columnGroup: 'Item',
361
- exportCustomFormatter: Formatters.complex, // without the Editing cell Formatter
362
- dataKey: 'code',
363
- labelKey: 'name',
364
- type: 'object',
365
- sortComparer: SortComparers.objectString,
366
- filterable: true,
367
- sortable: true,
368
- minWidth: 100,
369
- editor: {
370
- model: Editors.autocompleter,
371
- customStructure: { label: 'name', value: 'code' },
372
- collectionAsync: this.http.get(URL_COUNTRIES_COLLECTION),
373
- },
374
- filter: {
375
- model: Filters.inputText,
376
- queryField: 'origin.name',
377
- },
378
- },
379
- {
380
- id: 'action',
381
- name: 'Action',
382
- field: 'action',
383
- width: 70,
384
- minWidth: 70,
385
- maxWidth: 70,
386
- excludeFromExport: true,
387
- formatter: () =>
388
- `<div class="button-style margin-auto" style="width: 35px;"><span class="mdi mdi-chevron-down text-primary"></span></div>`,
389
- cellMenu: {
390
- hideCloseButton: false,
391
- commandTitle: 'Commands',
392
- commandItems: [
393
- {
394
- command: 'help',
395
- title: 'Help!',
396
- iconCssClass: 'mdi mdi-help-circle',
397
- positionOrder: 66,
398
- action: () => alert('Please Help!'),
399
- },
400
- 'divider',
401
- {
402
- command: 'delete-row',
403
- title: 'Delete Row',
404
- positionOrder: 64,
405
- iconCssClass: 'mdi mdi-close color-danger',
406
- cssClass: 'red',
407
- textCssClass: 'text-italic color-danger-light',
408
- // only show command to 'Delete Row' when the task is not completed
409
- itemVisibilityOverride: (args) => {
410
- return !args.dataContext?.completed;
411
- },
412
- action: (_event, args) => {
413
- const dataContext = args.dataContext;
414
- const row = args?.row ?? 0;
415
- if (confirm(`Do you really want to delete row (${row + 1}) with "${dataContext.title}"`)) {
416
- this.angularGrid.gridService.deleteItemById(dataContext.id);
417
- }
418
- },
419
- },
420
- ],
421
- },
422
- },
423
- ];
424
-
425
- this.gridOptions = {
426
- editable: true,
427
- autoAddCustomEditorFormatter: customEditableInputFormatter,
428
- enableCellNavigation: true,
429
- autoEdit: true,
430
- autoCommitEdit: true,
431
- autoResize: {
432
- container: '#smaller-container',
433
- rightPadding: 10,
434
- },
435
- enableAutoResize: true,
436
- enablePagination: true,
437
- pagination: {
438
- pageSize: 10,
439
- pageSizes: [10, 200, 500, 5000],
440
- },
441
-
442
- // resizing by cell content is opt-in
443
- // we first need to disable the 2 default flags to autoFit/autosize
444
- autoFitColumnsOnFirstLoad: false,
445
- enableAutoSizeColumns: false,
446
- // then enable resize by content with these 2 flags
447
- autosizeColumnsByCellContentOnFirstLoad: true,
448
- enableAutoResizeColumnsByCellContent: true,
449
-
450
- resizeByContentOptions: {
451
- // optional resize calculation options
452
- defaultRatioForStringType: 0.92,
453
- formatterPaddingWidthInPx: 8, // optional editor formatter padding for resize calculation
454
- },
455
-
456
- enableExcelExport: true,
457
- excelExportOptions: {
458
- exportWithFormatter: false,
459
- },
460
- externalResources: [new ExcelExportService()],
461
- enableFiltering: true,
462
- enableRowSelection: true,
463
- enableCheckboxSelector: true,
464
- checkboxSelector: {
465
- hideInFilterHeaderRow: false,
466
- hideInColumnTitleRow: true,
467
- },
468
- rowSelectionOptions: {
469
- // True (Single Selection), False (Multiple Selections)
470
- selectActiveRow: false,
471
- },
472
- createPreHeaderPanel: true,
473
- showPreHeaderPanel: true,
474
- preHeaderPanelHeight: 28,
475
- rowHeight: 33,
476
- headerRowHeight: 35,
477
- editCommandHandler: (item, column, editCommand) => {
478
- const prevSerializedValues = Array.isArray(editCommand.prevSerializedValue)
479
- ? editCommand.prevSerializedValue
480
- : [editCommand.prevSerializedValue];
481
- const serializedValues = Array.isArray(editCommand.serializedValue) ? editCommand.serializedValue : [editCommand.serializedValue];
482
- const editorColumns = this.columnDefinitions.filter((col) => col.editor !== undefined);
483
-
484
- const modifiedColumns: Column[] = [];
485
- prevSerializedValues.forEach((_val, index) => {
486
- const prevSerializedValue = prevSerializedValues[index];
487
- const serializedValue = serializedValues[index];
488
-
489
- if (prevSerializedValue !== serializedValue) {
490
- const finalColumn = Array.isArray(editCommand.prevSerializedValue) ? editorColumns[index] : column;
491
- 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
492
- this.angularGrid.slickGrid.invalidate();
493
- editCommand.execute();
494
-
495
- this.renderUnsavedCellStyling(item, finalColumn, editCommand);
496
- modifiedColumns.push(finalColumn);
497
- }
498
- });
499
-
500
- // queued editor, so we'll push only 1 change at the end but with all columns modified
501
- // 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)
502
- this.editQueue.push({ item, columns: modifiedColumns, editCommand });
503
- },
504
- // when using the cellMenu, you can change some of the default options and all use some of the callback methods
505
- enableCellMenu: true,
506
- };
507
- }
508
-
509
- loadData(count: number) {
510
- // mock data
511
- const tmpArray: any[] = [];
512
- for (let i = 0; i < count; i++) {
513
- const randomItemId = Math.floor(Math.random() * this.mockProducts().length);
514
- const randomYear = 2000 + Math.floor(Math.random() * 10);
515
- const randomFinishYear = new Date().getFullYear() + Math.floor(Math.random() * 10); // use only years not lower than 3 years ago
516
- const randomMonth = Math.floor(Math.random() * 11);
517
- const randomDay = Math.floor(Math.random() * 29);
518
- const randomTime = Math.floor(Math.random() * 59);
519
- const randomFinish = new Date(randomFinishYear, randomMonth + 1, randomDay, randomTime, randomTime, randomTime);
520
- const randomPercentComplete = Math.floor(Math.random() * 100) + 15; // make it over 15 for E2E testing purposes
521
- const percentCompletion = randomPercentComplete > 100 ? (i > 5 ? 100 : 88) : randomPercentComplete; // don't use 100 unless it's over index 5, for E2E testing purposes
522
- const isCompleted = percentCompletion === 100;
523
-
524
- tmpArray[i] = {
525
- id: i,
526
- title: 'Task ' + i,
527
- duration: Math.floor(Math.random() * 100) + 10,
528
- percentComplete: percentCompletion,
529
- analysis: {
530
- percentComplete: percentCompletion,
531
- },
532
- complexity: i % 3 ? 0 : 2,
533
- start: new Date(randomYear, randomMonth, randomDay, randomDay, randomTime, randomTime, randomTime),
534
- 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
535
- cost: i % 33 === 0 ? null : Math.round(Math.random() * 10000) / 100,
536
- completed: isCompleted || (i % 3 === 0 && randomFinish > new Date() && i > 3),
537
- product: { id: this.mockProducts()[randomItemId]?.id, itemName: this.mockProducts()[randomItemId]?.itemName },
538
- origin: i % 2 ? { code: 'CA', name: 'Canada' } : { code: 'US', name: 'United States' },
539
- };
540
-
541
- if (!(i % 8)) {
542
- delete tmpArray[i].finish; // also test with undefined properties
543
- delete tmpArray[i].percentComplete; // also test with undefined properties
544
- }
545
- }
546
- return tmpArray;
547
- }
548
-
549
- handleValidationError(_e: Event, args: any) {
550
- if (args.validationResults) {
551
- alert(args.validationResults.msg);
552
- }
553
- return false;
554
- }
555
-
556
- handleItemDeleted(_e: Event, args: any) {
557
- console.log('item deleted with id:', args.itemId);
558
- }
559
-
560
- handleOnBeforeEditCell(e: Event, args: any) {
561
- const { column, item, grid } = args;
562
-
563
- if (column && item) {
564
- if (!checkItemIsEditable(item, column, grid)) {
565
- e.preventDefault(); // OR eventData.preventDefault();
566
- return false;
567
- }
568
- }
569
- return false;
570
- }
571
-
572
- handleOnCellChange(_e: Event, args: any) {
573
- const dataContext = args?.item;
574
-
575
- // when the field "completed" changes to false, we also need to blank out the "finish" date
576
- if (dataContext && !dataContext.completed) {
577
- dataContext.finish = null;
578
- this.angularGrid.gridService.updateItem(dataContext);
579
- }
580
- }
581
-
582
- handlePaginationChanged() {
583
- this.removeAllUnsavedStylingFromCell();
584
- this.renderUnsavedStylingOnAllVisibleCells();
585
- }
586
-
587
- handleDefaultResizeColumns() {
588
- // just for demo purposes, set it back to its original width
589
- const columns = this.angularGrid.slickGrid.getColumns() as Column[];
590
- columns.forEach((col) => (col.width = col.originalWidth));
591
- this.angularGrid.slickGrid.setColumns(columns);
592
- this.angularGrid.slickGrid.autosizeColumns();
593
- this.isUsingDefaultResize = true;
594
- }
595
-
596
- handleNewResizeColumns() {
597
- this.angularGrid.resizerService.resizeColumnsByCellContent(true);
598
- this.isUsingDefaultResize = false;
599
- }
600
-
601
- handleOnSelectedRowIdsChanged(args: any) {
602
- console.log('Selected Ids:', args.selectedRowIds);
603
- }
604
-
605
- toggleGridEditReadonly() {
606
- // first need undo all edits
607
- this.undoAllEdits();
608
-
609
- // then change a single grid options to make the grid non-editable (readonly)
610
- this.isGridEditable = !this.isGridEditable;
611
- if (!this.isGridEditable) {
612
- this.isMassSelectionDisabled = true;
613
- }
614
- // dynamically change SlickGrid editable grid option
615
- this.angularGrid.slickGrid.setOptions({ editable: this.isGridEditable });
616
- }
617
-
618
- removeUnsavedStylingFromCell(_item: any, column: Column, row: number) {
619
- // remove unsaved css class from that cell
620
- this.angularGrid.slickGrid.removeCellCssStyles(`unsaved_highlight_${[column.id]}${row}`);
621
- }
622
-
623
- removeAllUnsavedStylingFromCell() {
624
- for (const lastEdit of this.editQueue) {
625
- const lastEditCommand = lastEdit?.editCommand;
626
- if (lastEditCommand) {
627
- // remove unsaved css class from that cell
628
- for (const lastEditColumn of lastEdit.columns) {
629
- this.removeUnsavedStylingFromCell(lastEdit.item, lastEditColumn, lastEditCommand.row);
630
- }
631
- }
632
- }
633
- }
634
-
635
- renderUnsavedStylingOnAllVisibleCells() {
636
- for (const lastEdit of this.editQueue) {
637
- if (lastEdit) {
638
- const { item, columns, editCommand } = lastEdit;
639
- if (Array.isArray(columns)) {
640
- columns.forEach((col) => {
641
- this.renderUnsavedCellStyling(item, col, editCommand);
642
- });
643
- }
644
- }
645
- }
646
- }
647
-
648
- renderUnsavedCellStyling(item: any, column: Column, editCommand: EditCommand) {
649
- if (editCommand && item && column) {
650
- const row = this.angularGrid.dataView.getRowByItem(item) as number;
651
- if (row >= 0) {
652
- const hash = { [row]: { [column.id]: 'unsaved-editable-field' } };
653
- this.angularGrid.slickGrid.setCellCssStyles(`unsaved_highlight_${[column.id]}${row}`, hash);
654
- }
655
- }
656
- }
657
-
658
- // change row selection dynamically and apply it to the DataView and the Grid UI
659
- setSelectedRowIds() {
660
- // change row selection even across multiple pages via DataView
661
- this.angularGrid.dataView?.setSelectedIds([3, 4, 11]);
662
-
663
- // you can also provide optional options (all defaults to true)
664
- // this.sgb.dataView?.setSelectedIds([4, 5, 8, 10], {
665
- // isRowBeingAdded: true,
666
- // shouldTriggerEvent: true,
667
- // applyGridRowSelection: true
668
- // });
669
- }
670
-
671
- saveAll() {
672
- // Edit Queue (array increases every time a cell is changed, regardless of item object)
673
- console.log(this.editQueue);
674
-
675
- // Edit Items only keeps the merged data (an object with row index as the row properties)
676
- // if you change 2 different cells on 2 different cells then this editedItems will only contain 1 property
677
- // example: editedItems = { 0: { title: task 0, duration: 50, ... }}
678
- // ...means that row index 0 got changed and the final merged object is { title: task 0, duration: 50, ... }
679
- console.log(this.editedItems);
680
- // console.log(`We changed ${Object.keys(this.editedItems).length} rows`);
681
-
682
- // since we saved, we can now remove all the unsaved color styling and reset our array/object
683
- this.removeAllUnsavedStylingFromCell();
684
- this.editQueue = [];
685
- this.editedItems = {};
686
- }
687
-
688
- undoLastEdit(showLastEditor = false) {
689
- const lastEdit = this.editQueue.pop();
690
- const lastEditCommand = lastEdit?.editCommand;
691
- if (lastEdit && lastEditCommand && SlickGlobalEditorLock.cancelCurrentEdit()) {
692
- lastEditCommand.undo();
693
-
694
- // remove unsaved css class from that cell
695
- for (const lastEditColumn of lastEdit.columns) {
696
- this.removeUnsavedStylingFromCell(lastEdit.item, lastEditColumn, lastEditCommand.row);
697
- }
698
- this.angularGrid.slickGrid.invalidate();
699
-
700
- // optionally open the last cell editor associated
701
- if (showLastEditor) {
702
- this.angularGrid?.slickGrid.gotoCell(lastEditCommand.row, lastEditCommand.cell, false);
703
- }
704
- }
705
- }
706
-
707
- undoAllEdits() {
708
- for (const lastEdit of this.editQueue) {
709
- const lastEditCommand = lastEdit?.editCommand;
710
- if (lastEditCommand && SlickGlobalEditorLock.cancelCurrentEdit()) {
711
- lastEditCommand.undo();
712
-
713
- // remove unsaved css class from that cell
714
- for (const lastEditColumn of lastEdit.columns) {
715
- this.removeUnsavedStylingFromCell(lastEdit.item, lastEditColumn, lastEditCommand.row);
716
- }
717
- }
718
- }
719
- this.angularGrid.slickGrid.invalidate(); // re-render the grid only after every cells got rolled back
720
- this.editQueue = [];
721
- }
722
-
723
- mockProducts() {
724
- return [
725
- {
726
- id: 0,
727
- itemName: 'Sleek Metal Computer',
728
- itemNameTranslated: 'some fantastic sleek metal computer description',
729
- listPrice: 2100.23,
730
- itemTypeName: 'I',
731
- image: 'http://i.stack.imgur.com/pC1Tv.jpg',
732
- icon: `mdi ${this.getRandomIcon(0)}`,
733
- },
734
- {
735
- id: 1,
736
- itemName: 'Tasty Granite Table',
737
- itemNameTranslated: 'an extremely huge and heavy table',
738
- listPrice: 3200.12,
739
- itemTypeName: 'I',
740
- image: 'https://i.imgur.com/Fnm7j6h.jpg',
741
- icon: `mdi ${this.getRandomIcon(1)}`,
742
- },
743
- {
744
- id: 2,
745
- itemName: 'Awesome Wooden Mouse',
746
- itemNameTranslated: 'super old mouse',
747
- listPrice: 15.0,
748
- itemTypeName: 'I',
749
- image: 'https://i.imgur.com/RaVJuLr.jpg',
750
- icon: `mdi ${this.getRandomIcon(2)}`,
751
- },
752
- {
753
- id: 3,
754
- itemName: 'Gorgeous Fresh Shirt',
755
- itemNameTranslated: 'what a gorgeous shirt seriously',
756
- listPrice: 25.76,
757
- itemTypeName: 'I',
758
- image: 'http://i.stack.imgur.com/pC1Tv.jpg',
759
- icon: `mdi ${this.getRandomIcon(3)}`,
760
- },
761
- {
762
- id: 4,
763
- itemName: 'Refined Cotton Table',
764
- itemNameTranslated: 'super light table that will fall apart amazingly fast',
765
- listPrice: 13.35,
766
- itemTypeName: 'I',
767
- image: 'https://i.imgur.com/Fnm7j6h.jpg',
768
- icon: `mdi ${this.getRandomIcon(4)}`,
769
- },
770
- {
771
- id: 5,
772
- itemName: 'Intelligent Wooden Pizza',
773
- itemNameTranslated: 'wood not included',
774
- listPrice: 23.33,
775
- itemTypeName: 'I',
776
- image: 'https://i.imgur.com/RaVJuLr.jpg',
777
- icon: `mdi ${this.getRandomIcon(5)}`,
778
- },
779
- {
780
- id: 6,
781
- itemName: 'Licensed Cotton Chips',
782
- itemNameTranslated: 'not sure what that is',
783
- listPrice: 71.21,
784
- itemTypeName: 'I',
785
- image: 'http://i.stack.imgur.com/pC1Tv.jpg',
786
- icon: `mdi ${this.getRandomIcon(6)}`,
787
- },
788
- {
789
- id: 7,
790
- itemName: 'Ergonomic Rubber Soap',
791
- itemNameTranslated: `so good you'll want to use it every night`,
792
- listPrice: 2.43,
793
- itemTypeName: 'I',
794
- image: 'https://i.imgur.com/Fnm7j6h.jpg',
795
- icon: `mdi ${this.getRandomIcon(7)}`,
796
- },
797
- {
798
- id: 8,
799
- itemName: 'Handcrafted Steel Car',
800
- itemNameTranslated: `aka tesla truck`,
801
- listPrice: 31288.39,
802
- itemTypeName: 'I',
803
- image: 'https://i.imgur.com/RaVJuLr.jpg',
804
- icon: `mdi ${this.getRandomIcon(8)}`,
805
- },
806
- ];
807
- }
808
-
809
- /** List of icons that are supported in this lib Material Design Icons */
810
- getRandomIcon(iconIndex?: number) {
811
- const icons = [
812
- 'mdi-arrow-collapse',
813
- 'mdi-arrow-expand',
814
- 'mdi-cancel',
815
- 'mdi-check',
816
- 'mdi-checkbox-blank-outline',
817
- 'mdi-check-box-outline',
818
- 'mdi-checkbox-marked',
819
- 'mdi-close',
820
- 'mdi-close-circle',
821
- 'mdi-close-circle-outline',
822
- 'mdi-close-thick',
823
- 'mdi-content-copy',
824
- 'mdi-database-refresh',
825
- 'mdi-download',
826
- 'mdi-file-document-outline',
827
- 'mdi-file-excel-outline',
828
- 'mdi-file-music-outline',
829
- 'mdi-file-pdf-outline',
830
- 'mdi-filter-remove-outline',
831
- 'mdi-flip-vertical',
832
- 'mdi-folder',
833
- 'mdi-folder-open',
834
- 'mdi-help-circle',
835
- 'mdi-help-circle-outline',
836
- 'mdi-history',
837
- 'mdi-information',
838
- 'mdi-information-outline',
839
- 'mdi-link',
840
- 'mdi-link-variant',
841
- 'mdi-menu',
842
- 'mdi-microsoft-excel',
843
- 'mdi-minus',
844
- 'mdi-page-first',
845
- 'mdi-page-last',
846
- 'mdi-paperclip',
847
- 'mdi-pin-off-outline',
848
- 'mdi-pin-outline',
849
- 'mdi-playlist-plus',
850
- 'mdi-playlist-remove',
851
- 'mdi-plus',
852
- 'mdi-redo',
853
- 'mdi-refresh',
854
- 'mdi-shape-square-plus',
855
- 'mdi-sort-ascending',
856
- 'mdi-sort-descending',
857
- 'mdi-swap-horizontal',
858
- 'mdi-swap-vertical',
859
- 'mdi-sync',
860
- 'mdi-table-edit',
861
- 'mdi-table-refresh',
862
- 'mdi-undo',
863
- ];
864
- const randomNumber = Math.floor(Math.random() * icons.length - 1);
865
- return icons[iconIndex ?? randomNumber];
866
- }
867
-
868
- renderItemCallbackWith2Rows(item: any): string {
869
- return `<div class="autocomplete-container-list">
870
- <div class="autocomplete-left">
871
- <!--<img src="http://i.stack.imgur.com/pC1Tv.jpg" width="50" />-->
872
- <span class="fa ${item.icon}"></span>
873
- </div>
874
- <div>
875
- <span class="autocomplete-top-left">
876
- <span class="mdfai ${item.itemTypeName === 'I' ? 'mdi-information-outline' : 'mdi-content-copy'}"></span>
877
- ${item.itemName}
878
- </span>
879
- <div>
880
- </div>
881
- <div>
882
- <div class="autocomplete-bottom-left">${item.itemNameTranslated}</div>
883
- </div>`;
884
- }
885
-
886
- renderItemCallbackWith4Corners(item: any): string {
887
- return `<div class="autocomplete-container-list">
888
- <div class="autocomplete-left">
889
- <!--<img src="http://i.stack.imgur.com/pC1Tv.jpg" width="50" />-->
890
- <span class="fa ${item.icon}"></span>
891
- </div>
892
- <div>
893
- <span class="autocomplete-top-left">
894
- <span class="fa ${item.itemTypeName === 'I' ? 'mdi-information-outline' : 'mdi-content-copy'}"></span>
895
- ${item.itemName}
896
- </span>
897
- <span class="autocomplete-top-right">${formatNumber(item.listPrice, 2, 2, false, '$')}</span>
898
- <div>
899
- </div>
900
- <div>
901
- <div class="autocomplete-bottom-left">${item.itemNameTranslated}</div>
902
- <span class="autocomplete-bottom-right">Type: <b>${item.itemTypeName === 'I' ? 'Item' : item.itemTypeName === 'C' ? 'PdCat' : 'Cat'}</b></span>
903
- </div>`;
904
- }
905
- }