angular-slickgrid 9.0.0 → 9.0.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 (394) hide show
  1. package/package.json +17 -4
  2. package/.gitbook.yaml +0 -5
  3. package/CHANGELOG.md +0 -1691
  4. package/CONTRIBUTING.md +0 -17
  5. package/angular.json +0 -133
  6. package/coverage/base.css +0 -224
  7. package/coverage/block-navigation.js +0 -87
  8. package/coverage/clover.xml +0 -1620
  9. package/coverage/coverage-final.json +0 -9
  10. package/coverage/favicon.png +0 -0
  11. package/coverage/index.html +0 -176
  12. package/coverage/library/components/angular-slickgrid.component.ts.html +0 -5074
  13. package/coverage/library/components/index.html +0 -116
  14. package/coverage/library/constants.ts.html +0 -397
  15. package/coverage/library/extensions/index.html +0 -116
  16. package/coverage/library/extensions/slickRowDetailView.ts.html +0 -1261
  17. package/coverage/library/index.html +0 -116
  18. package/coverage/library/modules/angular-slickgrid.module.ts.html +0 -166
  19. package/coverage/library/modules/index.html +0 -116
  20. package/coverage/library/services/angularUtil.service.ts.html +0 -445
  21. package/coverage/library/services/container.service.ts.html +0 -163
  22. package/coverage/library/services/index.html +0 -161
  23. package/coverage/library/services/translater.service.ts.html +0 -199
  24. package/coverage/library/services/utilities.ts.html +0 -142
  25. package/coverage/prettify.css +0 -1
  26. package/coverage/prettify.js +0 -2
  27. package/coverage/sort-arrow-sprite.png +0 -0
  28. package/coverage/sorter.js +0 -196
  29. package/dist/LICENSE +0 -21
  30. package/dist/README.md +0 -142
  31. package/docs/README.md +0 -5
  32. package/docs/TOC.md +0 -105
  33. package/docs/backend-services/Custom-Backend-Service.md +0 -50
  34. package/docs/backend-services/GraphQL.md +0 -276
  35. package/docs/backend-services/OData.md +0 -245
  36. package/docs/backend-services/graphql/GraphQL-Filtering.md +0 -156
  37. package/docs/backend-services/graphql/GraphQL-JSON-Result.md +0 -85
  38. package/docs/backend-services/graphql/GraphQL-Pagination.md +0 -77
  39. package/docs/backend-services/graphql/GraphQL-Sorting.md +0 -78
  40. package/docs/column-functionalities/cell-menu.md +0 -212
  41. package/docs/column-functionalities/editors/autocomplete-editor.md +0 -466
  42. package/docs/column-functionalities/editors/date-editor-flatpickr.md +0 -71
  43. package/docs/column-functionalities/editors/date-editor-vanilla-calendar.md +0 -91
  44. package/docs/column-functionalities/editors/longtext-editor-textarea.md +0 -80
  45. package/docs/column-functionalities/editors/select-dropdown-editor.md +0 -227
  46. package/docs/column-functionalities/editors.md +0 -604
  47. package/docs/column-functionalities/filters/autocomplete-filter.md +0 -183
  48. package/docs/column-functionalities/filters/compound-filters.md +0 -234
  49. package/docs/column-functionalities/filters/custom-filter.md +0 -117
  50. package/docs/column-functionalities/filters/filter-intro.md +0 -81
  51. package/docs/column-functionalities/filters/input-filter.md +0 -260
  52. package/docs/column-functionalities/filters/range-filters.md +0 -188
  53. package/docs/column-functionalities/filters/select-filter.md +0 -695
  54. package/docs/column-functionalities/filters/single-search-filter.md +0 -77
  55. package/docs/column-functionalities/filters/styling-filled-filters.md +0 -45
  56. package/docs/column-functionalities/formatters.md +0 -325
  57. package/docs/column-functionalities/sorting.md +0 -200
  58. package/docs/developer-guides/csp-compliance.md +0 -64
  59. package/docs/events/Available-Events.md +0 -223
  60. package/docs/events/Grid-&-DataView-Events.md +0 -211
  61. package/docs/getting-started/quick-start.md +0 -230
  62. package/docs/getting-started/troubleshooting.md +0 -80
  63. package/docs/grid-functionalities/Column-Picker.md +0 -22
  64. package/docs/grid-functionalities/Composite-Editor-Modal.md +0 -627
  65. package/docs/grid-functionalities/Context-Menu.md +0 -226
  66. package/docs/grid-functionalities/Custom-Footer.md +0 -80
  67. package/docs/grid-functionalities/Custom-Tooltip-(plugin).md +0 -258
  68. package/docs/grid-functionalities/Export-to-Excel.md +0 -457
  69. package/docs/grid-functionalities/Export-to-Text-File.md +0 -165
  70. package/docs/grid-functionalities/FAQ.md +0 -53
  71. package/docs/grid-functionalities/Global-Options.md +0 -29
  72. package/docs/grid-functionalities/Grid-Auto-Resize.md +0 -218
  73. package/docs/grid-functionalities/Grid-Menu.md +0 -134
  74. package/docs/grid-functionalities/Grid-State-&-Preset.md +0 -245
  75. package/docs/grid-functionalities/Header-Menu-&-Header-Buttons.md +0 -125
  76. package/docs/grid-functionalities/Resize-by-Cell-Content.md +0 -138
  77. package/docs/grid-functionalities/Row-Selection.md +0 -247
  78. package/docs/grid-functionalities/Row-based-edit.md +0 -71
  79. package/docs/grid-functionalities/add-update-highlight.md +0 -258
  80. package/docs/grid-functionalities/column-row-spanning.md +0 -74
  81. package/docs/grid-functionalities/dynamic-item-metadata.md +0 -124
  82. package/docs/grid-functionalities/excel-copy-buffer.md +0 -145
  83. package/docs/grid-functionalities/frozen-columns-rows.md +0 -164
  84. package/docs/grid-functionalities/grouping-and-aggregators.md +0 -269
  85. package/docs/grid-functionalities/header-footer-slots.md +0 -22
  86. package/docs/grid-functionalities/infinite-scroll.md +0 -150
  87. package/docs/grid-functionalities/providing-grid-data.md +0 -61
  88. package/docs/grid-functionalities/row-detail.md +0 -530
  89. package/docs/grid-functionalities/tree-data-grid.md +0 -391
  90. package/docs/localization/Localization---Component-Sample.md +0 -87
  91. package/docs/localization/Localization-with-Custom-Locales.md +0 -66
  92. package/docs/localization/Localization-with-ngx-translate.md +0 -148
  93. package/docs/migrations/migration-to-2.x.md +0 -304
  94. package/docs/migrations/migration-to-3.x.md +0 -295
  95. package/docs/migrations/migration-to-4.x.md +0 -83
  96. package/docs/migrations/migration-to-5.x.md +0 -160
  97. package/docs/migrations/migration-to-6.x.md +0 -128
  98. package/docs/migrations/migration-to-7.x.md +0 -294
  99. package/docs/migrations/migration-to-8.x.md +0 -316
  100. package/docs/migrations/migration-to-9.x.md +0 -219
  101. package/docs/slick-grid-dataview-objects/slickgrid-dataview-objects.md +0 -79
  102. package/docs/styling/dark-mode.md +0 -100
  103. package/docs/styling/styling.md +0 -250
  104. package/docs/testing/testing-patterns.md +0 -73
  105. package/eslint.config.mjs +0 -60
  106. package/ng-package.json +0 -10
  107. package/src/assets/angular-logo.png +0 -0
  108. package/src/assets/angular-logo2.png +0 -0
  109. package/src/assets/data/collection_100_numbers.json +0 -12
  110. package/src/assets/data/collection_500_numbers.json +0 -52
  111. package/src/assets/data/countries.json +0 -245
  112. package/src/assets/data/country_names.json +0 -245
  113. package/src/assets/data/customers_100.json +0 -102
  114. package/src/assets/data/users.csv +0 -5
  115. package/src/assets/i18n/en.json +0 -102
  116. package/src/assets/i18n/fr.json +0 -103
  117. package/src/demos/app-routing.module.ts +0 -108
  118. package/src/demos/app.component.html +0 -187
  119. package/src/demos/app.component.scss +0 -79
  120. package/src/demos/app.component.ts +0 -11
  121. package/src/demos/app.module.ts +0 -196
  122. package/src/demos/environments/environment.dev.ts +0 -3
  123. package/src/demos/environments/environment.prod.ts +0 -3
  124. package/src/demos/environments/environment.ts +0 -8
  125. package/src/demos/examples/custom-angularComponentEditor.ts +0 -187
  126. package/src/demos/examples/custom-angularComponentFilter.ts +0 -123
  127. package/src/demos/examples/custom-buttonFormatter.component.ts +0 -13
  128. package/src/demos/examples/custom-inputEditor.ts +0 -132
  129. package/src/demos/examples/custom-inputFilter.ts +0 -134
  130. package/src/demos/examples/custom-titleFormatter.component.ts +0 -9
  131. package/src/demos/examples/data/collection_100_numbers.json +0 -12
  132. package/src/demos/examples/data/collection_500_numbers.json +0 -52
  133. package/src/demos/examples/data/countries.json +0 -245
  134. package/src/demos/examples/data/country_names.json +0 -245
  135. package/src/demos/examples/data/customers_100.json +0 -102
  136. package/src/demos/examples/data/users.csv +0 -5
  137. package/src/demos/examples/editor-ng-select.component.ts +0 -38
  138. package/src/demos/examples/example01.component.html +0 -48
  139. package/src/demos/examples/example01.component.ts +0 -109
  140. package/src/demos/examples/example02.component.html +0 -45
  141. package/src/demos/examples/example02.component.ts +0 -218
  142. package/src/demos/examples/example03.component.html +0 -118
  143. package/src/demos/examples/example03.component.ts +0 -694
  144. package/src/demos/examples/example04.component.html +0 -87
  145. package/src/demos/examples/example04.component.ts +0 -326
  146. package/src/demos/examples/example05.component.html +0 -151
  147. package/src/demos/examples/example05.component.ts +0 -474
  148. package/src/demos/examples/example06.component.html +0 -163
  149. package/src/demos/examples/example06.component.ts +0 -446
  150. package/src/demos/examples/example07.component.html +0 -56
  151. package/src/demos/examples/example07.component.scss +0 -10
  152. package/src/demos/examples/example07.component.ts +0 -216
  153. package/src/demos/examples/example08.component.html +0 -51
  154. package/src/demos/examples/example08.component.scss +0 -23
  155. package/src/demos/examples/example08.component.ts +0 -195
  156. package/src/demos/examples/example09.component.html +0 -55
  157. package/src/demos/examples/example09.component.scss +0 -22
  158. package/src/demos/examples/example09.component.ts +0 -302
  159. package/src/demos/examples/example10.component.html +0 -103
  160. package/src/demos/examples/example10.component.ts +0 -309
  161. package/src/demos/examples/example11.component.html +0 -91
  162. package/src/demos/examples/example11.component.ts +0 -276
  163. package/src/demos/examples/example12.component.html +0 -98
  164. package/src/demos/examples/example12.component.ts +0 -317
  165. package/src/demos/examples/example13.component.html +0 -96
  166. package/src/demos/examples/example13.component.ts +0 -370
  167. package/src/demos/examples/example14.component.html +0 -50
  168. package/src/demos/examples/example14.component.scss +0 -11
  169. package/src/demos/examples/example14.component.ts +0 -156
  170. package/src/demos/examples/example15.component.html +0 -56
  171. package/src/demos/examples/example15.component.ts +0 -304
  172. package/src/demos/examples/example16.component.html +0 -77
  173. package/src/demos/examples/example16.component.ts +0 -277
  174. package/src/demos/examples/example17.component.html +0 -50
  175. package/src/demos/examples/example17.component.ts +0 -109
  176. package/src/demos/examples/example18.component.html +0 -132
  177. package/src/demos/examples/example18.component.ts +0 -445
  178. package/src/demos/examples/example19-rowdetail.component.html +0 -40
  179. package/src/demos/examples/example19-rowdetail.component.ts +0 -54
  180. package/src/demos/examples/example19.component.html +0 -79
  181. package/src/demos/examples/example19.component.ts +0 -316
  182. package/src/demos/examples/example20.component.html +0 -76
  183. package/src/demos/examples/example20.component.scss +0 -11
  184. package/src/demos/examples/example20.component.ts +0 -341
  185. package/src/demos/examples/example21.component.html +0 -86
  186. package/src/demos/examples/example21.component.scss +0 -16
  187. package/src/demos/examples/example21.component.ts +0 -140
  188. package/src/demos/examples/example22.component.html +0 -41
  189. package/src/demos/examples/example22.component.ts +0 -117
  190. package/src/demos/examples/example23.component.html +0 -111
  191. package/src/demos/examples/example23.component.ts +0 -323
  192. package/src/demos/examples/example24.component.html +0 -120
  193. package/src/demos/examples/example24.component.scss +0 -62
  194. package/src/demos/examples/example24.component.ts +0 -641
  195. package/src/demos/examples/example25.component.html +0 -60
  196. package/src/demos/examples/example25.component.scss +0 -8
  197. package/src/demos/examples/example25.component.ts +0 -255
  198. package/src/demos/examples/example26.component.html +0 -98
  199. package/src/demos/examples/example26.component.scss +0 -42
  200. package/src/demos/examples/example26.component.ts +0 -383
  201. package/src/demos/examples/example27.component.html +0 -138
  202. package/src/demos/examples/example27.component.scss +0 -10
  203. package/src/demos/examples/example27.component.ts +0 -369
  204. package/src/demos/examples/example28.component.html +0 -143
  205. package/src/demos/examples/example28.component.scss +0 -54
  206. package/src/demos/examples/example28.component.ts +0 -453
  207. package/src/demos/examples/example29.component.html +0 -30
  208. package/src/demos/examples/example29.component.ts +0 -70
  209. package/src/demos/examples/example30.component.html +0 -116
  210. package/src/demos/examples/example30.component.scss +0 -20
  211. package/src/demos/examples/example30.component.ts +0 -1070
  212. package/src/demos/examples/example32.component.html +0 -77
  213. package/src/demos/examples/example32.component.scss +0 -8
  214. package/src/demos/examples/example32.component.ts +0 -905
  215. package/src/demos/examples/example33.component.html +0 -50
  216. package/src/demos/examples/example33.component.scss +0 -46
  217. package/src/demos/examples/example33.component.ts +0 -571
  218. package/src/demos/examples/example34.component.html +0 -82
  219. package/src/demos/examples/example34.component.scss +0 -77
  220. package/src/demos/examples/example34.component.ts +0 -434
  221. package/src/demos/examples/example35.component.html +0 -77
  222. package/src/demos/examples/example35.component.scss +0 -18
  223. package/src/demos/examples/example35.component.ts +0 -264
  224. package/src/demos/examples/example36.component.html +0 -56
  225. package/src/demos/examples/example36.component.scss +0 -26
  226. package/src/demos/examples/example36.component.ts +0 -504
  227. package/src/demos/examples/example37.component.html +0 -30
  228. package/src/demos/examples/example37.component.ts +0 -123
  229. package/src/demos/examples/example38.component.html +0 -104
  230. package/src/demos/examples/example38.component.scss +0 -8
  231. package/src/demos/examples/example38.component.ts +0 -420
  232. package/src/demos/examples/example39.component.html +0 -112
  233. package/src/demos/examples/example39.component.scss +0 -8
  234. package/src/demos/examples/example39.component.ts +0 -371
  235. package/src/demos/examples/example40.component.html +0 -76
  236. package/src/demos/examples/example40.component.ts +0 -226
  237. package/src/demos/examples/example41.component.html +0 -50
  238. package/src/demos/examples/example41.component.scss +0 -42
  239. package/src/demos/examples/example41.component.ts +0 -229
  240. package/src/demos/examples/example42.component.html +0 -47
  241. package/src/demos/examples/example42.component.ts +0 -203
  242. package/src/demos/examples/example43.component.html +0 -94
  243. package/src/demos/examples/example43.component.scss +0 -30
  244. package/src/demos/examples/example43.component.ts +0 -449
  245. package/src/demos/examples/example44.component.html +0 -78
  246. package/src/demos/examples/example44.component.scss +0 -50
  247. package/src/demos/examples/example44.component.ts +0 -375
  248. package/src/demos/examples/example45-detail.component.html +0 -15
  249. package/src/demos/examples/example45-detail.component.ts +0 -97
  250. package/src/demos/examples/example45.component.html +0 -110
  251. package/src/demos/examples/example45.component.scss +0 -50
  252. package/src/demos/examples/example45.component.ts +0 -243
  253. package/src/demos/examples/filter-ng-select.component.ts +0 -33
  254. package/src/demos/examples/grid-custom-pager.component.html +0 -60
  255. package/src/demos/examples/grid-custom-pager.component.scss +0 -57
  256. package/src/demos/examples/grid-custom-pager.component.ts +0 -107
  257. package/src/demos/examples/grid-remote.component.html +0 -44
  258. package/src/demos/examples/grid-remote.component.ts +0 -164
  259. package/src/demos/examples/home.component.html +0 -39
  260. package/src/demos/examples/home.component.ts +0 -10
  261. package/src/demos/examples/jsonp.ts +0 -89
  262. package/src/demos/examples/rowdetail-preload.component.ts +0 -10
  263. package/src/demos/examples/swt-common-grid-pagination.component.ts +0 -160
  264. package/src/demos/examples/swt-common-grid-test.component.html +0 -37
  265. package/src/demos/examples/swt-common-grid-test.component.ts +0 -214
  266. package/src/demos/examples/swt-common-grid.component.ts +0 -436
  267. package/src/demos/examples/swt-logger.service.ts +0 -173
  268. package/src/demos/examples/utilities.ts +0 -9
  269. package/src/favicon.ico +0 -0
  270. package/src/index.html +0 -17
  271. package/src/library/components/__tests__/angular-slickgrid.component.spec.ts +0 -2638
  272. package/src/library/components/angular-slickgrid.component.html +0 -5
  273. package/src/library/components/angular-slickgrid.component.ts +0 -1662
  274. package/src/library/constants.ts +0 -105
  275. package/src/library/extensions/__tests__/slickRowDetailView.spec.ts +0 -751
  276. package/src/library/extensions/index.ts +0 -1
  277. package/src/library/extensions/slickRowDetailView.ts +0 -395
  278. package/src/library/global-grid-options.ts +0 -273
  279. package/src/library/index.ts +0 -11
  280. package/src/library/models/angularComponentOutput.interface.ts +0 -6
  281. package/src/library/models/angularGridInstance.interface.ts +0 -76
  282. package/src/library/models/externalTestingDependencies.interface.ts +0 -37
  283. package/src/library/models/gridOption.interface.ts +0 -15
  284. package/src/library/models/index.ts +0 -5
  285. package/src/library/models/rowDetailView.interface.ts +0 -16
  286. package/src/library/modules/angular-slickgrid.module.spec.ts +0 -25
  287. package/src/library/modules/angular-slickgrid.module.ts +0 -27
  288. package/src/library/services/__tests__/angularUtilService.spec.ts +0 -156
  289. package/src/library/services/__tests__/container.service.spec.ts +0 -25
  290. package/src/library/services/__tests__/translater.service.spec.ts +0 -43
  291. package/src/library/services/__tests__/utilities.spec.ts +0 -22
  292. package/src/library/services/angularUtil.service.ts +0 -120
  293. package/src/library/services/container.service.ts +0 -26
  294. package/src/library/services/index.ts +0 -4
  295. package/src/library/services/translater.service.ts +0 -38
  296. package/src/library/services/utilities.ts +0 -19
  297. package/src/library/slickgrid-config.ts +0 -10
  298. package/src/main.ts +0 -13
  299. package/src/public_api.ts +0 -1
  300. package/src/styles.scss +0 -178
  301. package/test/cypress/e2e/example01.cy.ts +0 -367
  302. package/test/cypress/e2e/example02.cy.ts +0 -60
  303. package/test/cypress/e2e/example03.cy.ts +0 -268
  304. package/test/cypress/e2e/example04.cy.ts +0 -254
  305. package/test/cypress/e2e/example05.cy.ts +0 -804
  306. package/test/cypress/e2e/example06.cy.ts +0 -890
  307. package/test/cypress/e2e/example07.cy.ts +0 -384
  308. package/test/cypress/e2e/example08.cy.ts +0 -190
  309. package/test/cypress/e2e/example09.cy.ts +0 -392
  310. package/test/cypress/e2e/example10.cy.ts +0 -650
  311. package/test/cypress/e2e/example11.cy.ts +0 -86
  312. package/test/cypress/e2e/example12.cy.ts +0 -269
  313. package/test/cypress/e2e/example13.cy.ts +0 -246
  314. package/test/cypress/e2e/example14.cy.ts +0 -122
  315. package/test/cypress/e2e/example15.cy.ts +0 -598
  316. package/test/cypress/e2e/example16.cy.ts +0 -427
  317. package/test/cypress/e2e/example17.cy.ts +0 -83
  318. package/test/cypress/e2e/example18.cy.ts +0 -431
  319. package/test/cypress/e2e/example19.cy.ts +0 -263
  320. package/test/cypress/e2e/example20.cy.ts +0 -264
  321. package/test/cypress/e2e/example21.cy.ts +0 -77
  322. package/test/cypress/e2e/example22.cy.ts +0 -94
  323. package/test/cypress/e2e/example23.cy.ts +0 -259
  324. package/test/cypress/e2e/example24.cy.ts +0 -707
  325. package/test/cypress/e2e/example25.cy.ts +0 -193
  326. package/test/cypress/e2e/example26.cy.ts +0 -111
  327. package/test/cypress/e2e/example27.cy.ts +0 -261
  328. package/test/cypress/e2e/example28.cy.ts +0 -740
  329. package/test/cypress/e2e/example29.cy.ts +0 -30
  330. package/test/cypress/e2e/example30.cy.ts +0 -757
  331. package/test/cypress/e2e/example31.cy.ts +0 -69
  332. package/test/cypress/e2e/example32.cy.ts +0 -272
  333. package/test/cypress/e2e/example33.cy.ts +0 -278
  334. package/test/cypress/e2e/example34.cy.ts +0 -84
  335. package/test/cypress/e2e/example35.cy.ts +0 -178
  336. package/test/cypress/e2e/example36.cy.ts +0 -219
  337. package/test/cypress/e2e/example37.cy.ts +0 -52
  338. package/test/cypress/e2e/example38.cy.ts +0 -160
  339. package/test/cypress/e2e/example39.cy.ts +0 -150
  340. package/test/cypress/e2e/example40.cy.ts +0 -126
  341. package/test/cypress/e2e/example41.cy.ts +0 -90
  342. package/test/cypress/e2e/example42.cy.ts +0 -82
  343. package/test/cypress/e2e/example43.cy.ts +0 -482
  344. package/test/cypress/e2e/example44.cy.ts +0 -458
  345. package/test/cypress/e2e/example45.cy.ts +0 -455
  346. package/test/cypress/e2e/home.cy.ts +0 -7
  347. package/test/cypress/fixtures/example.json +0 -5
  348. package/test/cypress/plugins/index.ts +0 -17
  349. package/test/cypress/plugins/utilities.ts +0 -28
  350. package/test/cypress/support/commands.ts +0 -88
  351. package/test/cypress/support/common.ts +0 -47
  352. package/test/cypress/support/drag.ts +0 -101
  353. package/test/cypress/support/index.ts +0 -20
  354. package/test/cypress/tsconfig.json +0 -9
  355. package/test/cypress.config.ts +0 -34
  356. package/test/mockSlickEvent.ts +0 -77
  357. package/test/rxjsResourceStub.ts +0 -69
  358. package/test/test-setup.ts +0 -6
  359. package/test/translateServiceStub.ts +0 -230
  360. package/test/translaterServiceStub.ts +0 -239
  361. package/test/tsconfig.json +0 -17
  362. package/test/vitest-global-mocks.ts +0 -41
  363. package/test/vitest-global-setup.ts +0 -3
  364. package/test/vitest-pretest.ts +0 -5
  365. package/tsconfig.app.json +0 -14
  366. package/tsconfig.json +0 -31
  367. package/tsconfig.spec.json +0 -11
  368. package/types/sortablejs.d.ts +0 -4
  369. package/vite.config.mts +0 -51
  370. /package/{dist/fesm2022 → fesm2022}/angular-slickgrid.mjs +0 -0
  371. /package/{dist/fesm2022 → fesm2022}/angular-slickgrid.mjs.map +0 -0
  372. /package/{dist/i18n → i18n}/en.json +0 -0
  373. /package/{dist/i18n → i18n}/fr.json +0 -0
  374. /package/{dist/index.d.ts → index.d.ts} +0 -0
  375. /package/{dist/library → library}/components/angular-slickgrid.component.d.ts +0 -0
  376. /package/{dist/library → library}/constants.d.ts +0 -0
  377. /package/{dist/library → library}/extensions/index.d.ts +0 -0
  378. /package/{dist/library → library}/extensions/slickRowDetailView.d.ts +0 -0
  379. /package/{dist/library → library}/global-grid-options.d.ts +0 -0
  380. /package/{dist/library → library}/index.d.ts +0 -0
  381. /package/{dist/library → library}/models/angularComponentOutput.interface.d.ts +0 -0
  382. /package/{dist/library → library}/models/angularGridInstance.interface.d.ts +0 -0
  383. /package/{dist/library → library}/models/externalTestingDependencies.interface.d.ts +0 -0
  384. /package/{dist/library → library}/models/gridOption.interface.d.ts +0 -0
  385. /package/{dist/library → library}/models/index.d.ts +0 -0
  386. /package/{dist/library → library}/models/rowDetailView.interface.d.ts +0 -0
  387. /package/{dist/library → library}/modules/angular-slickgrid.module.d.ts +0 -0
  388. /package/{dist/library → library}/services/angularUtil.service.d.ts +0 -0
  389. /package/{dist/library → library}/services/container.service.d.ts +0 -0
  390. /package/{dist/library → library}/services/index.d.ts +0 -0
  391. /package/{dist/library → library}/services/translater.service.d.ts +0 -0
  392. /package/{dist/library → library}/services/utilities.d.ts +0 -0
  393. /package/{dist/library → library}/slickgrid-config.d.ts +0 -0
  394. /package/{dist/public_api.d.ts → public_api.d.ts} +0 -0
@@ -1,1070 +0,0 @@
1
- import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
2
- import { HttpClient } from '@angular/common/http';
3
- import { ExcelExportService } from '@slickgrid-universal/excel-export';
4
- import { SlickCustomTooltip } from '@slickgrid-universal/custom-tooltip-plugin';
5
- import { SlickCompositeEditor, SlickCompositeEditorComponent } from '@slickgrid-universal/composite-editor-component';
6
-
7
- import {
8
- AngularGridInstance,
9
- type AutocompleterOption,
10
- Column,
11
- CompositeEditorModalType,
12
- EditCommand,
13
- Editors,
14
- Filters,
15
- formatNumber,
16
- Formatter,
17
- Formatters,
18
- GridOption,
19
- GridStateChange,
20
- LongTextEditorOption,
21
- OnCompositeEditorChangeEventArgs,
22
- SlickGlobalEditorLock,
23
- SlickGrid,
24
- SortComparers,
25
- type VanillaCalendarOption,
26
- } from '../../library';
27
-
28
- const NB_ITEMS = 500;
29
- const URL_COUNTRIES_COLLECTION = 'assets/data/countries.json';
30
-
31
- /**
32
- * Check if the current item (cell) is editable or not
33
- * @param {*} dataContext - item data context object
34
- * @param {*} columnDef - column definition
35
- * @param {*} grid - slickgrid grid object
36
- * @returns {boolean} isEditable
37
- */
38
- function checkItemIsEditable(dataContext: any, columnDef: Column, grid: SlickGrid) {
39
- const gridOptions = grid?.getOptions();
40
- const hasEditor = columnDef.editor;
41
- const isGridEditable = gridOptions.editable;
42
- let isEditable = !!(isGridEditable && hasEditor);
43
-
44
- if (dataContext && columnDef && gridOptions && gridOptions.editable) {
45
- switch (columnDef.id) {
46
- case 'finish':
47
- // case 'percentComplete':
48
- isEditable = !!dataContext?.completed;
49
- break;
50
- // case 'completed':
51
- // case 'duration':
52
- // case 'title':
53
- // case 'product':
54
- // case 'origin':
55
- // isEditable = dataContext.percentComplete < 50;
56
- // break;
57
- }
58
- }
59
- return isEditable;
60
- }
61
-
62
- const customEditableInputFormatter: Formatter = (_row, _cell, value, columnDef, _dataContext, grid) => {
63
- const gridOptions = grid.getOptions();
64
- const isEditableLine = gridOptions.editable && columnDef.editor;
65
- value = value === null || value === undefined ? '' : value;
66
- return isEditableLine ? { text: value, addClasses: 'editable-field' } : value;
67
- };
68
-
69
- // you can create custom validator to pass to an inline editor
70
- const myCustomTitleValidator = (value: any, args: any) => {
71
- if (
72
- (value === null || value === undefined || !value.length) &&
73
- ((args.compositeEditorOptions && args.compositeEditorOptions.modalType === 'create') ||
74
- args.compositeEditorOptions.modalType === 'edit')
75
- ) {
76
- // we will only check if the field is supplied when it's an inline editing OR a composite editor of type create/edit
77
- return { valid: false, msg: 'This is a required field.' };
78
- } else if (!/^(task\s\d+)*$/i.test(value)) {
79
- return { valid: false, msg: 'Your title is invalid, it must start with "Task" followed by a number.' };
80
- }
81
- return { valid: true, msg: '' };
82
- };
83
-
84
- @Component({
85
- templateUrl: './example30.component.html',
86
- styleUrls: ['./example30.component.scss'],
87
- encapsulation: ViewEncapsulation.None,
88
- standalone: false,
89
- })
90
- export class Example30Component implements OnDestroy, OnInit {
91
- private _darkMode = false;
92
- angularGrid!: AngularGridInstance;
93
- compositeEditorInstance!: SlickCompositeEditorComponent;
94
- gridOptions!: GridOption;
95
- columnDefinitions: Column[] = [];
96
- dataset: any[] = [];
97
- editQueue: any[] = [];
98
- editedItems: any = {};
99
- isGridEditable = true;
100
- isCompositeDisabled = false;
101
- isMassSelectionDisabled = true;
102
- cellCssStyleQueue: string[] = [];
103
- hideSubTitle = false;
104
- complexityLevelList = [
105
- { value: 0, label: 'Very Simple' },
106
- { value: 1, label: 'Simple' },
107
- { value: 2, label: 'Straightforward' },
108
- { value: 3, label: 'Complex' },
109
- { value: 4, label: 'Very Complex' },
110
- ];
111
-
112
- constructor(private http: HttpClient) {
113
- this.compositeEditorInstance = new SlickCompositeEditorComponent();
114
- }
115
-
116
- angularGridReady(angularGrid: AngularGridInstance) {
117
- this.angularGrid = angularGrid;
118
- }
119
-
120
- ngOnInit(): void {
121
- this.prepareGrid();
122
-
123
- // mock a dataset
124
- this.dataset = this.loadData(NB_ITEMS);
125
- }
126
-
127
- ngOnDestroy() {
128
- document.querySelector('.panel-wm-content')!.classList.remove('dark-mode');
129
- document.querySelector<HTMLDivElement>('#demo-container')!.dataset.bsTheme = 'light';
130
- }
131
-
132
- prepareGrid() {
133
- this.columnDefinitions = [
134
- {
135
- id: 'title',
136
- name: '<span title="Task must always be followed by a number" class="text-warning mdi mdi-alert-outline"></span> Title <span title="Title is always rendered as UPPERCASE" class="mdi mdi-information-outline"></span>',
137
- field: 'title',
138
- sortable: true,
139
- minWidth: 75,
140
- cssClass: 'text-uppercase fw-bold',
141
- columnGroup: 'Common Factor',
142
- filterable: true,
143
- filter: { model: Filters.compoundInputText },
144
- editor: {
145
- model: Editors.longText,
146
- massUpdate: false,
147
- required: true,
148
- alwaysSaveOnEnterKey: true,
149
- maxLength: 12,
150
- options: {
151
- cols: 45,
152
- rows: 6,
153
- buttonTexts: {
154
- cancel: 'Close',
155
- save: 'Done',
156
- },
157
- } as LongTextEditorOption,
158
- validator: myCustomTitleValidator,
159
- },
160
- },
161
- {
162
- id: 'duration',
163
- name: 'Duration',
164
- field: 'duration',
165
- sortable: true,
166
- filterable: true,
167
- minWidth: 75,
168
- type: 'number',
169
- columnGroup: 'Common Factor',
170
- formatter: (_row, _cell, value) => {
171
- if (value === null || value === undefined || value === '') {
172
- return '';
173
- }
174
- return value > 1 ? `${value} days` : `${value} day`;
175
- },
176
- editor: {
177
- model: Editors.float,
178
- massUpdate: true,
179
- decimal: 2,
180
- valueStep: 1,
181
- minValue: 0,
182
- maxValue: 10000,
183
- alwaysSaveOnEnterKey: true,
184
- required: true,
185
- },
186
- },
187
- {
188
- id: 'cost',
189
- name: 'Cost',
190
- field: 'cost',
191
- width: 90,
192
- minWidth: 70,
193
- sortable: true,
194
- filterable: true,
195
- type: 'number',
196
- columnGroup: 'Analysis',
197
- filter: { model: Filters.compoundInputNumber },
198
- formatter: Formatters.dollar,
199
- },
200
- {
201
- id: 'percentComplete',
202
- name: '% Complete',
203
- field: 'percentComplete',
204
- minWidth: 100,
205
- type: 'number',
206
- sortable: true,
207
- filterable: true,
208
- columnGroup: 'Analysis',
209
- filter: { model: Filters.compoundSlider, operator: '>=' },
210
- editor: {
211
- model: Editors.slider,
212
- massUpdate: true,
213
- minValue: 0,
214
- maxValue: 100,
215
- },
216
- customTooltip: { position: 'center' },
217
- },
218
- // {
219
- // id: 'percentComplete2', name: '% Complete', field: 'analysis.percentComplete', minWidth: 100,
220
- // type: 'number',
221
- // sortable: true, filterable: true, columnGroup: 'Analysis',
222
- // // filter: { model: Filters.compoundSlider, operator: '>=' },
223
- // formatter: Formatters.complex,
224
- // exportCustomFormatter: Formatters.complex, // without the Editing cell Formatter
225
- // editor: {
226
- // model: Editors.singleSelect,
227
- // serializeComplexValueFormat: 'flat', // if we keep "object" as the default it will apply { value: 2, label: 2 } which is not what we want in this case
228
- // collection: Array.from(Array(101).keys()).map(k => ({ value: k, label: k })),
229
- // collectionOptions: {
230
- // addCustomFirstEntry: { value: '', label: '--none--' }
231
- // },
232
- // collectionOverride: (_collectionInput, args) => {
233
- // const originalCollection = args.originalCollections || [];
234
- // const duration = args?.dataContext?.duration ?? args?.compositeEditorOptions?.formValues?.duration;
235
- // if (duration === 10) {
236
- // return originalCollection.filter(itemCollection => +itemCollection.value !== 1);
237
- // }
238
- // return originalCollection;
239
- // },
240
- // massUpdate: true, minValue: 0, maxValue: 100,
241
- // },
242
- // },
243
- {
244
- id: 'complexity',
245
- name: 'Complexity',
246
- field: 'complexity',
247
- minWidth: 100,
248
- type: 'number',
249
- sortable: true,
250
- filterable: true,
251
- columnGroup: 'Analysis',
252
- formatter: (_row, _cell, value) => this.complexityLevelList[value]?.label,
253
- exportCustomFormatter: (_row, _cell, value) => this.complexityLevelList[value]?.label,
254
- filter: {
255
- model: Filters.multipleSelect,
256
- collection: this.complexityLevelList,
257
- },
258
- editor: {
259
- model: Editors.singleSelect,
260
- collection: this.complexityLevelList,
261
- massUpdate: true,
262
- },
263
- },
264
- {
265
- id: 'start',
266
- name: 'Start',
267
- field: 'start',
268
- sortable: true,
269
- minWidth: 100,
270
- formatter: Formatters.dateUs,
271
- columnGroup: 'Period',
272
- exportCustomFormatter: Formatters.dateUs,
273
- type: 'date',
274
- outputType: 'dateUs',
275
- saveOutputType: 'dateUtc',
276
- filterable: true,
277
- filter: { model: Filters.compoundDate },
278
- editor: { model: Editors.date, massUpdate: true, options: { hideClearButton: false } as VanillaCalendarOption },
279
- },
280
- {
281
- id: 'completed',
282
- name: 'Completed',
283
- field: 'completed',
284
- width: 80,
285
- minWidth: 75,
286
- maxWidth: 100,
287
- cssClass: 'text-center',
288
- columnGroup: 'Period',
289
- formatter: Formatters.checkmarkMaterial,
290
- exportWithFormatter: false,
291
- filterable: true,
292
- sortable: true,
293
- filter: {
294
- collection: [
295
- { value: '', label: '' },
296
- { value: true, label: 'True' },
297
- { value: false, label: 'False' },
298
- ],
299
- model: Filters.singleSelect,
300
- },
301
- editor: { model: Editors.checkbox, massUpdate: true },
302
- // editor: { model: Editors.singleSelect, collection: [{ value: true, label: 'Yes' }, { value: false, label: 'No' }], },
303
- },
304
- {
305
- id: 'finish',
306
- name: 'Finish',
307
- field: 'finish',
308
- sortable: true,
309
- minWidth: 100,
310
- formatter: Formatters.dateUs,
311
- columnGroup: 'Period',
312
- type: 'date',
313
- outputType: 'dateUs',
314
- saveOutputType: 'dateUtc',
315
- filterable: true,
316
- filter: { model: Filters.compoundDate },
317
- exportCustomFormatter: Formatters.dateUs,
318
- editor: {
319
- model: Editors.date,
320
- options: {
321
- displayDateMin: 'today',
322
-
323
- // if we want to preload the date picker with a different date,
324
- // we could do it by assigning settings.seleted.dates
325
- // NOTE: vanilla-calendar doesn't automatically focus the picker to the year/month and you need to do it yourself
326
- // selectedDates: ['2021-06-04'],
327
- // selectedMonth: 6 - 1, // Note: JS Date month (only) is zero index based, so June is 6-1 => 5
328
- // selectedYear: 2021
329
- } as VanillaCalendarOption,
330
- massUpdate: true,
331
- validator: (value, args) => {
332
- const dataContext = args && args.item;
333
- if (dataContext && dataContext.completed && !value) {
334
- return { valid: false, msg: 'You must provide a "Finish" date when "Completed" is checked.' };
335
- }
336
- return { valid: true, msg: '' };
337
- },
338
- },
339
- },
340
- {
341
- id: 'product',
342
- name: 'Product',
343
- field: 'product',
344
- filterable: true,
345
- columnGroup: 'Item',
346
- minWidth: 100,
347
- exportWithFormatter: true,
348
- dataKey: 'id',
349
- labelKey: 'itemName',
350
- formatter: Formatters.complexObject,
351
- exportCustomFormatter: Formatters.complex, // without the Editing cell Formatter
352
- type: 'object',
353
- sortComparer: SortComparers.objectString,
354
- editor: {
355
- model: Editors.autocompleter,
356
- alwaysSaveOnEnterKey: true,
357
- massUpdate: true,
358
-
359
- // example with a Remote API call
360
- options: {
361
- minLength: 1,
362
- fetch: (searchTerm: string, callback: (items: false | any[]) => void) => {
363
- const products = this.mockProducts();
364
- callback(products.filter((product) => product.itemName.toLowerCase().includes(searchTerm.toLowerCase())));
365
- },
366
- renderItem: {
367
- // layout: 'twoRows',
368
- // templateCallback: (item: any) => this.renderItemCallbackWith2Rows(item),
369
-
370
- layout: 'fourCorners',
371
- templateCallback: (item: any) => this.renderItemCallbackWith4Corners(item),
372
- },
373
- } as AutocompleterOption,
374
- },
375
- filter: {
376
- model: Filters.inputText,
377
- // placeholder: '🔎︎ search product',
378
- queryField: 'product.itemName',
379
- },
380
- },
381
- {
382
- id: 'origin',
383
- name: 'Country of Origin',
384
- field: 'origin',
385
- formatter: Formatters.complexObject,
386
- columnGroup: 'Item',
387
- exportCustomFormatter: Formatters.complex, // without the Editing cell Formatter
388
- dataKey: 'code',
389
- labelKey: 'name',
390
- type: 'object',
391
- sortComparer: SortComparers.objectString,
392
- filterable: true,
393
- sortable: true,
394
- minWidth: 100,
395
- editor: {
396
- model: Editors.autocompleter,
397
- massUpdate: true,
398
- customStructure: { label: 'name', value: 'code' },
399
- collectionAsync: this.http.get(URL_COUNTRIES_COLLECTION),
400
- options: { minLength: 0 } as AutocompleterOption,
401
- },
402
- filter: {
403
- model: Filters.inputText,
404
- queryField: 'origin.name',
405
- },
406
- },
407
- {
408
- id: 'action',
409
- name: 'Action',
410
- field: 'action',
411
- width: 70,
412
- minWidth: 70,
413
- maxWidth: 70,
414
- excludeFromExport: true,
415
- formatter: () =>
416
- `<div class="button-style margin-auto" style="width: 35px;"><span class="mdi mdi-chevron-down text-primary"></span></div>`,
417
- cellMenu: {
418
- hideCloseButton: false,
419
- commandTitle: 'Commands',
420
- commandItems: [
421
- {
422
- command: 'edit',
423
- title: 'Edit Row',
424
- iconCssClass: 'mdi mdi-pencil',
425
- positionOrder: 66,
426
- action: () => this.openCompositeModal('edit'),
427
- },
428
- {
429
- command: 'clone',
430
- title: 'Clone Row',
431
- iconCssClass: 'mdi mdi-content-copy',
432
- positionOrder: 66,
433
- action: () => this.openCompositeModal('clone'),
434
- },
435
- 'divider',
436
- {
437
- command: 'delete-row',
438
- title: 'Delete Row',
439
- positionOrder: 64,
440
- iconCssClass: 'mdi mdi-close color-danger',
441
- cssClass: 'red',
442
- textCssClass: 'text-italic color-danger-light',
443
- // only show command to 'Delete Row' when the task is not completed
444
- itemVisibilityOverride: (args) => {
445
- return !args.dataContext?.completed;
446
- },
447
- action: (_event, args) => {
448
- const dataContext = args.dataContext;
449
- const row = args?.row ?? 0;
450
- if (confirm(`Do you really want to delete row (${row + 1}) with "${dataContext.title}"`)) {
451
- this.angularGrid.gridService.deleteItemById(dataContext.id);
452
- }
453
- },
454
- },
455
- ],
456
- },
457
- },
458
- ];
459
-
460
- this.gridOptions = {
461
- enableAddRow: true, // <-- this flag is required to work with the (create & clone) modal types
462
- enableCellNavigation: true,
463
- asyncEditorLoading: false,
464
- autoEdit: true,
465
- autoCommitEdit: true,
466
- editable: true,
467
- autoAddCustomEditorFormatter: customEditableInputFormatter,
468
- autoResize: {
469
- container: '#demo-container',
470
- rightPadding: 10,
471
- },
472
- darkMode: this._darkMode,
473
- enableAutoSizeColumns: true,
474
- enableAutoResize: true,
475
- showCustomFooter: true,
476
- enablePagination: true,
477
- pagination: {
478
- pageSize: 10,
479
- pageSizes: [10, 200, 250, 500, 5000],
480
- },
481
- enableExcelExport: true,
482
- excelExportOptions: {
483
- exportWithFormatter: false,
484
- },
485
- externalResources: [new ExcelExportService(), new SlickCustomTooltip(), this.compositeEditorInstance],
486
- enableFiltering: true,
487
- rowSelectionOptions: {
488
- // True (Single Selection), False (Multiple Selections)
489
- selectActiveRow: false,
490
- },
491
- createPreHeaderPanel: true,
492
- showPreHeaderPanel: true,
493
- preHeaderPanelHeight: 28,
494
- enableCheckboxSelector: true,
495
- enableRowSelection: true,
496
- multiSelect: false,
497
- checkboxSelector: {
498
- hideInFilterHeaderRow: false,
499
- hideInColumnTitleRow: true,
500
- },
501
- enableCompositeEditor: true,
502
- editCommandHandler: (item, column, editCommand) => {
503
- // composite editors values are saved as array, so let's convert to array in any case and we'll loop through these values
504
- const prevSerializedValues = Array.isArray(editCommand.prevSerializedValue)
505
- ? editCommand.prevSerializedValue
506
- : [editCommand.prevSerializedValue];
507
- const serializedValues = Array.isArray(editCommand.serializedValue) ? editCommand.serializedValue : [editCommand.serializedValue];
508
- const editorColumns = this.columnDefinitions.filter((col) => col.editor !== undefined);
509
-
510
- const modifiedColumns: Column[] = [];
511
- prevSerializedValues.forEach((_val, index) => {
512
- const prevSerializedValue = prevSerializedValues[index];
513
- const serializedValue = serializedValues[index];
514
-
515
- if (prevSerializedValue !== serializedValue || serializedValue === '') {
516
- const finalColumn = Array.isArray(editCommand.prevSerializedValue) ? editorColumns[index] : column;
517
- 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
518
- this.angularGrid.slickGrid.invalidate();
519
- editCommand.execute();
520
-
521
- this.renderUnsavedCellStyling(item, finalColumn, editCommand);
522
- modifiedColumns.push(finalColumn);
523
- }
524
- });
525
-
526
- // queued editor only keeps 1 item object even when it's a composite editor,
527
- // so we'll push only 1 change at the end but with all columns modified
528
- // 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)
529
- this.editQueue.push({ item, columns: modifiedColumns, editCommand });
530
- },
531
- // when using the cellMenu, you can change some of the default options and all use some of the callback methods
532
- enableCellMenu: true,
533
- cellMenu: {
534
- activateCellOnMenuClick: true, // this is important to know which row index to use for Composite Editor
535
- },
536
- gridMenu: {
537
- hideToggleDarkModeCommand: false, // hidden by default
538
- onCommand: (_, args) => {
539
- if (args.command === 'toggle-dark-mode') {
540
- this._darkMode = !this._darkMode; // keep local toggle var in sync
541
- this.toggleBodyBackground();
542
- }
543
- },
544
- },
545
- };
546
- }
547
-
548
- loadData(count: number) {
549
- // mock data
550
- const tmpArray: any[] = [];
551
- for (let i = 0; i < count; i++) {
552
- const randomItemId = Math.floor(Math.random() * this.mockProducts().length);
553
- const randomYear = 2000 + Math.floor(Math.random() * 10);
554
- const randomFinishYear = new Date().getFullYear() + Math.floor(Math.random() * 10); // use only years not lower than 3 years ago
555
- const randomMonth = Math.floor(Math.random() * 11);
556
- const randomDay = Math.floor(Math.random() * 29);
557
- const randomTime = Math.floor(Math.random() * 59);
558
- const randomFinish = new Date(randomFinishYear, randomMonth + 1, randomDay, randomTime, randomTime, randomTime);
559
- const randomPercentComplete = Math.floor(Math.random() * 100) + 15; // make it over 15 for E2E testing purposes
560
- const percentCompletion = randomPercentComplete > 100 ? (i > 5 ? 100 : 88) : randomPercentComplete; // don't use 100 unless it's over index 5, for E2E testing purposes
561
- const isCompleted = percentCompletion === 100;
562
-
563
- tmpArray[i] = {
564
- id: i,
565
- title: 'Task ' + i,
566
- duration: Math.floor(Math.random() * 100) + 10,
567
- percentComplete: percentCompletion,
568
- analysis: {
569
- percentComplete: percentCompletion,
570
- },
571
- complexity: i % 3 ? 0 : 2,
572
- start: new Date(randomYear, randomMonth, randomDay, randomDay, randomTime, randomTime, randomTime),
573
- 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
574
- cost: i % 33 === 0 ? null : Math.round(Math.random() * 10000) / 100,
575
- completed: (isCompleted && i > 5) || (i % 3 === 0 && randomFinish > new Date() && i > 3),
576
- product: { id: this.mockProducts()[randomItemId]?.id, itemName: this.mockProducts()[randomItemId]?.itemName },
577
- origin: i % 2 ? { code: 'CA', name: 'Canada' } : { code: 'US', name: 'United States' },
578
- };
579
-
580
- if (!(i % 8)) {
581
- delete tmpArray[i].finish; // also test with undefined properties
582
- delete tmpArray[i].percentComplete; // also test with undefined properties
583
- }
584
- }
585
- return tmpArray;
586
- }
587
-
588
- // --
589
- // event handlers
590
- // ---------------
591
-
592
- handleValidationError(_e: Event, args: any) {
593
- if (args.validationResults) {
594
- let errorMsg = args.validationResults.msg || '';
595
- if (args.editor && args.editor instanceof SlickCompositeEditor) {
596
- if (args.validationResults.errors) {
597
- errorMsg += '\n';
598
- for (const error of args.validationResults.errors) {
599
- const columnName = error.editor.args.column.name;
600
- errorMsg += `${columnName.toUpperCase()}: ${error.msg}`;
601
- }
602
- }
603
- console.log(errorMsg);
604
- }
605
- } else {
606
- alert(args.validationResults.msg);
607
- }
608
- return false;
609
- }
610
-
611
- handleItemDeleted(itemId: string) {
612
- console.log('item deleted with id:', itemId);
613
- }
614
-
615
- handleOnBeforeEditCell(e: Event, args: any) {
616
- const { column, item, grid } = args;
617
-
618
- if (column && item) {
619
- if (!checkItemIsEditable(item, column, grid)) {
620
- e.preventDefault(); // OR eventData.preventDefault();
621
- return false;
622
- }
623
- }
624
- return true;
625
- }
626
-
627
- handleOnCellChange(_e: Event, args: any) {
628
- const dataContext = args?.item;
629
-
630
- // when the field "completed" changes to false, we also need to blank out the "finish" date
631
- if (dataContext && !dataContext.completed) {
632
- dataContext.finish = null;
633
- this.angularGrid.gridService.updateItem(dataContext);
634
- }
635
- }
636
-
637
- handleOnCellClicked(e: Event, args: any) {
638
- console.log(e, args);
639
- // if (eventData.target.classList.contains('mdi-help-circle-outline')) {
640
- // alert('please HELP!!!');
641
- // } else if (eventData.target.classList.contains('mdi-chevron-down')) {
642
- // alert('do something else...');
643
- // }
644
- }
645
-
646
- handleOnCompositeEditorChange(_e: Event, args: OnCompositeEditorChangeEventArgs) {
647
- const columnDef = args.column;
648
- const formValues = args.formValues;
649
-
650
- // you can dynamically change a select dropdown collection,
651
- // if you need to re-render the editor for the list to be reflected
652
- // if (columnDef.id === 'duration') {
653
- // const editor = this.compositeEditorInstance.editors['percentComplete2'] as SelectEditor;
654
- // const newCollection = editor.finalCollection;
655
- // editor.renderDomElement(newCollection);
656
- // }
657
-
658
- // you can change any other form input values when certain conditions are met
659
- if (columnDef.id === 'percentComplete' && formValues.percentComplete === 100) {
660
- this.compositeEditorInstance.changeFormInputValue('completed', true);
661
- this.compositeEditorInstance.changeFormInputValue('finish', new Date());
662
- // this.compositeEditorInstance.changeFormInputValue('product', { id: 0, itemName: 'Sleek Metal Computer' });
663
-
664
- // you can even change a value that is not part of the form (but is part of the grid)
665
- // but you will have to bypass the error thrown by providing `true` as the 3rd argument
666
- // this.compositeEditorInstance.changeFormInputValue('cost', 9999.99, true);
667
- }
668
-
669
- // you can also change some editor options
670
- // not all Editors supports this functionality, so far only these Editors are supported are: Date, Single/Multiple Select, Slider
671
- /*
672
- if (columnDef.id === 'completed') {
673
- this.compositeEditorInstance.changeFormEditorOption('complexity', 'filter', true); // multiple-select dropdown editor
674
- this.compositeEditorInstance.changeFormEditorOption('percentComplete', 'hideSliderNumber', formValues['completed']); // slider editor
675
- this.compositeEditorInstance.changeFormEditorOption('finish', 'displayDateMin', 'today'); // calendar picker, change minDate to today
676
- }
677
- */
678
- }
679
-
680
- handleReRenderUnsavedStyling() {
681
- this.removeAllUnsavedStylingFromCell();
682
- this.renderUnsavedStylingOnAllVisibleCells();
683
- }
684
-
685
- handleOnGridStateChanged(gridStateChanges: GridStateChange) {
686
- if (Array.isArray(gridStateChanges.gridState?.rowSelection?.dataContextIds)) {
687
- this.isMassSelectionDisabled = gridStateChanges.gridState?.rowSelection?.dataContextIds.length === 0;
688
- }
689
- }
690
-
691
- openCompositeModal(modalType: CompositeEditorModalType) {
692
- // open the editor modal and we can also provide a header title with optional parsing pulled from the dataContext, via template {{ }}
693
- // for example {{title}} => display the item title, or even complex object works {{product.itemName}} => display item product name
694
-
695
- let modalTitle = '';
696
- switch (modalType) {
697
- case 'create':
698
- modalTitle = 'Inserting New Task';
699
- break;
700
- case 'clone':
701
- modalTitle = 'Clone - {{title}}';
702
- break;
703
- case 'edit':
704
- modalTitle = 'Editing - {{title}} (<span class="text-muted">id:</span> <span class="text-primary">{{id}}</span>)'; // 'Editing - {{title}} ({{product.itemName}})'
705
- break;
706
- case 'mass-update':
707
- modalTitle = 'Mass Update All Records';
708
- break;
709
- case 'mass-selection':
710
- modalTitle = 'Update Selected Records';
711
- break;
712
- }
713
-
714
- this.compositeEditorInstance?.openDetails({
715
- headerTitle: modalTitle,
716
- modalType,
717
- insertOptions: { highlightRow: false }, // disable highlight to avoid flaky tests in Cypress
718
- // showCloseButtonOutside: true,
719
- // backdrop: null,
720
- // viewColumnLayout: 2, // responsive layout, choose from 'auto', 1, 2, or 3 (defaults to 'auto')
721
- showFormResetButton: true,
722
- // showResetButtonOnEachEditor: true,
723
- resetFormButtonIconCssClass: 'mdi mdi-undo',
724
- onClose: () => Promise.resolve(confirm('You have unsaved changes, are you sure you want to close this window?')),
725
- onError: (error) => alert(error.message),
726
- onRendered: (modalElm) => {
727
- // Bootstrap requires extra attribute when toggling Dark Mode (data-bs-theme="dark")
728
- // we need to manually add this attribute ourselve before opening the Composite Editor Modal
729
- modalElm.dataset.bsTheme = this._darkMode ? 'dark' : 'light';
730
- },
731
- onSave: (formValues, _selection, dataContext) => {
732
- const serverResponseDelay = 50;
733
-
734
- // simulate a backend server call which will reject if the "% Complete" is below 50%
735
- // when processing a mass update or mass selection
736
- if (modalType === 'mass-update' || modalType === 'mass-selection') {
737
- return new Promise((resolve, reject) => {
738
- window.setTimeout(() => {
739
- if (formValues.percentComplete >= 50) {
740
- resolve(true);
741
- } else {
742
- reject('Unfortunately we only accept a minimum of 50% Completion...');
743
- }
744
- }, serverResponseDelay);
745
- });
746
- } else {
747
- // also simulate a server cal for any other modal type (create/clone/edit)
748
- // we'll just apply the change without any rejection from the server and
749
- // note that we also have access to the "dataContext" which is only available for these modal
750
- console.log(`${modalType} item data context`, dataContext);
751
- return new Promise((resolve) => window.setTimeout(() => resolve(true), serverResponseDelay));
752
- }
753
- },
754
- });
755
- }
756
-
757
- toggleGridEditReadonly() {
758
- // first need undo all edits
759
- this.undoAllEdits();
760
-
761
- // then change a single grid options to make the grid non-editable (readonly)
762
- this.isGridEditable = !this.isGridEditable;
763
- this.isCompositeDisabled = !this.isGridEditable;
764
- if (!this.isGridEditable) {
765
- this.isMassSelectionDisabled = true;
766
- }
767
- // dynamically change SlickGrid editable grid option
768
- this.angularGrid.slickGrid.setOptions({ editable: this.isGridEditable });
769
- }
770
-
771
- removeUnsavedStylingFromCell(_item: any, column: Column, row: number) {
772
- // remove unsaved css class from that cell
773
- const cssStyleKey = `unsaved_highlight_${[column.id]}${row}`;
774
- this.angularGrid.slickGrid?.removeCellCssStyles(cssStyleKey);
775
- const foundIdx = this.cellCssStyleQueue.findIndex((styleKey) => styleKey === cssStyleKey);
776
- if (foundIdx >= 0) {
777
- this.cellCssStyleQueue.splice(foundIdx, 1);
778
- }
779
- }
780
-
781
- removeAllUnsavedStylingFromCell() {
782
- for (const cssStyleKey of this.cellCssStyleQueue) {
783
- this.angularGrid.slickGrid?.removeCellCssStyles(cssStyleKey);
784
- }
785
- this.cellCssStyleQueue = [];
786
- }
787
-
788
- renderUnsavedStylingOnAllVisibleCells() {
789
- for (const lastEdit of this.editQueue) {
790
- if (lastEdit) {
791
- const { item, columns, editCommand } = lastEdit;
792
- if (Array.isArray(columns)) {
793
- columns.forEach((col) => {
794
- this.renderUnsavedCellStyling(item, col, editCommand);
795
- });
796
- }
797
- }
798
- }
799
- }
800
-
801
- renderUnsavedCellStyling(item: any, column: Column, editCommand: EditCommand) {
802
- if (editCommand && item && column) {
803
- const row = this.angularGrid.dataView?.getRowByItem(item);
804
- if (row !== undefined && row >= 0) {
805
- const hash = { [row]: { [column.id]: 'unsaved-editable-field' } };
806
- const cssStyleKey = `unsaved_highlight_${[column.id]}${row}`;
807
- this.angularGrid.slickGrid?.setCellCssStyles(cssStyleKey, hash);
808
- this.cellCssStyleQueue.push(cssStyleKey);
809
- }
810
- }
811
- }
812
-
813
- saveAll() {
814
- // Edit Queue (array increases every time a cell is changed, regardless of item object)
815
- console.log(this.editQueue);
816
-
817
- // Edit Items only keeps the merged data (an object with row index as the row properties)
818
- // if you change 2 different cells on 2 different cells then this editedItems will only contain 1 property
819
- // example: editedItems = { 0: { title: task 0, duration: 50, ... }}
820
- // ...means that row index 0 got changed and the final merged object is { title: task 0, duration: 50, ... }
821
- console.log(this.editedItems);
822
- // console.log(`We changed ${Object.keys(this.editedItems).length} rows`);
823
-
824
- // since we saved, we can now remove all the unsaved color styling and reset our array/object
825
- this.removeAllUnsavedStylingFromCell();
826
- this.editQueue = [];
827
- this.editedItems = {};
828
- }
829
-
830
- undoLastEdit(showLastEditor = false) {
831
- const lastEdit = this.editQueue.pop();
832
- const lastEditCommand = lastEdit?.editCommand;
833
- if (lastEdit && lastEditCommand && SlickGlobalEditorLock.cancelCurrentEdit()) {
834
- lastEditCommand.undo();
835
-
836
- // remove unsaved css class from that cell
837
- for (const lastEditColumn of lastEdit.columns) {
838
- this.removeUnsavedStylingFromCell(lastEdit.item, lastEditColumn, lastEditCommand.row);
839
- }
840
- this.angularGrid.slickGrid.invalidate();
841
-
842
- // optionally open the last cell editor associated
843
- if (showLastEditor) {
844
- this.angularGrid.slickGrid.gotoCell(lastEditCommand.row, lastEditCommand.cell, false);
845
- }
846
- }
847
- }
848
-
849
- undoAllEdits() {
850
- for (const lastEdit of this.editQueue) {
851
- const lastEditCommand = lastEdit?.editCommand;
852
- if (lastEditCommand && SlickGlobalEditorLock.cancelCurrentEdit()) {
853
- lastEditCommand.undo();
854
-
855
- // remove unsaved css class from that cell
856
- for (const lastEditColumn of lastEdit.columns) {
857
- this.removeUnsavedStylingFromCell(lastEdit.item, lastEditColumn, lastEditCommand.row);
858
- }
859
- }
860
- }
861
- this.angularGrid.slickGrid.invalidate(); // re-render the grid only after every cells got rolled back
862
- this.editQueue = [];
863
- }
864
-
865
- toggleDarkMode() {
866
- this._darkMode = !this._darkMode;
867
- this.toggleBodyBackground();
868
- this.angularGrid.slickGrid?.setOptions({ darkMode: this._darkMode });
869
- }
870
-
871
- toggleBodyBackground() {
872
- if (this._darkMode) {
873
- document.querySelector<HTMLDivElement>('.panel-wm-content')!.classList.add('dark-mode');
874
- document.querySelector<HTMLDivElement>('#demo-container')!.dataset.bsTheme = 'dark';
875
- } else {
876
- document.querySelector('.panel-wm-content')!.classList.remove('dark-mode');
877
- document.querySelector<HTMLDivElement>('#demo-container')!.dataset.bsTheme = 'light';
878
- }
879
- }
880
-
881
- mockProducts() {
882
- return [
883
- {
884
- id: 0,
885
- itemName: 'Sleek Metal Computer',
886
- itemNameTranslated: 'some fantastic sleek metal computer description',
887
- listPrice: 2100.23,
888
- itemTypeName: 'I',
889
- image: 'http://i.stack.imgur.com/pC1Tv.jpg',
890
- icon: this.getRandomIcon(0),
891
- },
892
- {
893
- id: 1,
894
- itemName: 'Tasty Granite Table',
895
- itemNameTranslated: 'an extremely huge and heavy table',
896
- listPrice: 3200.12,
897
- itemTypeName: 'I',
898
- image: 'https://i.imgur.com/Fnm7j6h.jpg',
899
- icon: this.getRandomIcon(1),
900
- },
901
- {
902
- id: 2,
903
- itemName: 'Awesome Wooden Mouse',
904
- itemNameTranslated: 'super old mouse',
905
- listPrice: 15.0,
906
- itemTypeName: 'I',
907
- image: 'https://i.imgur.com/RaVJuLr.jpg',
908
- icon: this.getRandomIcon(2),
909
- },
910
- {
911
- id: 3,
912
- itemName: 'Gorgeous Fresh Shirt',
913
- itemNameTranslated: 'what a gorgeous shirt seriously',
914
- listPrice: 25.76,
915
- itemTypeName: 'I',
916
- image: 'http://i.stack.imgur.com/pC1Tv.jpg',
917
- icon: this.getRandomIcon(3),
918
- },
919
- {
920
- id: 4,
921
- itemName: 'Refined Cotton Table',
922
- itemNameTranslated: 'super light table that will fall apart amazingly fast',
923
- listPrice: 13.35,
924
- itemTypeName: 'I',
925
- image: 'https://i.imgur.com/Fnm7j6h.jpg',
926
- icon: this.getRandomIcon(4),
927
- },
928
- {
929
- id: 5,
930
- itemName: 'Intelligent Wooden Pizza',
931
- itemNameTranslated: 'wood not included',
932
- listPrice: 23.33,
933
- itemTypeName: 'I',
934
- image: 'https://i.imgur.com/RaVJuLr.jpg',
935
- icon: this.getRandomIcon(5),
936
- },
937
- {
938
- id: 6,
939
- itemName: 'Licensed Cotton Chips',
940
- itemNameTranslated: 'not sure what that is',
941
- listPrice: 71.21,
942
- itemTypeName: 'I',
943
- image: 'http://i.stack.imgur.com/pC1Tv.jpg',
944
- icon: this.getRandomIcon(6),
945
- },
946
- {
947
- id: 7,
948
- itemName: 'Ergonomic Rubber Soap',
949
- itemNameTranslated: `so good you'll want to use it every night`,
950
- listPrice: 2.43,
951
- itemTypeName: 'I',
952
- image: 'https://i.imgur.com/Fnm7j6h.jpg',
953
- icon: this.getRandomIcon(7),
954
- },
955
- {
956
- id: 8,
957
- itemName: 'Handcrafted Steel Car',
958
- itemNameTranslated: `aka tesla truck`,
959
- listPrice: 31288.39,
960
- itemTypeName: 'I',
961
- image: 'https://i.imgur.com/RaVJuLr.jpg',
962
- icon: this.getRandomIcon(8),
963
- },
964
- ];
965
- }
966
-
967
- /** List of icons that are supported in this lib Material Design Icons */
968
- getRandomIcon(iconIndex?: number) {
969
- const icons = [
970
- 'mdi-arrow-collapse',
971
- 'mdi-arrow-expand',
972
- 'mdi-cancel',
973
- 'mdi-check',
974
- 'mdi-checkbox-blank-outline',
975
- 'mdi-check-box-outline',
976
- 'mdi-checkbox-marked',
977
- 'mdi-close',
978
- 'mdi-close-circle',
979
- 'mdi-close-circle-outline',
980
- 'mdi-close-thick',
981
- 'mdi-content-copy',
982
- 'mdi-database-refresh',
983
- 'mdi-download',
984
- 'mdi-file-document-outline',
985
- 'mdi-file-excel-outline',
986
- 'mdi-file-music-outline',
987
- 'mdi-file-pdf-outline',
988
- 'mdi-filter-remove-outline',
989
- 'mdi-flip-vertical',
990
- 'mdi-folder',
991
- 'mdi-folder-open',
992
- 'mdi-help-circle',
993
- 'mdi-help-circle-outline',
994
- 'mdi-history',
995
- 'mdi-information',
996
- 'mdi-information-outline',
997
- 'mdi-link',
998
- 'mdi-link-variant',
999
- 'mdi-menu',
1000
- 'mdi-microsoft-excel',
1001
- 'mdi-minus',
1002
- 'mdi-page-first',
1003
- 'mdi-page-last',
1004
- 'mdi-paperclip',
1005
- 'mdi-pin-off-outline',
1006
- 'mdi-pin-outline',
1007
- 'mdi-playlist-plus',
1008
- 'mdi-playlist-remove',
1009
- 'mdi-plus',
1010
- 'mdi-redo',
1011
- 'mdi-refresh',
1012
- 'mdi-shape-square-plus',
1013
- 'mdi-sort-ascending',
1014
- 'mdi-sort-descending',
1015
- 'mdi-swap-horizontal',
1016
- 'mdi-swap-vertical',
1017
- 'mdi-sync',
1018
- 'mdi-table-edit',
1019
- 'mdi-table-refresh',
1020
- 'mdi-undo',
1021
- ];
1022
- const randomNumber = Math.floor(Math.random() * icons.length - 1);
1023
- return icons[iconIndex ?? randomNumber];
1024
- }
1025
-
1026
- renderItemCallbackWith2Rows(item: any): string {
1027
- return `<div class="autocomplete-container-list">
1028
- <div class="autocomplete-left">
1029
- <!--<img src="http://i.stack.imgur.com/pC1Tv.jpg" width="50" />-->
1030
- <span class="fa ${item.icon}"></span>
1031
- </div>
1032
- <div>
1033
- <span class="autocomplete-top-left">
1034
- <span class="fa ${item.itemTypeName === 'I' ? 'mdi-information-outline' : 'mdi-content-copy'}"></span>
1035
- ${item.itemName}
1036
- </span>
1037
- <div>
1038
- </div>
1039
- <div>
1040
- <div class="autocomplete-bottom-left">${item.itemNameTranslated}</div>
1041
- </div>`;
1042
- }
1043
-
1044
- renderItemCallbackWith4Corners(item: any): string {
1045
- return `<div class="autocomplete-container-list">
1046
- <div class="autocomplete-left">
1047
- <!--<img src="http://i.stack.imgur.com/pC1Tv.jpg" width="50" />-->
1048
- <span class="fa ${item.icon}"></span>
1049
- </div>
1050
- <div>
1051
- <span class="autocomplete-top-left">
1052
- <span class="fa ${item.itemTypeName === 'I' ? 'mdi-information-outline' : 'mdi-content-copy'}"></span>
1053
- ${item.itemName}
1054
- </span>
1055
- <span class="autocomplete-top-right">${formatNumber(item.listPrice, 2, 2, false, '$')}</span>
1056
- <div>
1057
- </div>
1058
- <div>
1059
- <div class="autocomplete-bottom-left">${item.itemNameTranslated}</div>
1060
- <span class="autocomplete-bottom-right">Type: <b>${item.itemTypeName === 'I' ? 'Item' : item.itemTypeName === 'C' ? 'PdCat' : 'Cat'}</b></span>
1061
- </div>`;
1062
- }
1063
-
1064
- toggleSubTitle() {
1065
- this.hideSubTitle = !this.hideSubTitle;
1066
- const action = this.hideSubTitle ? 'add' : 'remove';
1067
- document.querySelector('.subtitle')?.classList[action]('hidden');
1068
- this.angularGrid.resizerService.resizeGrid(2);
1069
- }
1070
- }