angular-slickgrid 4.2.0 → 4.2.3

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 (415) hide show
  1. package/LICENSE +20 -20
  2. package/{dist/app → app}/modules/angular-slickgrid/components/angular-slickgrid.component.d.ts +2 -2
  3. package/{dist/app → app}/modules/angular-slickgrid/constants.d.ts +0 -0
  4. package/{dist/app → app}/modules/angular-slickgrid/extensions/index.d.ts +0 -0
  5. package/{dist/app → app}/modules/angular-slickgrid/extensions/slickRowDetailView.d.ts +0 -2
  6. package/{dist/app → app}/modules/angular-slickgrid/global-grid-options.d.ts +0 -0
  7. package/{dist/app → app}/modules/angular-slickgrid/index.d.ts +0 -0
  8. package/{dist/app → app}/modules/angular-slickgrid/models/angularComponentOutput.interface.d.ts +0 -0
  9. package/{dist/app → app}/modules/angular-slickgrid/models/angularGridInstance.interface.d.ts +0 -0
  10. package/{dist/app → app}/modules/angular-slickgrid/models/externalTestingDependencies.interface.d.ts +0 -0
  11. package/{dist/app → app}/modules/angular-slickgrid/models/gridOption.interface.d.ts +0 -0
  12. package/{dist/app → app}/modules/angular-slickgrid/models/index.d.ts +0 -0
  13. package/{dist/app → app}/modules/angular-slickgrid/models/rowDetailView.interface.d.ts +0 -0
  14. package/{dist/app → app}/modules/angular-slickgrid/models/slickGrid.interface.d.ts +0 -0
  15. package/{dist/app → app}/modules/angular-slickgrid/modules/angular-slickgrid.module.d.ts +0 -0
  16. package/{dist/app → app}/modules/angular-slickgrid/services/angularUtil.service.d.ts +0 -0
  17. package/{dist/app → app}/modules/angular-slickgrid/services/bsDropdown.service.d.ts +0 -0
  18. package/{dist/app → app}/modules/angular-slickgrid/services/container.service.d.ts +1 -0
  19. package/{dist/app → app}/modules/angular-slickgrid/services/index.d.ts +0 -0
  20. package/{dist/app → app}/modules/angular-slickgrid/services/translater.service.d.ts +0 -0
  21. package/{dist/app → app}/modules/angular-slickgrid/services/utilities.d.ts +0 -0
  22. package/{dist/app → app}/modules/angular-slickgrid/slickgrid-config.d.ts +0 -0
  23. package/docs/assets/lib/multiple-select/README.md +17 -0
  24. package/{dist/esm2020 → esm2020}/angular-slickgrid.mjs +0 -0
  25. package/esm2020/app/modules/angular-slickgrid/components/angular-slickgrid.component.mjs +1170 -0
  26. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/constants.mjs +1 -1
  27. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/extensions/index.mjs +1 -1
  28. package/esm2020/app/modules/angular-slickgrid/extensions/slickRowDetailView.mjs +298 -0
  29. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/global-grid-options.mjs +1 -1
  30. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/index.mjs +1 -1
  31. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/models/angularComponentOutput.interface.mjs +1 -1
  32. package/esm2020/app/modules/angular-slickgrid/models/angularGridInstance.interface.mjs +2 -0
  33. package/esm2020/app/modules/angular-slickgrid/models/externalTestingDependencies.interface.mjs +2 -0
  34. package/esm2020/app/modules/angular-slickgrid/models/gridOption.interface.mjs +2 -0
  35. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/models/index.mjs +1 -1
  36. package/esm2020/app/modules/angular-slickgrid/models/rowDetailView.interface.mjs +2 -0
  37. package/esm2020/app/modules/angular-slickgrid/models/slickGrid.interface.mjs +2 -0
  38. package/esm2020/app/modules/angular-slickgrid/modules/angular-slickgrid.module.mjs +43 -0
  39. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/services/angularUtil.service.mjs +4 -4
  40. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/services/bsDropdown.service.mjs +4 -4
  41. package/esm2020/app/modules/angular-slickgrid/services/container.service.mjs +29 -0
  42. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/services/index.mjs +1 -1
  43. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/services/translater.service.mjs +4 -4
  44. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/services/utilities.mjs +1 -1
  45. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/slickgrid-config.mjs +1 -1
  46. package/{dist/esm2020 → esm2020}/public_api.mjs +1 -1
  47. package/{dist/fesm2015 → fesm2015}/angular-slickgrid.mjs +48 -51
  48. package/fesm2015/angular-slickgrid.mjs.map +1 -0
  49. package/{dist/fesm2020 → fesm2020}/angular-slickgrid.mjs +48 -51
  50. package/fesm2020/angular-slickgrid.mjs.map +1 -0
  51. package/{dist/i18n → i18n}/en.json +89 -89
  52. package/{dist/i18n → i18n}/fr.json +90 -90
  53. package/{dist/angular-slickgrid.d.ts → index.d.ts} +0 -0
  54. package/package.json +33 -118
  55. package/{dist/public_api.d.ts → public_api.d.ts} +0 -0
  56. package/test/cypress/node_modules/@cypress/request/README.md +1038 -0
  57. package/test/cypress/node_modules/@cypress/xvfb/README.md +48 -0
  58. package/test/cypress/node_modules/@cypress/xvfb/node_modules/debug/README.md +437 -0
  59. package/test/cypress/node_modules/@types/node/README.md +16 -0
  60. package/test/cypress/node_modules/@types/sinonjs__fake-timers/README.md +16 -0
  61. package/test/cypress/node_modules/@types/sizzle/README.md +16 -0
  62. package/test/cypress/node_modules/@types/yauzl/README.md +16 -0
  63. package/test/cypress/node_modules/@types/yauzl/node_modules/@types/node/README.md +16 -0
  64. package/test/cypress/node_modules/aggregate-error/README.md +61 -0
  65. package/test/cypress/node_modules/ansi-colors/README.md +315 -0
  66. package/test/cypress/node_modules/ansi-escapes/README.md +245 -0
  67. package/test/cypress/node_modules/ansi-regex/README.md +78 -0
  68. package/test/cypress/node_modules/ansi-styles/README.md +152 -0
  69. package/test/cypress/node_modules/arch/README.md +71 -0
  70. package/test/cypress/node_modules/asn1/README.md +50 -0
  71. package/test/cypress/node_modules/assert-plus/README.md +162 -0
  72. package/test/cypress/node_modules/astral-regex/README.md +46 -0
  73. package/test/cypress/node_modules/async/README.md +60 -0
  74. package/test/cypress/node_modules/asynckit/README.md +233 -0
  75. package/test/cypress/node_modules/at-least-node/README.md +25 -0
  76. package/test/cypress/node_modules/aws-sign2/README.md +4 -0
  77. package/test/cypress/node_modules/aws4/README.md +183 -0
  78. package/test/cypress/node_modules/balanced-match/README.md +91 -0
  79. package/test/cypress/node_modules/base64-js/README.md +34 -0
  80. package/test/cypress/node_modules/bcrypt-pbkdf/README.md +45 -0
  81. package/test/cypress/node_modules/blob-util/README.md +623 -0
  82. package/test/cypress/node_modules/bluebird/README.md +57 -0
  83. package/test/cypress/node_modules/brace-expansion/README.md +129 -0
  84. package/test/cypress/node_modules/buffer/README.md +410 -0
  85. package/test/cypress/node_modules/buffer-crc32/README.md +47 -0
  86. package/test/cypress/node_modules/cachedir/README.md +27 -0
  87. package/test/cypress/node_modules/caseless/README.md +45 -0
  88. package/test/cypress/node_modules/chalk/README.md +293 -0
  89. package/test/cypress/node_modules/chalk/node_modules/supports-color/README.md +76 -0
  90. package/test/cypress/node_modules/check-more-types/README.md +952 -0
  91. package/test/cypress/node_modules/ci-info/README.md +114 -0
  92. package/test/cypress/node_modules/clean-stack/README.md +76 -0
  93. package/test/cypress/node_modules/cli-cursor/README.md +55 -0
  94. package/test/cypress/node_modules/cli-table3/README.md +218 -0
  95. package/test/cypress/node_modules/cli-truncate/README.md +139 -0
  96. package/test/cypress/node_modules/color-convert/README.md +68 -0
  97. package/test/cypress/node_modules/color-name/README.md +11 -0
  98. package/test/cypress/node_modules/colorette/README.md +102 -0
  99. package/test/cypress/node_modules/colors/README.md +221 -0
  100. package/test/cypress/node_modules/combined-stream/README.md +138 -0
  101. package/test/cypress/node_modules/commander/README.md +737 -0
  102. package/test/cypress/node_modules/common-tags/README.md +687 -0
  103. package/test/cypress/node_modules/core-util-is/README.md +3 -0
  104. package/test/cypress/node_modules/cross-spawn/README.md +96 -0
  105. package/test/cypress/node_modules/cypress/README.md +25 -0
  106. package/test/cypress/node_modules/cypress/mount-utils/README.md +14 -0
  107. package/test/cypress/node_modules/cypress/react/README.md +414 -0
  108. package/test/cypress/node_modules/cypress/vue/README.md +678 -0
  109. package/test/cypress/node_modules/cypress/vue2/README.md +693 -0
  110. package/test/cypress/node_modules/dashdash/README.md +574 -0
  111. package/test/cypress/node_modules/dayjs/README.md +128 -0
  112. package/test/cypress/node_modules/debug/README.md +455 -0
  113. package/test/cypress/node_modules/delayed-stream/README.md +141 -0
  114. package/test/cypress/node_modules/ecc-jsbn/README.md +8 -0
  115. package/test/cypress/node_modules/emoji-regex/README.md +73 -0
  116. package/test/cypress/node_modules/end-of-stream/README.md +54 -0
  117. package/test/cypress/node_modules/enquirer/README.md +1752 -0
  118. package/test/cypress/node_modules/escape-string-regexp/README.md +27 -0
  119. package/test/cypress/node_modules/eventemitter2/README.md +809 -0
  120. package/test/cypress/node_modules/execa/README.md +656 -0
  121. package/test/cypress/node_modules/executable/README.md +64 -0
  122. package/test/cypress/node_modules/extend/README.md +81 -0
  123. package/test/cypress/node_modules/extract-zip/README.md +57 -0
  124. package/test/cypress/node_modules/extract-zip/node_modules/debug/README.md +455 -0
  125. package/test/cypress/node_modules/extsprintf/README.md +46 -0
  126. package/test/cypress/node_modules/fd-slicer/README.md +199 -0
  127. package/test/cypress/node_modules/figures/README.md +139 -0
  128. package/test/cypress/node_modules/forever-agent/README.md +4 -0
  129. package/test/cypress/node_modules/form-data/README.md +234 -0
  130. package/test/cypress/node_modules/fs-extra/README.md +264 -0
  131. package/test/cypress/node_modules/fs.realpath/README.md +33 -0
  132. package/test/cypress/node_modules/get-stream/README.md +124 -0
  133. package/test/cypress/node_modules/getos/README.md +79 -0
  134. package/test/cypress/node_modules/getpass/README.md +32 -0
  135. package/test/cypress/node_modules/glob/README.md +375 -0
  136. package/test/cypress/node_modules/global-dirs/README.md +72 -0
  137. package/test/cypress/node_modules/graceful-fs/README.md +133 -0
  138. package/test/cypress/node_modules/has-flag/README.md +89 -0
  139. package/test/cypress/node_modules/http-signature/README.md +80 -0
  140. package/test/cypress/node_modules/human-signals/README.md +155 -0
  141. package/test/cypress/node_modules/ieee754/README.md +51 -0
  142. package/test/cypress/node_modules/indent-string/README.md +70 -0
  143. package/test/cypress/node_modules/inflight/README.md +37 -0
  144. package/test/cypress/node_modules/inherits/README.md +42 -0
  145. package/test/cypress/node_modules/ini/README.md +102 -0
  146. package/test/cypress/node_modules/is-ci/README.md +50 -0
  147. package/test/cypress/node_modules/is-fullwidth-code-point/README.md +39 -0
  148. package/test/cypress/node_modules/is-installed-globally/README.md +31 -0
  149. package/test/cypress/node_modules/is-path-inside/README.md +63 -0
  150. package/test/cypress/node_modules/is-stream/README.md +57 -0
  151. package/test/cypress/node_modules/is-typedarray/README.md +16 -0
  152. package/test/cypress/node_modules/isexe/README.md +51 -0
  153. package/test/cypress/node_modules/isstream/README.md +66 -0
  154. package/test/cypress/node_modules/jsbn/README.md +175 -0
  155. package/test/cypress/node_modules/json-schema/README.md +3 -0
  156. package/test/cypress/node_modules/json-stringify-safe/README.md +52 -0
  157. package/test/cypress/node_modules/jsonfile/README.md +205 -0
  158. package/test/cypress/node_modules/jsonfile/node_modules/universalify/README.md +76 -0
  159. package/test/cypress/node_modules/jsprim/README.md +287 -0
  160. package/test/cypress/node_modules/lazy-ass/README.md +269 -0
  161. package/test/cypress/node_modules/listr2/README.md +17 -0
  162. package/test/cypress/node_modules/lodash/README.md +39 -0
  163. package/test/cypress/node_modules/lodash.once/README.md +18 -0
  164. package/test/cypress/node_modules/log-symbols/README.md +51 -0
  165. package/test/cypress/node_modules/log-update/README.md +97 -0
  166. package/test/cypress/node_modules/log-update/node_modules/slice-ansi/README.md +66 -0
  167. package/test/cypress/node_modules/log-update/node_modules/wrap-ansi/README.md +97 -0
  168. package/test/cypress/node_modules/lru-cache/README.md +166 -0
  169. package/test/cypress/node_modules/merge-stream/README.md +78 -0
  170. package/test/cypress/node_modules/mime-db/README.md +102 -0
  171. package/test/cypress/node_modules/mime-types/README.md +123 -0
  172. package/test/cypress/node_modules/mimic-fn/README.md +69 -0
  173. package/test/cypress/node_modules/minimatch/README.md +209 -0
  174. package/test/cypress/node_modules/ms/README.md +60 -0
  175. package/test/cypress/node_modules/npm-run-path/README.md +115 -0
  176. package/test/cypress/node_modules/once/README.md +79 -0
  177. package/test/cypress/node_modules/onetime/README.md +94 -0
  178. package/test/cypress/node_modules/ospath/README.md +53 -0
  179. package/test/cypress/node_modules/p-map/README.md +89 -0
  180. package/test/cypress/node_modules/path-is-absolute/README.md +59 -0
  181. package/test/cypress/node_modules/path-key/README.md +61 -0
  182. package/test/cypress/node_modules/pend/README.md +41 -0
  183. package/test/cypress/node_modules/performance-now/README.md +30 -0
  184. package/test/cypress/node_modules/pify/README.md +119 -0
  185. package/test/cypress/node_modules/pretty-bytes/README.md +131 -0
  186. package/test/cypress/node_modules/proxy-from-env/README.md +131 -0
  187. package/test/cypress/node_modules/psl/README.md +215 -0
  188. package/test/cypress/node_modules/pump/README.md +65 -0
  189. package/test/cypress/node_modules/punycode/README.md +122 -0
  190. package/test/cypress/node_modules/qs/README.md +475 -0
  191. package/test/cypress/node_modules/request-progress/README.md +78 -0
  192. package/test/cypress/node_modules/restore-cursor/README.md +26 -0
  193. package/test/cypress/node_modules/rimraf/README.md +101 -0
  194. package/test/cypress/node_modules/rxjs/README.md +147 -0
  195. package/test/cypress/node_modules/rxjs/_esm2015/README.md +147 -0
  196. package/test/cypress/node_modules/rxjs/_esm5/README.md +147 -0
  197. package/test/cypress/node_modules/rxjs/src/README.md +147 -0
  198. package/test/cypress/node_modules/safe-buffer/README.md +584 -0
  199. package/test/cypress/node_modules/safer-buffer/README.md +156 -0
  200. package/test/cypress/node_modules/semver/README.md +566 -0
  201. package/test/cypress/node_modules/shebang-command/README.md +34 -0
  202. package/test/cypress/node_modules/shebang-regex/README.md +33 -0
  203. package/test/cypress/node_modules/signal-exit/README.md +39 -0
  204. package/test/cypress/node_modules/slice-ansi/README.md +72 -0
  205. package/test/cypress/node_modules/sshpk/README.md +804 -0
  206. package/test/cypress/node_modules/string-width/README.md +50 -0
  207. package/test/cypress/node_modules/strip-ansi/README.md +46 -0
  208. package/test/cypress/node_modules/strip-final-newline/README.md +30 -0
  209. package/test/cypress/node_modules/supports-color/README.md +77 -0
  210. package/test/cypress/node_modules/throttleit/README.md +32 -0
  211. package/test/cypress/node_modules/tmp/README.md +365 -0
  212. package/test/cypress/node_modules/tough-cookie/README.md +527 -0
  213. package/test/cypress/node_modules/tslib/README.md +142 -0
  214. package/test/cypress/node_modules/tunnel-agent/README.md +4 -0
  215. package/test/cypress/node_modules/tweetnacl/README.md +459 -0
  216. package/test/cypress/node_modules/type-fest/README.md +760 -0
  217. package/test/cypress/node_modules/universalify/README.md +76 -0
  218. package/test/cypress/node_modules/untildify/README.md +30 -0
  219. package/test/cypress/node_modules/uuid/README.md +505 -0
  220. package/test/cypress/node_modules/verror/README.md +528 -0
  221. package/test/cypress/node_modules/verror/node_modules/extsprintf/README.md +46 -0
  222. package/test/cypress/node_modules/which/README.md +54 -0
  223. package/test/cypress/node_modules/wrap-ansi/README.md +91 -0
  224. package/test/cypress/node_modules/wrappy/README.md +36 -0
  225. package/test/cypress/node_modules/yallist/README.md +204 -0
  226. package/test/cypress/node_modules/yauzl/README.md +658 -0
  227. package/.browserslistrc +0 -12
  228. package/.codecov.yml +0 -17
  229. package/.editorconfig +0 -18
  230. package/.eslintrc.json +0 -50
  231. package/.github/CODE_OF_CONDUCT.md +0 -76
  232. package/.github/FUNDING.yml +0 -8
  233. package/.github/ISSUE_TEMPLATE/bug_report.yml +0 -54
  234. package/.github/ISSUE_TEMPLATE/config.yml +0 -5
  235. package/.github/ISSUE_TEMPLATE/feature_request.yml +0 -44
  236. package/.github/renovate.json5 +0 -26
  237. package/.github/stale.yml +0 -7
  238. package/.github/workflows/main.yml +0 -83
  239. package/.vscode/extensions.json +0 -9
  240. package/.vscode/launch.json +0 -72
  241. package/.vscode/settings.json +0 -7
  242. package/.vscode/tasks.json +0 -77
  243. package/CHANGELOG.md +0 -1172
  244. package/angular.json +0 -148
  245. package/dist/LICENSE +0 -20
  246. package/dist/README.md +0 -182
  247. package/dist/esm2020/app/modules/angular-slickgrid/components/angular-slickgrid.component.mjs +0 -1171
  248. package/dist/esm2020/app/modules/angular-slickgrid/extensions/slickRowDetailView.mjs +0 -300
  249. package/dist/esm2020/app/modules/angular-slickgrid/models/angularGridInstance.interface.mjs +0 -2
  250. package/dist/esm2020/app/modules/angular-slickgrid/models/externalTestingDependencies.interface.mjs +0 -2
  251. package/dist/esm2020/app/modules/angular-slickgrid/models/gridOption.interface.mjs +0 -2
  252. package/dist/esm2020/app/modules/angular-slickgrid/models/rowDetailView.interface.mjs +0 -2
  253. package/dist/esm2020/app/modules/angular-slickgrid/models/slickGrid.interface.mjs +0 -2
  254. package/dist/esm2020/app/modules/angular-slickgrid/modules/angular-slickgrid.module.mjs +0 -46
  255. package/dist/esm2020/app/modules/angular-slickgrid/services/container.service.mjs +0 -26
  256. package/dist/fesm2015/angular-slickgrid.mjs.map +0 -1
  257. package/dist/fesm2020/angular-slickgrid.mjs.map +0 -1
  258. package/dist/package.json +0 -79
  259. package/global.d.ts +0 -1
  260. package/ngcc.config.js +0 -13
  261. package/screenshots/column-picker.png +0 -0
  262. package/screenshots/composite-editor.png +0 -0
  263. package/screenshots/draggable-grouping.png +0 -0
  264. package/screenshots/editors.png +0 -0
  265. package/screenshots/export-to-file.png +0 -0
  266. package/screenshots/filter_and_sort.png +0 -0
  267. package/screenshots/formatters.png +0 -0
  268. package/screenshots/frozen.png +0 -0
  269. package/screenshots/multipleSelectFilter.png +0 -0
  270. package/screenshots/pagination.png +0 -0
  271. package/screenshots/selectFilter.png +0 -0
  272. package/screenshots/singleFilter.png +0 -0
  273. package/src/app/app-routing.module.ts +0 -83
  274. package/src/app/app.component.html +0 -160
  275. package/src/app/app.component.scss +0 -65
  276. package/src/app/app.component.ts +0 -10
  277. package/src/app/app.module.ts +0 -175
  278. package/src/app/examples/custom-angularComponentEditor.ts +0 -184
  279. package/src/app/examples/custom-angularComponentFilter.ts +0 -126
  280. package/src/app/examples/custom-inputEditor.ts +0 -124
  281. package/src/app/examples/custom-inputFilter.ts +0 -142
  282. package/src/app/examples/custom-titleFormatter.component.ts +0 -8
  283. package/src/app/examples/editor-ng-select.component.ts +0 -37
  284. package/src/app/examples/filter-ng-select.component.ts +0 -32
  285. package/src/app/examples/grid-additem.component.html +0 -48
  286. package/src/app/examples/grid-additem.component.ts +0 -272
  287. package/src/app/examples/grid-angular.component.html +0 -79
  288. package/src/app/examples/grid-angular.component.scss +0 -28
  289. package/src/app/examples/grid-angular.component.ts +0 -370
  290. package/src/app/examples/grid-autoheight.component.html +0 -52
  291. package/src/app/examples/grid-autoheight.component.ts +0 -147
  292. package/src/app/examples/grid-basic.component.html +0 -29
  293. package/src/app/examples/grid-basic.component.ts +0 -82
  294. package/src/app/examples/grid-clientside.component.html +0 -51
  295. package/src/app/examples/grid-clientside.component.ts +0 -293
  296. package/src/app/examples/grid-colspan.component.html +0 -39
  297. package/src/app/examples/grid-colspan.component.scss +0 -11
  298. package/src/app/examples/grid-colspan.component.ts +0 -155
  299. package/src/app/examples/grid-composite-editor.component.html +0 -79
  300. package/src/app/examples/grid-composite-editor.component.scss +0 -19
  301. package/src/app/examples/grid-composite-editor.component.ts +0 -948
  302. package/src/app/examples/grid-contextmenu.component.html +0 -62
  303. package/src/app/examples/grid-contextmenu.component.scss +0 -44
  304. package/src/app/examples/grid-contextmenu.component.ts +0 -473
  305. package/src/app/examples/grid-custom-tooltip.component.html +0 -25
  306. package/src/app/examples/grid-custom-tooltip.component.scss +0 -77
  307. package/src/app/examples/grid-custom-tooltip.component.ts +0 -483
  308. package/src/app/examples/grid-draggrouping.component.html +0 -93
  309. package/src/app/examples/grid-draggrouping.component.ts +0 -397
  310. package/src/app/examples/grid-editor.component.html +0 -88
  311. package/src/app/examples/grid-editor.component.ts +0 -699
  312. package/src/app/examples/grid-formatter.component.html +0 -26
  313. package/src/app/examples/grid-formatter.component.ts +0 -162
  314. package/src/app/examples/grid-frozen.component.html +0 -65
  315. package/src/app/examples/grid-frozen.component.scss +0 -11
  316. package/src/app/examples/grid-frozen.component.ts +0 -303
  317. package/src/app/examples/grid-graphql-nopage.component.html +0 -33
  318. package/src/app/examples/grid-graphql-nopage.component.scss +0 -9
  319. package/src/app/examples/grid-graphql-nopage.component.ts +0 -242
  320. package/src/app/examples/grid-graphql.component.html +0 -87
  321. package/src/app/examples/grid-graphql.component.ts +0 -304
  322. package/src/app/examples/grid-grouping.component.html +0 -80
  323. package/src/app/examples/grid-grouping.component.ts +0 -313
  324. package/src/app/examples/grid-headerbutton.component.html +0 -31
  325. package/src/app/examples/grid-headerbutton.component.scss +0 -10
  326. package/src/app/examples/grid-headerbutton.component.ts +0 -233
  327. package/src/app/examples/grid-headermenu.component.html +0 -31
  328. package/src/app/examples/grid-headermenu.component.scss +0 -25
  329. package/src/app/examples/grid-headermenu.component.ts +0 -159
  330. package/src/app/examples/grid-localization.component.html +0 -54
  331. package/src/app/examples/grid-localization.component.ts +0 -293
  332. package/src/app/examples/grid-menu.component.html +0 -37
  333. package/src/app/examples/grid-menu.component.scss +0 -28
  334. package/src/app/examples/grid-menu.component.ts +0 -229
  335. package/src/app/examples/grid-odata.component.html +0 -116
  336. package/src/app/examples/grid-odata.component.ts +0 -441
  337. package/src/app/examples/grid-range.component.html +0 -74
  338. package/src/app/examples/grid-range.component.ts +0 -291
  339. package/src/app/examples/grid-remote.component.html +0 -37
  340. package/src/app/examples/grid-remote.component.ts +0 -153
  341. package/src/app/examples/grid-resize-by-content.component.html +0 -62
  342. package/src/app/examples/grid-resize-by-content.component.scss +0 -19
  343. package/src/app/examples/grid-resize-by-content.component.ts +0 -780
  344. package/src/app/examples/grid-rowdetail.component.html +0 -35
  345. package/src/app/examples/grid-rowdetail.component.ts +0 -205
  346. package/src/app/examples/grid-rowmove.component.html +0 -49
  347. package/src/app/examples/grid-rowmove.component.ts +0 -234
  348. package/src/app/examples/grid-rowselection.component.html +0 -76
  349. package/src/app/examples/grid-rowselection.component.ts +0 -267
  350. package/src/app/examples/grid-state.component.html +0 -36
  351. package/src/app/examples/grid-state.component.ts +0 -259
  352. package/src/app/examples/grid-tabs.component.html +0 -35
  353. package/src/app/examples/grid-tabs.component.ts +0 -115
  354. package/src/app/examples/grid-trading.component.html +0 -58
  355. package/src/app/examples/grid-trading.component.scss +0 -49
  356. package/src/app/examples/grid-trading.component.ts +0 -319
  357. package/src/app/examples/grid-tree-data-hierarchical.component.html +0 -79
  358. package/src/app/examples/grid-tree-data-hierarchical.component.scss +0 -47
  359. package/src/app/examples/grid-tree-data-hierarchical.component.ts +0 -311
  360. package/src/app/examples/grid-tree-data-parent-child.component.html +0 -108
  361. package/src/app/examples/grid-tree-data-parent-child.component.scss +0 -10
  362. package/src/app/examples/grid-tree-data-parent-child.component.ts +0 -351
  363. package/src/app/examples/home.component.html +0 -41
  364. package/src/app/examples/home.component.ts +0 -9
  365. package/src/app/examples/rowdetail-preload.component.ts +0 -10
  366. package/src/app/examples/rowdetail-view.component.html +0 -36
  367. package/src/app/examples/rowdetail-view.component.ts +0 -54
  368. package/src/app/examples/swt-common-grid-pagination.component.ts +0 -156
  369. package/src/app/examples/swt-common-grid-test.component.html +0 -30
  370. package/src/app/examples/swt-common-grid-test.component.ts +0 -219
  371. package/src/app/examples/swt-common-grid.component.ts +0 -436
  372. package/src/app/examples/swt-logger.service.ts +0 -165
  373. package/src/app/modules/angular-slickgrid/components/angular-slickgrid.component.html +0 -4
  374. package/src/app/modules/angular-slickgrid/components/angular-slickgrid.component.ts +0 -1395
  375. package/src/app/modules/angular-slickgrid/constants.ts +0 -97
  376. package/src/app/modules/angular-slickgrid/extensions/index.ts +0 -1
  377. package/src/app/modules/angular-slickgrid/extensions/slickRowDetailView.ts +0 -375
  378. package/src/app/modules/angular-slickgrid/global-grid-options.ts +0 -245
  379. package/src/app/modules/angular-slickgrid/index.ts +0 -11
  380. package/src/app/modules/angular-slickgrid/models/angularComponentOutput.interface.ts +0 -6
  381. package/src/app/modules/angular-slickgrid/models/angularGridInstance.interface.ts +0 -68
  382. package/src/app/modules/angular-slickgrid/models/externalTestingDependencies.interface.ts +0 -37
  383. package/src/app/modules/angular-slickgrid/models/gridOption.interface.ts +0 -12
  384. package/src/app/modules/angular-slickgrid/models/index.ts +0 -6
  385. package/src/app/modules/angular-slickgrid/models/rowDetailView.interface.ts +0 -33
  386. package/src/app/modules/angular-slickgrid/models/slickGrid.interface.ts +0 -7
  387. package/src/app/modules/angular-slickgrid/modules/angular-slickgrid.module.ts +0 -37
  388. package/src/app/modules/angular-slickgrid/services/angularUtil.service.ts +0 -48
  389. package/src/app/modules/angular-slickgrid/services/bsDropdown.service.ts +0 -142
  390. package/src/app/modules/angular-slickgrid/services/container.service.ts +0 -24
  391. package/src/app/modules/angular-slickgrid/services/index.ts +0 -5
  392. package/src/app/modules/angular-slickgrid/services/translater.service.ts +0 -38
  393. package/src/app/modules/angular-slickgrid/services/utilities.ts +0 -19
  394. package/src/app/modules/angular-slickgrid/slickgrid-config.ts +0 -10
  395. package/src/app/slickgrid-custom-variables.scss +0 -10
  396. package/src/assets/.gitkeep +0 -0
  397. package/src/assets/data/collection_100_numbers.json +0 -12
  398. package/src/assets/data/collection_500_numbers.json +0 -52
  399. package/src/assets/data/countries.json +0 -245
  400. package/src/assets/data/country_names.json +0 -245
  401. package/src/assets/data/customers_100.json +0 -102
  402. package/src/assets/i18n/en.json +0 -90
  403. package/src/assets/i18n/fr.json +0 -91
  404. package/src/environments/environment.prod.ts +0 -3
  405. package/src/environments/environment.ts +0 -8
  406. package/src/favicon.ico +0 -0
  407. package/src/index.html +0 -18
  408. package/src/main.ts +0 -13
  409. package/src/polyfills.ts +0 -52
  410. package/src/public_api.ts +0 -1
  411. package/src/styles.scss +0 -66
  412. package/src/typings.d.ts +0 -10
  413. package/tsconfig.app.json +0 -25
  414. package/tsconfig.json +0 -40
  415. package/tsconfig.spec.json +0 -23
@@ -1,1395 +0,0 @@
1
- // import 3rd party vendor libs
2
- // only import the necessary core lib, each will be imported on demand when enabled (via require)
3
- import 'jquery-ui/ui/widgets/draggable';
4
- import 'jquery-ui/ui/widgets/droppable';
5
- import 'jquery-ui/ui/widgets/sortable';
6
- import 'slickgrid/lib/jquery.event.drag-2.3.0';
7
- import 'slickgrid/lib/jquery.mousewheel';
8
- import 'slickgrid/slick.core';
9
- import 'slickgrid/slick.grid';
10
- import 'slickgrid/slick.dataview';
11
-
12
- // ...then everything else...
13
- import { AfterViewInit, ApplicationRef, ChangeDetectorRef, Component, ElementRef, Inject, Input, OnDestroy, Optional, } from '@angular/core';
14
- import { TranslateService } from '@ngx-translate/core';
15
- import { Observable } from 'rxjs';
16
-
17
- import {
18
- // interfaces/types
19
- AutoCompleteEditor,
20
- BackendServiceApi,
21
- BackendServiceOption,
22
- Column,
23
- ColumnEditor,
24
- DataViewOption,
25
- EventSubscription,
26
- ExtensionName,
27
- ExternalResource,
28
- Locale,
29
- Metrics,
30
- Pagination,
31
- SelectEditor,
32
- ServicePagination,
33
- SlickDataView,
34
- SlickEventHandler,
35
- SlickGrid,
36
- SlickNamespace,
37
-
38
- // services
39
- BackendUtilityService,
40
- CollectionService,
41
- EventNamingStyle,
42
- ExtensionService,
43
- ExtensionUtility,
44
- FilterFactory,
45
- FilterService,
46
- GridEventService,
47
- GridService,
48
- GridStateService,
49
- GroupingAndColspanService,
50
- PaginationService,
51
- ResizerService,
52
- RxJsFacade,
53
- SharedService,
54
- SlickgridConfig,
55
- SlickGroupItemMetadataProvider,
56
- SortService,
57
- TreeDataService,
58
-
59
- // utilities
60
- autoAddEditorFormatterToColumnsWithEditor,
61
- emptyElement,
62
- GridStateType,
63
- unsubscribeAll,
64
- } from '@slickgrid-universal/common';
65
- import { EventPubSubService } from '@slickgrid-universal/event-pub-sub';
66
- import { SlickEmptyWarningComponent } from '@slickgrid-universal/empty-warning-component';
67
- import { SlickFooterComponent } from '@slickgrid-universal/custom-footer-component';
68
- import { SlickPaginationComponent } from '@slickgrid-universal/pagination-component';
69
- import { RxJsResource } from '@slickgrid-universal/rxjs-observable';
70
- import { dequal } from 'dequal/lite';
71
-
72
- import { Constants } from '../constants';
73
- import { AngularGridInstance, ExternalTestingDependencies, GridOption, } from './../models/index';
74
- import { GlobalGridOptions } from './../global-grid-options';
75
- import { TranslaterService } from '../services/translater.service';
76
-
77
- // Services
78
- import { AngularUtilService } from '../services/angularUtil.service';
79
- import { SlickRowDetailView } from '../extensions/slickRowDetailView';
80
- import { ContainerService } from '../services/container.service';
81
-
82
- // using external non-typed js libraries
83
- declare const Slick: SlickNamespace;
84
-
85
- @Component({
86
- selector: 'angular-slickgrid',
87
- templateUrl: './angular-slickgrid.component.html',
88
- providers: [
89
- // make everything transient (non-singleton)
90
- AngularUtilService,
91
- ApplicationRef,
92
- TranslaterService,
93
- ]
94
- })
95
- export class AngularSlickgridComponent implements AfterViewInit, OnDestroy {
96
- private _dataset?: any[] | null;
97
- private _columnDefinitions!: Column[];
98
- private _currentDatasetLength = 0;
99
- private _eventHandler: SlickEventHandler = new Slick.EventHandler();
100
- private _eventPubSubService!: EventPubSubService;
101
- private _angularGridInstances: AngularGridInstance | undefined;
102
- private _hideHeaderRowAfterPageLoad = false;
103
- private _isGridInitialized = false;
104
- private _isDatasetInitialized = false;
105
- private _isDatasetHierarchicalInitialized = false;
106
- private _isPaginationInitialized = false;
107
- private _isLocalGrid = true;
108
- private _paginationOptions: Pagination | undefined;
109
- private _registeredResources: ExternalResource[] = [];
110
- dataView!: SlickDataView;
111
- slickGrid!: SlickGrid;
112
- groupingDefinition: any = {};
113
- groupItemMetadataProvider?: SlickGroupItemMetadataProvider;
114
- backendServiceApi?: BackendServiceApi;
115
- locales!: Locale;
116
- metrics?: Metrics;
117
- showPagination = false;
118
- serviceList: any[] = [];
119
- totalItems = 0;
120
- paginationData?: {
121
- gridOptions: GridOption;
122
- paginationService: PaginationService;
123
- };
124
- subscriptions: EventSubscription[] = [];
125
-
126
- // components / plugins
127
- slickEmptyWarning?: SlickEmptyWarningComponent;
128
- slickFooter?: SlickFooterComponent;
129
- slickPagination?: SlickPaginationComponent;
130
- slickRowDetailView?: SlickRowDetailView;
131
-
132
- // services
133
- backendUtilityService!: BackendUtilityService;
134
- collectionService: CollectionService;
135
- extensionService: ExtensionService;
136
- extensionUtility: ExtensionUtility;
137
- filterFactory!: FilterFactory;
138
- filterService: FilterService;
139
- gridEventService: GridEventService;
140
- gridService: GridService;
141
- gridStateService: GridStateService;
142
- groupingService: GroupingAndColspanService;
143
- paginationService: PaginationService;
144
- resizerService!: ResizerService;
145
- rxjs?: RxJsFacade;
146
- sharedService: SharedService;
147
- sortService: SortService;
148
- treeDataService: TreeDataService;
149
-
150
- @Input() customDataView: any;
151
- @Input() gridId: string = '';
152
- @Input() gridOptions!: GridOption;
153
-
154
- @Input()
155
- get paginationOptions(): Pagination | undefined {
156
- return this._paginationOptions;
157
- }
158
- set paginationOptions(newPaginationOptions: Pagination | undefined) {
159
- if (newPaginationOptions && this._paginationOptions) {
160
- this._paginationOptions = { ...this.gridOptions.pagination, ...this._paginationOptions, ...newPaginationOptions };
161
- } else {
162
- this._paginationOptions = newPaginationOptions;
163
- }
164
- this.gridOptions.pagination = this._paginationOptions ?? this.gridOptions.pagination;
165
- this.paginationService.updateTotalItems(this.gridOptions.pagination?.totalItems ?? 0, true);
166
- }
167
-
168
- @Input()
169
- set columnDefinitions(columnDefinitions: Column[]) {
170
- this._columnDefinitions = columnDefinitions;
171
- if (this._isGridInitialized) {
172
- this.updateColumnDefinitionsList(columnDefinitions);
173
- }
174
- if (columnDefinitions.length > 0) {
175
- this.copyColumnWidthsReference(columnDefinitions);
176
- }
177
- }
178
- get columnDefinitions(): Column[] {
179
- return this._columnDefinitions;
180
- }
181
-
182
- @Input()
183
- get dataset(): any[] {
184
- return (this.customDataView ? this.slickGrid?.getData?.() : this.dataView?.getItems?.()) || [];
185
- }
186
- set dataset(newDataset: any[]) {
187
- const prevDatasetLn = this._currentDatasetLength;
188
- const isDatasetEqual = dequal(newDataset, this._dataset || []);
189
- let data = newDataset;
190
-
191
- // when Tree Data is enabled and we don't yet have the hierarchical dataset filled, we can force a convert+sort of the array
192
- if (this.slickGrid && this.gridOptions?.enableTreeData && Array.isArray(newDataset) && (newDataset.length > 0 || newDataset.length !== prevDatasetLn || !isDatasetEqual)) {
193
- this._isDatasetHierarchicalInitialized = false;
194
- data = this.sortTreeDataset(newDataset, !isDatasetEqual); // if dataset changed, then force a refresh anyway
195
- }
196
- this._dataset = data;
197
- this.refreshGridData(data || []);
198
- this._currentDatasetLength = (newDataset || []).length;
199
-
200
- // expand/autofit columns on first page load
201
- // we can assume that if the prevDataset was empty then we are on first load
202
- if (this.gridOptions?.autoFitColumnsOnFirstLoad && prevDatasetLn === 0) {
203
- this.slickGrid.autosizeColumns();
204
- }
205
- }
206
-
207
- @Input()
208
- get datasetHierarchical(): any[] | undefined {
209
- return this.sharedService.hierarchicalDataset;
210
- }
211
- set datasetHierarchical(newHierarchicalDataset: any[] | undefined) {
212
- const isDatasetEqual = dequal(newHierarchicalDataset, this.sharedService?.hierarchicalDataset ?? []);
213
- const prevFlatDatasetLn = this._currentDatasetLength;
214
- this.sharedService.hierarchicalDataset = newHierarchicalDataset;
215
-
216
- if (newHierarchicalDataset && this.columnDefinitions && this.filterService?.clearFilters) {
217
- this.filterService.clearFilters();
218
- }
219
-
220
- // when a hierarchical dataset is set afterward, we can reset the flat dataset and call a tree data sort that will overwrite the flat dataset
221
- if (newHierarchicalDataset && this.slickGrid && this.sortService?.processTreeDataInitialSort) {
222
- this.dataView.setItems([], this.gridOptions.datasetIdPropertyName ?? 'id');
223
- this.sortService.processTreeDataInitialSort();
224
-
225
- // we also need to reset/refresh the Tree Data filters because if we inserted new item(s) then it might not show up without doing this refresh
226
- // however we need 1 cpu cycle before having the DataView refreshed, so we need to wrap this check in a setTimeout
227
- setTimeout(() => {
228
- const flatDatasetLn = this.dataView.getItemCount();
229
- if (flatDatasetLn > 0 && (flatDatasetLn !== prevFlatDatasetLn || !isDatasetEqual)) {
230
- this.filterService.refreshTreeDataFilters();
231
- }
232
- });
233
- this._isDatasetHierarchicalInitialized = true;
234
- }
235
- }
236
-
237
- get elementRef(): ElementRef {
238
- return this.elm;
239
- }
240
-
241
- get eventHandler(): SlickEventHandler {
242
- return this._eventHandler;
243
- }
244
-
245
- get gridContainerElement(): HTMLElement | null {
246
- return document.querySelector(`#${this.gridOptions.gridContainerId || ''}`);
247
- }
248
-
249
- /** GETTER to know if dataset was initialized or not */
250
- get isDatasetInitialized(): boolean {
251
- return this._isDatasetInitialized;
252
- }
253
- /** SETTER to change if dataset was initialized or not (stringly used for unit testing purposes) */
254
- set isDatasetInitialized(isInitialized: boolean) {
255
- this._isDatasetInitialized = isInitialized;
256
- }
257
- set isDatasetHierarchicalInitialized(isInitialized: boolean) {
258
- this._isDatasetHierarchicalInitialized = isInitialized;
259
- }
260
-
261
- get registeredResources(): ExternalResource[] {
262
- return this._registeredResources;
263
- }
264
-
265
- constructor(
266
- private readonly angularUtilService: AngularUtilService,
267
- private readonly appRef: ApplicationRef,
268
- private readonly cd: ChangeDetectorRef,
269
- private readonly containerService: ContainerService,
270
- private readonly elm: ElementRef,
271
- @Optional() private readonly translate: TranslateService,
272
- @Optional() private readonly translaterService: TranslaterService,
273
- @Inject('config') private forRootConfig: GridOption,
274
- @Inject('externalService') externalServices: ExternalTestingDependencies
275
- ) {
276
- const slickgridConfig = new SlickgridConfig();
277
-
278
- // initialize and assign all Service Dependencies
279
- this._eventPubSubService = externalServices?.eventPubSubService ?? new EventPubSubService(this.elm.nativeElement);
280
- this._eventPubSubService.eventNamingStyle = EventNamingStyle.camelCase;
281
-
282
- this.backendUtilityService = externalServices?.backendUtilityService ?? new BackendUtilityService();
283
- this.gridEventService = externalServices?.gridEventService ?? new GridEventService();
284
- this.sharedService = externalServices?.sharedService ?? new SharedService();
285
- this.collectionService = externalServices?.collectionService ?? new CollectionService(this.translaterService);
286
- this.extensionUtility = externalServices?.extensionUtility ?? new ExtensionUtility(this.sharedService, this.backendUtilityService, this.translaterService);
287
- this.filterFactory = new FilterFactory(slickgridConfig, this.translaterService, this.collectionService);
288
- this.filterService = externalServices?.filterService ?? new FilterService(this.filterFactory as any, this._eventPubSubService, this.sharedService, this.backendUtilityService);
289
- this.resizerService = externalServices?.resizerService ?? new ResizerService(this._eventPubSubService);
290
- this.sortService = externalServices?.sortService ?? new SortService(this.sharedService, this._eventPubSubService, this.backendUtilityService);
291
- this.treeDataService = externalServices?.treeDataService ?? new TreeDataService(this._eventPubSubService, this.sharedService, this.sortService);
292
- this.paginationService = externalServices?.paginationService ?? new PaginationService(this._eventPubSubService, this.sharedService, this.backendUtilityService);
293
-
294
- this.extensionService = externalServices?.extensionService ?? new ExtensionService(
295
- this.extensionUtility,
296
- this.filterService,
297
- this._eventPubSubService,
298
- this.sharedService,
299
- this.sortService,
300
- this.treeDataService,
301
- this.translaterService,
302
- );
303
-
304
- this.gridStateService = externalServices?.gridStateService ?? new GridStateService(this.extensionService, this.filterService, this._eventPubSubService, this.sharedService, this.sortService, this.treeDataService);
305
- this.gridService = externalServices?.gridService ?? new GridService(this.gridStateService, this.filterService, this._eventPubSubService, this.paginationService, this.sharedService, this.sortService, this.treeDataService);
306
- this.groupingService = externalServices?.groupingAndColspanService ?? new GroupingAndColspanService(this.extensionUtility, this._eventPubSubService);
307
-
308
- this.serviceList = [
309
- this.extensionService,
310
- this.filterService,
311
- this.gridEventService,
312
- this.gridService,
313
- this.gridStateService,
314
- this.groupingService,
315
- this.paginationService,
316
- this.resizerService,
317
- this.sortService,
318
- this.treeDataService,
319
- ];
320
-
321
- // register all Service instances in the container
322
- this.containerService.registerInstance('ExtensionUtility', this.extensionUtility);
323
- this.containerService.registerInstance('FilterService', this.filterService);
324
- this.containerService.registerInstance('CollectionService', this.collectionService);
325
- this.containerService.registerInstance('ExtensionService', this.extensionService);
326
- this.containerService.registerInstance('GridEventService', this.gridEventService);
327
- this.containerService.registerInstance('GridService', this.gridService);
328
- this.containerService.registerInstance('GridStateService', this.gridStateService);
329
- this.containerService.registerInstance('GroupingAndColspanService', this.groupingService);
330
- this.containerService.registerInstance('PaginationService', this.paginationService);
331
- this.containerService.registerInstance('ResizerService', this.resizerService);
332
- this.containerService.registerInstance('SharedService', this.sharedService);
333
- this.containerService.registerInstance('SortService', this.sortService);
334
- this.containerService.registerInstance('EventPubSubService', this._eventPubSubService);
335
- this.containerService.registerInstance('PubSubService', this._eventPubSubService);
336
- this.containerService.registerInstance('TranslaterService', this.translaterService);
337
- this.containerService.registerInstance('TreeDataService', this.treeDataService);
338
- }
339
-
340
- ngAfterViewInit() {
341
- if (!this.gridOptions || !this.columnDefinitions) {
342
- throw new Error('Using `<angular-slickgrid>` requires [gridOptions] and [columnDefinitions], it seems that you might have forgot to provide them since at least of them is undefined.');
343
- }
344
- this.initialization(this._eventHandler);
345
- this._isGridInitialized = true;
346
-
347
- // recheck the empty warning message after grid is shown so that it works in every use case
348
- if (this.gridOptions && this.gridOptions.enableEmptyDataWarningMessage && Array.isArray(this.dataset)) {
349
- const finalTotalCount = this.dataset.length;
350
- this.displayEmptyDataWarning(finalTotalCount < 1);
351
- }
352
- }
353
-
354
- ngOnDestroy(): void {
355
- this._eventPubSubService.publish('onBeforeGridDestroy', this.slickGrid);
356
- this.destroy();
357
- this._eventPubSubService.publish('onAfterGridDestroyed', true);
358
- }
359
-
360
- destroy(shouldEmptyDomElementContainer = false) {
361
- // dispose of all Services
362
- this.serviceList.forEach((service: any) => {
363
- if (service && service.dispose) {
364
- service.dispose();
365
- }
366
- });
367
- this.serviceList = [];
368
-
369
- // dispose all registered external resources
370
- if (Array.isArray(this._registeredResources)) {
371
- while (this._registeredResources.length > 0) {
372
- const resource = this._registeredResources.pop();
373
- if (resource?.dispose) {
374
- resource.dispose();
375
- }
376
- }
377
- this._registeredResources = [];
378
- }
379
-
380
- // dispose the Components
381
- this.slickEmptyWarning?.dispose();
382
- this.slickFooter?.dispose();
383
- this.slickPagination?.dispose();
384
-
385
- if (this._eventHandler?.unsubscribeAll) {
386
- this._eventHandler.unsubscribeAll();
387
- }
388
- this._eventPubSubService?.unsubscribeAll();
389
- if (this.dataView) {
390
- if (this.dataView?.setItems) {
391
- this.dataView.setItems([]);
392
- }
393
- if (this.dataView.destroy) {
394
- this.dataView.destroy();
395
- }
396
- }
397
- if (this.slickGrid?.destroy) {
398
- this.slickGrid.destroy(shouldEmptyDomElementContainer);
399
- }
400
-
401
- if (this.backendServiceApi) {
402
- for (const prop of Object.keys(this.backendServiceApi)) {
403
- delete this.backendServiceApi[prop as keyof BackendServiceApi];
404
- }
405
- this.backendServiceApi = undefined;
406
- }
407
- for (const prop of Object.keys(this.columnDefinitions)) {
408
- (this.columnDefinitions as any)[prop] = null;
409
- }
410
- for (const prop of Object.keys(this.sharedService)) {
411
- (this.sharedService as any)[prop] = null;
412
- }
413
-
414
- // we could optionally also empty the content of the grid container DOM element
415
- if (shouldEmptyDomElementContainer) {
416
- this.emptyGridContainerElm();
417
- }
418
-
419
- // also unsubscribe all RxJS subscriptions
420
- this.subscriptions = unsubscribeAll(this.subscriptions);
421
-
422
- this._dataset = null;
423
- this.datasetHierarchical = undefined;
424
- this._columnDefinitions = [];
425
- this._angularGridInstances = undefined;
426
- }
427
-
428
- emptyGridContainerElm() {
429
- const gridContainerId = this.gridOptions?.gridContainerId ?? 'grid1';
430
- const gridContainerElm = document.querySelector(`#${gridContainerId}`);
431
- emptyElement(gridContainerElm);
432
- }
433
-
434
- /**
435
- * Define our internal Post Process callback, it will execute internally after we get back result from the Process backend call
436
- * For now, this is GraphQL Service ONLY feature and it will basically refresh the Dataset & Pagination without having the user to create his own PostProcess every time
437
- */
438
- createBackendApiInternalPostProcessCallback(gridOptions: GridOption) {
439
- const backendApi = gridOptions && gridOptions.backendServiceApi;
440
- if (backendApi && backendApi.service) {
441
- const backendApiService = backendApi.service;
442
-
443
- // internalPostProcess only works (for now) with a GraphQL Service, so make sure it is of that type
444
- if (typeof backendApiService.getDatasetName === 'function') {
445
- backendApi.internalPostProcess = (processResult: any) => {
446
- const datasetName = (backendApi && backendApiService && typeof backendApiService.getDatasetName === 'function') ? backendApiService.getDatasetName() : '';
447
- if (processResult?.data[datasetName]) {
448
- const data = processResult.data[datasetName].hasOwnProperty('nodes') ? (processResult as any).data[datasetName].nodes : (processResult as any).data[datasetName];
449
- const totalCount = processResult.data[datasetName].hasOwnProperty('totalCount') ? (processResult as any).data[datasetName].totalCount : (processResult as any).data[datasetName].length;
450
- this.refreshGridData(data, totalCount || 0);
451
- }
452
- };
453
- }
454
- }
455
- }
456
-
457
- initialization(eventHandler: SlickEventHandler) {
458
- this.gridOptions.translater = this.translaterService;
459
- this._eventHandler = eventHandler;
460
-
461
- // when detecting a frozen grid, we'll automatically enable the mousewheel scroll handler so that we can scroll from both left/right frozen containers
462
- if (this.gridOptions && ((this.gridOptions.frozenRow !== undefined && this.gridOptions.frozenRow >= 0) || this.gridOptions.frozenColumn !== undefined && this.gridOptions.frozenColumn >= 0) && this.gridOptions.enableMouseWheelScrollHandler === undefined) {
463
- this.gridOptions.enableMouseWheelScrollHandler = true;
464
- }
465
-
466
- this._eventPubSubService.eventNamingStyle = this.gridOptions?.eventNamingStyle ?? EventNamingStyle.camelCase;
467
- this._eventPubSubService.publish('onBeforeGridCreate', true);
468
-
469
- // make sure the dataset is initialized (if not it will throw an error that it cannot getLength of null)
470
- this._dataset = this._dataset || [];
471
- this.gridOptions = this.mergeGridOptions(this.gridOptions);
472
- this._paginationOptions = this.gridOptions?.pagination;
473
- this.locales = this.gridOptions?.locales ?? Constants.locales;
474
- this.backendServiceApi = this.gridOptions?.backendServiceApi;
475
- this._isLocalGrid = !this.backendServiceApi; // considered a local grid if it doesn't have a backend service set
476
-
477
- this.createBackendApiInternalPostProcessCallback(this.gridOptions);
478
-
479
- if (!this.customDataView) {
480
- const dataviewInlineFilters = this.gridOptions.dataView && this.gridOptions.dataView.inlineFilters || false;
481
- let dataViewOptions: DataViewOption = { inlineFilters: dataviewInlineFilters };
482
-
483
- if (this.gridOptions.draggableGrouping || this.gridOptions.enableGrouping) {
484
- this.groupItemMetadataProvider = new SlickGroupItemMetadataProvider();
485
- this.sharedService.groupItemMetadataProvider = this.groupItemMetadataProvider;
486
- dataViewOptions = { ...dataViewOptions, groupItemMetadataProvider: this.groupItemMetadataProvider };
487
- }
488
- this.dataView = new Slick.Data.DataView(dataViewOptions);
489
- this._eventPubSubService.publish('onDataviewCreated', this.dataView);
490
- }
491
-
492
- // get any possible Services that user want to register which don't require SlickGrid to be instantiated
493
- // RxJS Resource is in this lot because it has to be registered before anything else and doesn't require SlickGrid to be initialized
494
- this.preRegisterResources();
495
-
496
- // for convenience to the user, we provide the property "editor" as an Angular-Slickgrid editor complex object
497
- // however "editor" is used internally by SlickGrid for it's own Editor Factory
498
- // so in our lib we will swap "editor" and copy it into a new property called "internalColumnEditor"
499
- // then take back "editor.model" and make it the new "editor" so that SlickGrid Editor Factory still works
500
- this._columnDefinitions = this.swapInternalEditorToSlickGridFactoryEditor(this._columnDefinitions);
501
-
502
- // if the user wants to automatically add a Custom Editor Formatter, we need to call the auto add function again
503
- if (this.gridOptions.autoAddCustomEditorFormatter) {
504
- autoAddEditorFormatterToColumnsWithEditor(this._columnDefinitions, this.gridOptions.autoAddCustomEditorFormatter);
505
- }
506
-
507
- // save reference for all columns before they optionally become hidden/visible
508
- this.sharedService.allColumns = this._columnDefinitions;
509
- this.sharedService.visibleColumns = this._columnDefinitions;
510
- this.extensionService.createExtensionsBeforeGridCreation(this._columnDefinitions, this.gridOptions);
511
-
512
- // if user entered some Pinning/Frozen "presets", we need to apply them in the grid options
513
- if (this.gridOptions.presets?.pinning) {
514
- this.gridOptions = { ...this.gridOptions, ...this.gridOptions.presets.pinning };
515
- }
516
-
517
- // build SlickGrid Grid, also user might optionally pass a custom dataview (e.g. remote model)
518
- this.slickGrid = new Slick.Grid(`#${this.gridId}`, this.customDataView || this.dataView, this._columnDefinitions, this.gridOptions);
519
- this.sharedService.dataView = this.dataView;
520
- this.sharedService.slickGrid = this.slickGrid;
521
- this.sharedService.gridContainerElement = this.elm.nativeElement as HTMLDivElement;
522
-
523
- this.extensionService.bindDifferentExtensions();
524
- this.bindDifferentHooks(this.slickGrid, this.gridOptions, this.dataView);
525
-
526
- // when it's a frozen grid, we need to keep the frozen column id for reference if we ever show/hide column from ColumnPicker/GridMenu afterward
527
- const frozenColumnIndex = this.gridOptions.frozenColumn !== undefined ? this.gridOptions.frozenColumn : -1;
528
- if (frozenColumnIndex >= 0 && frozenColumnIndex <= this._columnDefinitions.length) {
529
- this.sharedService.frozenVisibleColumnId = this._columnDefinitions[frozenColumnIndex].id || '';
530
- }
531
-
532
- // get any possible Services that user want to register
533
- this.registerResources();
534
-
535
- // initialize the SlickGrid grid
536
- this.slickGrid.init();
537
-
538
- // initialized the resizer service only after SlickGrid is initialized
539
- // if we don't we end up binding our resize to a grid element that doesn't yet exist in the DOM and the resizer service will fail silently (because it has a try/catch that unbinds the resize without throwing back)
540
- if (this.gridContainerElement) {
541
- this.resizerService.init(this.slickGrid, this.gridContainerElement as HTMLDivElement);
542
- }
543
-
544
- // user could show a custom footer with the data metrics (dataset length and last updated timestamp)
545
- if (!this.gridOptions.enablePagination && this.gridOptions.showCustomFooter && this.gridOptions.customFooterOptions && this.gridContainerElement) {
546
- this.slickFooter = new SlickFooterComponent(this.slickGrid, this.gridOptions.customFooterOptions, this._eventPubSubService, this.translaterService);
547
- this.slickFooter.renderFooter(this.gridContainerElement);
548
- }
549
-
550
- if (!this.customDataView && this.dataView) {
551
- // load the data in the DataView (unless it's a hierarchical dataset, if so it will be loaded after the initial tree sort)
552
- const initialDataset = this.gridOptions?.enableTreeData ? this.sortTreeDataset(this._dataset) : this._dataset;
553
- this.dataView.beginUpdate();
554
- this.dataView.setItems(initialDataset || [], this.gridOptions.datasetIdPropertyName ?? 'id');
555
- this.dataView.endUpdate();
556
-
557
- // if you don't want the items that are not visible (due to being filtered out or being on a different page)
558
- // to stay selected, pass 'false' to the second arg
559
- const selectionModel = this.slickGrid?.getSelectionModel();
560
- if (selectionModel && this.gridOptions && this.gridOptions.dataView && this.gridOptions.dataView.hasOwnProperty('syncGridSelection')) {
561
- // if we are using a Backend Service, we will do an extra flag check, the reason is because it might have some unintended behaviors
562
- // with the BackendServiceApi because technically the data in the page changes the DataView on every page change.
563
- let preservedRowSelectionWithBackend = false;
564
- if (this.gridOptions.backendServiceApi && this.gridOptions.dataView.hasOwnProperty('syncGridSelectionWithBackendService')) {
565
- preservedRowSelectionWithBackend = this.gridOptions.dataView.syncGridSelectionWithBackendService as boolean;
566
- }
567
-
568
- const syncGridSelection = this.gridOptions.dataView.syncGridSelection;
569
- if (typeof syncGridSelection === 'boolean') {
570
- let preservedRowSelection = syncGridSelection;
571
- if (!this._isLocalGrid) {
572
- // when using BackendServiceApi, we'll be using the "syncGridSelectionWithBackendService" flag BUT "syncGridSelection" must also be set to True
573
- preservedRowSelection = syncGridSelection && preservedRowSelectionWithBackend;
574
- }
575
- this.dataView.syncGridSelection(this.slickGrid, preservedRowSelection);
576
- } else if (typeof syncGridSelection === 'object') {
577
- this.dataView.syncGridSelection(this.slickGrid, syncGridSelection.preserveHidden, syncGridSelection.preserveHiddenOnSelectionChange);
578
- }
579
- }
580
-
581
- const datasetLn = this.dataView.getLength() || this._dataset && this._dataset.length || 0;
582
- if (datasetLn > 0) {
583
- if (!this._isDatasetInitialized && (this.gridOptions.enableCheckboxSelector || this.gridOptions.enableRowSelection)) {
584
- this.loadRowSelectionPresetWhenExists();
585
- }
586
- this.loadFilterPresetsWhenDatasetInitialized();
587
- this._isDatasetInitialized = true;
588
- }
589
- }
590
-
591
- // user might want to hide the header row on page load but still have `enableFiltering: true`
592
- // if that is the case, we need to hide the headerRow ONLY AFTER all filters got created & dataView exist
593
- if (this._hideHeaderRowAfterPageLoad) {
594
- this.showHeaderRow(false);
595
- this.sharedService.hideHeaderRowAfterPageLoad = this._hideHeaderRowAfterPageLoad;
596
- }
597
-
598
- // publish & dispatch certain events
599
- this._eventPubSubService.publish('onGridCreated', this.slickGrid);
600
-
601
- // after the DataView is created & updated execute some processes
602
- if (!this.customDataView) {
603
- this.executeAfterDataviewCreated(this.slickGrid, this.gridOptions);
604
- }
605
-
606
- // bind resize ONLY after the dataView is ready
607
- this.bindResizeHook(this.slickGrid, this.gridOptions);
608
-
609
- // bind the Backend Service API callback functions only after the grid is initialized
610
- // because the preProcess() and onInit() might get triggered
611
- if (this.gridOptions?.backendServiceApi) {
612
- this.bindBackendCallbackFunctions(this.gridOptions);
613
- }
614
-
615
- // local grid, check if we need to show the Pagination
616
- // if so then also check if there's any presets and finally initialize the PaginationService
617
- // a local grid with Pagination presets will potentially have a different total of items, we'll need to get it from the DataView and update our total
618
- if (this.gridOptions?.enablePagination && this._isLocalGrid) {
619
- this.showPagination = true;
620
- this.loadLocalGridPagination(this.dataset);
621
- }
622
-
623
- this._angularGridInstances = {
624
- // Slick Grid & DataView objects
625
- dataView: this.dataView,
626
- slickGrid: this.slickGrid,
627
- extensions: this.extensionService?.extensionList,
628
-
629
- // public methods
630
- destroy: this.destroy.bind(this),
631
-
632
- // return all available Services (non-singleton)
633
- backendService: this.gridOptions?.backendServiceApi?.service,
634
- filterService: this.filterService,
635
- gridEventService: this.gridEventService,
636
- gridStateService: this.gridStateService,
637
- gridService: this.gridService,
638
- groupingService: this.groupingService,
639
- extensionService: this.extensionService,
640
- paginationService: this.paginationService,
641
- resizerService: this.resizerService,
642
- sortService: this.sortService,
643
- treeDataService: this.treeDataService,
644
- }
645
-
646
- // all instances (SlickGrid, DataView & all Services)
647
- this._eventPubSubService.publish('onAngularGridCreated', this._angularGridInstances);
648
- }
649
-
650
- /**
651
- * On a Pagination changed, we will trigger a Grid State changed with the new pagination info
652
- * Also if we use Row Selection or the Checkbox Selector, we need to reset any selection
653
- */
654
- paginationChanged(pagination: ServicePagination) {
655
- const isSyncGridSelectionEnabled = this.gridStateService?.needToPreserveRowSelection() ?? false;
656
- if (!isSyncGridSelectionEnabled && (this.gridOptions.enableRowSelection || this.gridOptions.enableCheckboxSelector)) {
657
- this.slickGrid.setSelectedRows([]);
658
- }
659
- const { pageNumber, pageSize } = pagination;
660
- if (this.sharedService) {
661
- if (pageSize !== undefined && pageNumber !== undefined) {
662
- this.sharedService.currentPagination = { pageNumber, pageSize };
663
- }
664
- }
665
- this._eventPubSubService.publish('onGridStateChanged', {
666
- change: { newValues: { pageNumber, pageSize }, type: GridStateType.pagination },
667
- gridState: this.gridStateService.getCurrentGridState()
668
- });
669
- this.cd.markForCheck();
670
- }
671
-
672
- /**
673
- * When dataset changes, we need to refresh the entire grid UI & possibly resize it as well
674
- * @param dataset
675
- */
676
- refreshGridData(dataset: any[], totalCount?: number) {
677
- if (this.gridOptions && this.gridOptions.enableEmptyDataWarningMessage && Array.isArray(dataset)) {
678
- const finalTotalCount = totalCount || dataset.length;
679
- this.displayEmptyDataWarning(finalTotalCount < 1);
680
- }
681
-
682
- if (Array.isArray(dataset) && this.slickGrid && this.dataView?.setItems) {
683
- this.dataView.setItems(dataset, this.gridOptions.datasetIdPropertyName ?? 'id');
684
- if (!this.gridOptions.backendServiceApi && !this.gridOptions.enableTreeData) {
685
- this.dataView.reSort();
686
- }
687
-
688
- if (dataset.length > 0) {
689
- if (!this._isDatasetInitialized) {
690
- this.loadFilterPresetsWhenDatasetInitialized();
691
-
692
- if (this.gridOptions.enableCheckboxSelector) {
693
- this.loadRowSelectionPresetWhenExists();
694
- }
695
- }
696
- this._isDatasetInitialized = true;
697
- }
698
-
699
- if (dataset) {
700
- this.slickGrid.invalidate();
701
- }
702
-
703
- // display the Pagination component only after calling this refresh data first, we call it here so that if we preset pagination page number it will be shown correctly
704
- this.showPagination = (this.gridOptions && (this.gridOptions.enablePagination || (this.gridOptions.backendServiceApi && this.gridOptions.enablePagination === undefined))) ? true : false;
705
-
706
- if (this._paginationOptions && this.gridOptions?.pagination && this.gridOptions?.backendServiceApi) {
707
- const paginationOptions = this.setPaginationOptionsWhenPresetDefined(this.gridOptions, this._paginationOptions as Pagination);
708
- // when we have a totalCount use it, else we'll take it from the pagination object
709
- // only update the total items if it's different to avoid refreshing the UI
710
- const totalRecords = (totalCount !== undefined) ? totalCount : (this.gridOptions?.pagination?.totalItems);
711
- if (totalRecords !== undefined && totalRecords !== this.totalItems) {
712
- this.totalItems = +totalRecords;
713
- }
714
-
715
- // initialize the Pagination Service with new pagination options (which might have presets)
716
- if (!this._isPaginationInitialized) {
717
- this.initializePaginationService(paginationOptions);
718
- } else {
719
- // update the pagination service with the new total
720
- this.paginationService.updateTotalItems(this.totalItems);
721
- }
722
- }
723
-
724
- // resize the grid inside a slight timeout, in case other DOM element changed prior to the resize (like a filter/pagination changed)
725
- if (this.slickGrid && this.gridOptions.enableAutoResize) {
726
- const delay = this.gridOptions.autoResize && this.gridOptions.autoResize.delay;
727
- this.resizerService.resizeGrid(delay || 10);
728
- }
729
- }
730
- }
731
-
732
- /**
733
- * Check if there's any Pagination Presets defined in the Grid Options,
734
- * if there are then load them in the paginationOptions object
735
- */
736
- setPaginationOptionsWhenPresetDefined(gridOptions: GridOption, paginationOptions: Pagination): Pagination {
737
- if (gridOptions.presets?.pagination && paginationOptions && !this._isPaginationInitialized) {
738
- paginationOptions.pageSize = gridOptions.presets.pagination.pageSize;
739
- paginationOptions.pageNumber = gridOptions.presets.pagination.pageNumber;
740
- }
741
- return paginationOptions;
742
- }
743
-
744
- /**
745
- * Dynamically change or update the column definitions list.
746
- * We will re-render the grid so that the new header and data shows up correctly.
747
- * If using i18n, we also need to trigger a re-translate of the column headers
748
- */
749
- updateColumnDefinitionsList(newColumnDefinitions: Column[]) {
750
- // map/swap the internal library Editor to the SlickGrid Editor factory
751
- newColumnDefinitions = this.swapInternalEditorToSlickGridFactoryEditor(newColumnDefinitions);
752
-
753
- if (this.gridOptions.enableTranslate) {
754
- this.extensionService.translateColumnHeaders(false, newColumnDefinitions);
755
- } else {
756
- this.extensionService.renderColumnHeaders(newColumnDefinitions, true);
757
- }
758
-
759
- if (this.gridOptions?.enableAutoSizeColumns) {
760
- this.slickGrid.autosizeColumns();
761
- } else if (this.gridOptions?.enableAutoResizeColumnsByCellContent && this.resizerService?.resizeColumnsByCellContent) {
762
- this.resizerService.resizeColumnsByCellContent();
763
- }
764
- }
765
-
766
- /**
767
- * Show the filter row displayed on first row, we can optionally pass false to hide it.
768
- * @param showing
769
- */
770
- showHeaderRow(showing = true) {
771
- this.slickGrid.setHeaderRowVisibility(showing, false);
772
- if (showing === true && this._isGridInitialized) {
773
- this.slickGrid.setColumns(this.columnDefinitions);
774
- }
775
- return showing;
776
- }
777
-
778
- //
779
- // private functions
780
- // ------------------
781
-
782
- /**
783
- * Loop through all column definitions and copy the original optional `width` properties optionally provided by the user.
784
- * We will use this when doing a resize by cell content, if user provided a `width` it won't override it.
785
- */
786
- private copyColumnWidthsReference(columnDefinitions: Column[]) {
787
- columnDefinitions.forEach(col => col.originalWidth = col.width);
788
- }
789
-
790
- private displayEmptyDataWarning(showWarning = true) {
791
- this.slickEmptyWarning?.showEmptyDataMessage(showWarning);
792
- }
793
-
794
- private bindDifferentHooks(grid: SlickGrid, gridOptions: GridOption, dataView: SlickDataView) {
795
- // on locale change, we have to manually translate the Headers, GridMenu
796
- if (this.translate?.onLangChange) {
797
- // translate some of them on first load, then on each language change
798
- if (gridOptions.enableTranslate) {
799
- this.extensionService.translateAllExtensions();
800
- this.translateColumnHeaderTitleKeys();
801
- this.translateColumnGroupKeys();
802
- }
803
-
804
- this.subscriptions.push(
805
- this.translate.onLangChange.subscribe(() => {
806
- // publish event of the same name that Slickgrid-Universal uses on a language change event
807
- this._eventPubSubService.publish('onLanguageChange');
808
-
809
- if (gridOptions.enableTranslate) {
810
- this.extensionService.translateAllExtensions();
811
- this.translateColumnHeaderTitleKeys();
812
- this.translateColumnGroupKeys();
813
- if (gridOptions.createPreHeaderPanel && !gridOptions.enableDraggableGrouping) {
814
- this.groupingService.translateGroupingAndColSpan();
815
- }
816
- }
817
- })
818
- );
819
- }
820
-
821
- // if user set an onInit Backend, we'll run it right away (and if so, we also need to run preProcess, internalPostProcess & postProcess)
822
- if (gridOptions.backendServiceApi) {
823
- const backendApi = gridOptions.backendServiceApi;
824
-
825
- if (backendApi?.service?.init) {
826
- backendApi.service.init(backendApi.options, gridOptions.pagination, this.slickGrid, this.sharedService);
827
- }
828
- }
829
-
830
- if (dataView && grid) {
831
- const slickgridEventPrefix = this.gridOptions?.defaultSlickgridEventPrefix ?? '';
832
-
833
- // expose all Slick Grid Events through dispatch
834
- for (const prop in grid) {
835
- if (grid.hasOwnProperty(prop) && prop.startsWith('on')) {
836
- const gridEventName = this._eventPubSubService.getEventNameByNamingConvention(prop, slickgridEventPrefix);
837
- this._eventHandler.subscribe((grid as any)[prop], (event, args) => {
838
- return this._eventPubSubService.dispatchCustomEvent(gridEventName, { eventData: event, args });
839
- });
840
- }
841
- }
842
-
843
- // expose all Slick DataView Events through dispatch
844
- for (const prop in dataView) {
845
- if (dataView.hasOwnProperty(prop) && prop.startsWith('on')) {
846
- this._eventHandler.subscribe((dataView as any)[prop], (event, args) => {
847
- const dataViewEventName = this._eventPubSubService.getEventNameByNamingConvention(prop, slickgridEventPrefix);
848
- return this._eventPubSubService.dispatchCustomEvent(dataViewEventName, { eventData: event, args });
849
- });
850
- }
851
- }
852
-
853
- // on cell click, mainly used with the columnDef.action callback
854
- this.gridEventService.bindOnCellChange(grid);
855
- this.gridEventService.bindOnClick(grid);
856
-
857
- if (dataView && grid) {
858
- // bind external sorting (backend) when available or default onSort (dataView)
859
- if (gridOptions.enableSorting) {
860
- // bind external sorting (backend) unless specified to use the local one
861
- if (gridOptions.backendServiceApi && !gridOptions.backendServiceApi.useLocalSorting) {
862
- this.sortService.bindBackendOnSort(grid);
863
- } else {
864
- this.sortService.bindLocalOnSort(grid);
865
- }
866
- }
867
-
868
- // bind external filter (backend) when available or default onFilter (dataView)
869
- if (gridOptions.enableFiltering) {
870
- this.filterService.init(grid);
871
-
872
- // bind external filter (backend) unless specified to use the local one
873
- if (gridOptions.backendServiceApi && !gridOptions.backendServiceApi.useLocalFiltering) {
874
- this.filterService.bindBackendOnFilter(grid);
875
- } else {
876
- this.filterService.bindLocalOnFilter(grid);
877
- }
878
- }
879
-
880
- // load any presets if any (after dataset is initialized)
881
- this.loadColumnPresetsWhenDatasetInitialized();
882
- this.loadFilterPresetsWhenDatasetInitialized();
883
-
884
- // When data changes in the DataView, we need to refresh the metrics and/or display a warning if the dataset is empty
885
- this._eventHandler.subscribe(dataView.onRowCountChanged, () => {
886
- grid.invalidate();
887
- this.handleOnItemCountChanged(this.dataView.getFilteredItemCount() || 0, dataView.getItemCount());
888
- });
889
- this._eventHandler.subscribe(dataView.onSetItemsCalled, (_e, args) => {
890
- grid.invalidate();
891
- this.handleOnItemCountChanged(this.dataView.getFilteredItemCount(), args.itemCount);
892
-
893
- // when user has resize by content enabled, we'll force a full width calculation since we change our entire dataset
894
- if (args.itemCount > 0 && (this.gridOptions.autosizeColumnsByCellContentOnFirstLoad || this.gridOptions.enableAutoResizeColumnsByCellContent)) {
895
- this.resizerService.resizeColumnsByCellContent(!this.gridOptions?.resizeByContentOnlyOnFirstLoad);
896
- }
897
- });
898
-
899
- this._eventHandler.subscribe(dataView.onRowsChanged, (_e, args) => {
900
- // filtering data with local dataset will not always show correctly unless we call this updateRow/render
901
- // also don't use "invalidateRows" since it destroys the entire row and as bad user experience when updating a row
902
- // see commit: https://github.com/ghiscoding/aurelia-slickgrid/commit/8c503a4d45fba11cbd8d8cc467fae8d177cc4f60
903
- if (gridOptions && gridOptions.enableFiltering && !gridOptions.enableRowDetailView) {
904
- if (args?.rows && Array.isArray(args.rows)) {
905
- args.rows.forEach((row: number) => grid.updateRow(row));
906
- grid.render();
907
- }
908
- }
909
- });
910
- }
911
- }
912
-
913
- // did the user add a colspan callback? If so, hook it into the DataView getItemMetadata
914
- if (gridOptions && gridOptions.colspanCallback && dataView && dataView.getItem && dataView.getItemMetadata) {
915
- dataView.getItemMetadata = (rowNumber: number) => {
916
- let callbackResult = null;
917
- if (gridOptions.colspanCallback && gridOptions.colspanCallback) {
918
- callbackResult = gridOptions.colspanCallback(dataView.getItem(rowNumber));
919
- }
920
- return callbackResult;
921
- };
922
- }
923
- }
924
-
925
- private bindBackendCallbackFunctions(gridOptions: GridOption) {
926
- const backendApi = gridOptions.backendServiceApi;
927
- const backendApiService = backendApi && backendApi.service;
928
- const serviceOptions: BackendServiceOption = backendApiService?.options ?? {};
929
- const isExecuteCommandOnInit = (!serviceOptions) ? false : ((serviceOptions && serviceOptions.hasOwnProperty('executeProcessCommandOnInit')) ? serviceOptions['executeProcessCommandOnInit'] : true);
930
-
931
- if (backendApiService) {
932
- // update backend filters (if need be) BEFORE the query runs (via the onInit command a few lines below)
933
- // if user entered some any "presets", we need to reflect them all in the grid
934
- if (gridOptions && gridOptions.presets) {
935
- // Filters "presets"
936
- if (backendApiService.updateFilters && Array.isArray(gridOptions.presets.filters) && gridOptions.presets.filters.length > 0) {
937
- backendApiService.updateFilters(gridOptions.presets.filters, true);
938
- }
939
- // Sorters "presets"
940
- if (backendApiService.updateSorters && Array.isArray(gridOptions.presets.sorters) && gridOptions.presets.sorters.length > 0) {
941
- // when using multi-column sort, we can have multiple but on single sort then only grab the first sort provided
942
- const sortColumns = this.gridOptions.multiColumnSort ? gridOptions.presets.sorters : gridOptions.presets.sorters.slice(0, 1);
943
- backendApiService.updateSorters(undefined, sortColumns);
944
- }
945
- // Pagination "presets"
946
- if (backendApiService.updatePagination && gridOptions.presets.pagination) {
947
- const { pageNumber, pageSize } = gridOptions.presets.pagination;
948
- backendApiService.updatePagination(pageNumber, pageSize);
949
- }
950
- } else {
951
- const columnFilters = this.filterService.getColumnFilters();
952
- if (columnFilters && backendApiService.updateFilters) {
953
- backendApiService.updateFilters(columnFilters, false);
954
- }
955
- }
956
-
957
- // execute onInit command when necessary
958
- if (backendApi && backendApiService && (backendApi.onInit || isExecuteCommandOnInit)) {
959
- const query = (typeof backendApiService.buildQuery === 'function') ? backendApiService.buildQuery() : '';
960
- const process = (isExecuteCommandOnInit) ? (backendApi.process && backendApi.process(query) || null) : (backendApi.onInit && backendApi.onInit(query) || null);
961
-
962
- // wrap this inside a setTimeout to avoid timing issue since the gridOptions needs to be ready before running this onInit
963
- setTimeout(() => {
964
- const backendUtilityService = this.backendUtilityService as BackendUtilityService;
965
-
966
- // keep start time & end timestamps & return it after process execution
967
- const startTime = new Date();
968
-
969
- // run any pre-process, if defined, for example a spinner
970
- if (backendApi.preProcess) {
971
- backendApi.preProcess();
972
- }
973
-
974
- // the processes can be a Promise (like Http)
975
- const totalItems = this.gridOptions?.pagination?.totalItems ?? 0;
976
- if (process instanceof Promise) {
977
- process
978
- .then((processResult: any) => backendUtilityService.executeBackendProcessesCallback(startTime, processResult, backendApi, totalItems))
979
- .catch((error) => backendUtilityService.onBackendError(error, backendApi));
980
- } else if (process && this.rxjs?.isObservable(process)) {
981
- this.subscriptions.push(
982
- (process as Observable<any>).subscribe({
983
- next: (processResult: any) => backendUtilityService.executeBackendProcessesCallback(startTime, processResult, backendApi, totalItems),
984
- error: (error: any) => backendUtilityService.onBackendError(error, backendApi)
985
- })
986
- );
987
- }
988
- });
989
- }
990
- }
991
- }
992
-
993
- private bindResizeHook(grid: SlickGrid, options: GridOption) {
994
- if ((options.autoFitColumnsOnFirstLoad && options.autosizeColumnsByCellContentOnFirstLoad) || (options.enableAutoSizeColumns && options.enableAutoResizeColumnsByCellContent)) {
995
- throw new Error(`[Angular-Slickgrid] You cannot enable both autosize/fit viewport & resize by content, you must choose which resize technique to use. You can enable these 2 options ("autoFitColumnsOnFirstLoad" and "enableAutoSizeColumns") OR these other 2 options ("autosizeColumnsByCellContentOnFirstLoad" and "enableAutoResizeColumnsByCellContent").`);
996
- }
997
-
998
- // expand/autofit columns on first page load
999
- if (grid && options.autoFitColumnsOnFirstLoad && options.enableAutoSizeColumns) {
1000
- grid.autosizeColumns();
1001
- }
1002
-
1003
- // auto-resize grid on browser resize
1004
- if (options.gridHeight || options.gridWidth) {
1005
- this.resizerService.resizeGrid(0, { height: options.gridHeight, width: options.gridWidth });
1006
- } else {
1007
- this.resizerService.resizeGrid();
1008
- }
1009
- if (options.enableAutoResize) {
1010
- if (grid && options.autoFitColumnsOnFirstLoad && options.enableAutoSizeColumns) {
1011
- grid.autosizeColumns();
1012
- }
1013
- }
1014
- }
1015
-
1016
- private executeAfterDataviewCreated(_grid: SlickGrid, gridOptions: GridOption) {
1017
- // if user entered some Sort "presets", we need to reflect them all in the DOM
1018
- if (gridOptions.enableSorting) {
1019
- if (gridOptions.presets && Array.isArray(gridOptions.presets.sorters)) {
1020
- // when using multi-column sort, we can have multiple but on single sort then only grab the first sort provided
1021
- const sortColumns = this.gridOptions.multiColumnSort ? gridOptions.presets.sorters : gridOptions.presets.sorters.slice(0, 1);
1022
- this.sortService.loadGridSorters(sortColumns);
1023
- }
1024
- }
1025
- }
1026
-
1027
- /** When data changes in the DataView, we'll refresh the metrics and/or display a warning if the dataset is empty */
1028
- private handleOnItemCountChanged(currentPageRowItemCount: number, totalItemCount: number) {
1029
- this._currentDatasetLength = totalItemCount;
1030
- this.metrics = {
1031
- startTime: new Date(),
1032
- endTime: new Date(),
1033
- itemCount: currentPageRowItemCount,
1034
- totalItemCount
1035
- };
1036
- // if custom footer is enabled, then we'll update its metrics
1037
- if (this.slickFooter) {
1038
- this.slickFooter.metrics = this.metrics;
1039
- }
1040
-
1041
- // when using local (in-memory) dataset, we'll display a warning message when filtered data is empty
1042
- if (this._isLocalGrid && this.gridOptions?.enableEmptyDataWarningMessage) {
1043
- this.displayEmptyDataWarning(currentPageRowItemCount === 0);
1044
- }
1045
- }
1046
-
1047
- private initializePaginationService(paginationOptions: Pagination) {
1048
- if (this.gridOptions) {
1049
- this.paginationData = {
1050
- gridOptions: this.gridOptions,
1051
- paginationService: this.paginationService,
1052
- };
1053
- this.paginationService.totalItems = this.totalItems;
1054
- this.paginationService.init(this.slickGrid, paginationOptions, this.backendServiceApi);
1055
- this.subscriptions.push(
1056
- this._eventPubSubService.subscribe('onPaginationChanged', (paginationChanges: ServicePagination) => {
1057
- this.paginationChanged(paginationChanges);
1058
- }),
1059
- this._eventPubSubService.subscribe('onPaginationVisibilityChanged', (visibility: { visible: boolean }) => {
1060
- this.showPagination = visibility?.visible ?? false;
1061
- if (this.gridOptions?.backendServiceApi) {
1062
- this.backendUtilityService?.refreshBackendDataset(this.gridOptions);
1063
- }
1064
- this.renderPagination(this.showPagination);
1065
- })
1066
- );
1067
- // also initialize (render) the pagination component
1068
- this.renderPagination();
1069
- this._isPaginationInitialized = true;
1070
- }
1071
- this.cd.detectChanges();
1072
- }
1073
-
1074
- /** Load the Editor Collection asynchronously and replace the "collection" property when Observable resolves */
1075
- private loadEditorCollectionAsync(column: Column) {
1076
- const collectionAsync = column && column.editor && (column.editor as ColumnEditor).collectionAsync;
1077
- if (collectionAsync instanceof Observable) {
1078
- this.subscriptions.push(
1079
- collectionAsync.subscribe((resolvedCollection) => this.updateEditorCollection(column, resolvedCollection))
1080
- );
1081
- } else if (collectionAsync instanceof Promise) {
1082
- // wait for the "collectionAsync", once resolved we will save it into the "collection"
1083
- // the collectionAsync can be of 3 types HttpClient, HttpFetch or a Promise
1084
- collectionAsync.then((response: any | any[]) => {
1085
- if (Array.isArray(response)) {
1086
- this.updateEditorCollection(column, response); // from Promise
1087
- }
1088
- });
1089
- }
1090
- }
1091
-
1092
- /** Load any possible Columns Grid Presets */
1093
- private loadColumnPresetsWhenDatasetInitialized() {
1094
- // if user entered some Columns "presets", we need to reflect them all in the grid
1095
- if (this.gridOptions.presets && Array.isArray(this.gridOptions.presets.columns) && this.gridOptions.presets.columns.length > 0) {
1096
- const gridColumns: Column[] = this.gridStateService.getAssociatedGridColumns(this.slickGrid, this.gridOptions.presets.columns);
1097
- if (gridColumns && Array.isArray(gridColumns) && gridColumns.length > 0) {
1098
- // make sure that the checkbox selector is also visible if it is enabled
1099
- if (this.gridOptions.enableCheckboxSelector) {
1100
- const checkboxColumn = (Array.isArray(this._columnDefinitions) && this._columnDefinitions.length > 0) ? this._columnDefinitions[0] : null;
1101
- if (checkboxColumn && checkboxColumn.id === '_checkbox_selector' && gridColumns[0].id !== '_checkbox_selector') {
1102
- gridColumns.unshift(checkboxColumn);
1103
- }
1104
- }
1105
-
1106
- // keep copy the original optional `width` properties optionally provided by the user.
1107
- // We will use this when doing a resize by cell content, if user provided a `width` it won't override it.
1108
- gridColumns.forEach(col => col.originalWidth = col.width);
1109
-
1110
- // finally set the new presets columns (including checkbox selector if need be)
1111
- this.slickGrid.setColumns(gridColumns);
1112
- this.sharedService.visibleColumns = gridColumns;
1113
- }
1114
- }
1115
- }
1116
-
1117
- /** Load any possible Filters Grid Presets */
1118
- private loadFilterPresetsWhenDatasetInitialized() {
1119
- if (this.gridOptions && !this.customDataView) {
1120
- // if user entered some Filter "presets", we need to reflect them all in the DOM
1121
- // also note that a presets of Tree Data Toggling will also call this method because Tree Data toggling does work with data filtering
1122
- // (collapsing a parent will basically use Filter for hidding (aka collapsing) away the child underneat it)
1123
- if (this.gridOptions.presets && (Array.isArray(this.gridOptions.presets.filters) || Array.isArray(this.gridOptions.presets?.treeData?.toggledItems))) {
1124
- this.filterService.populateColumnFilterSearchTermPresets(this.gridOptions.presets?.filters || []);
1125
- }
1126
- }
1127
- }
1128
-
1129
- /**
1130
- * local grid, check if we need to show the Pagination
1131
- * if so then also check if there's any presets and finally initialize the PaginationService
1132
- * a local grid with Pagination presets will potentially have a different total of items, we'll need to get it from the DataView and update our total
1133
- */
1134
- private loadLocalGridPagination(dataset?: any[]) {
1135
- if (this.gridOptions && this._paginationOptions) {
1136
- this.totalItems = Array.isArray(dataset) ? dataset.length : 0;
1137
- if (this._paginationOptions && this.dataView?.getPagingInfo) {
1138
- const slickPagingInfo = this.dataView.getPagingInfo();
1139
- if (slickPagingInfo?.hasOwnProperty('totalRows') && this._paginationOptions.totalItems !== slickPagingInfo.totalRows) {
1140
- this.totalItems = slickPagingInfo.totalRows || 0;
1141
- }
1142
- }
1143
- this._paginationOptions.totalItems = this.totalItems;
1144
- const paginationOptions = this.setPaginationOptionsWhenPresetDefined(this.gridOptions, this._paginationOptions);
1145
- this.initializePaginationService(paginationOptions);
1146
- }
1147
- }
1148
-
1149
- /** Load any Row Selections into the DataView that were presets by the user */
1150
- private loadRowSelectionPresetWhenExists() {
1151
- // if user entered some Row Selections "presets"
1152
- const presets = this.gridOptions?.presets;
1153
- const selectionModel = this.slickGrid?.getSelectionModel();
1154
- const enableRowSelection = this.gridOptions && (this.gridOptions.enableCheckboxSelector || this.gridOptions.enableRowSelection);
1155
- if (enableRowSelection && selectionModel && presets && presets.rowSelection && (Array.isArray(presets.rowSelection.gridRowIndexes) || Array.isArray(presets.rowSelection.dataContextIds))) {
1156
- let dataContextIds = presets.rowSelection.dataContextIds;
1157
- let gridRowIndexes = presets.rowSelection.gridRowIndexes;
1158
-
1159
- // maps the IDs to the Grid Rows and vice versa, the "dataContextIds" has precedence over the other
1160
- if (Array.isArray(dataContextIds) && dataContextIds.length > 0) {
1161
- gridRowIndexes = this.dataView.mapIdsToRows(dataContextIds) || [];
1162
- } else if (Array.isArray(gridRowIndexes) && gridRowIndexes.length > 0) {
1163
- dataContextIds = this.dataView.mapRowsToIds(gridRowIndexes) || [];
1164
- }
1165
- this.gridStateService.selectedRowDataContextIds = dataContextIds;
1166
-
1167
- // change the selected rows except UNLESS it's a Local Grid with Pagination
1168
- // local Pagination uses the DataView and that also trigger a change/refresh
1169
- // and we don't want to trigger 2 Grid State changes just 1
1170
- if ((this._isLocalGrid && !this.gridOptions.enablePagination) || !this._isLocalGrid) {
1171
- setTimeout(() => {
1172
- if (this.slickGrid && Array.isArray(gridRowIndexes)) {
1173
- this.slickGrid.setSelectedRows(gridRowIndexes);
1174
- }
1175
- });
1176
- }
1177
- }
1178
- }
1179
-
1180
- private mergeGridOptions(gridOptions: GridOption): GridOption {
1181
- gridOptions.gridId = this.gridId;
1182
- gridOptions.gridContainerId = `slickGridContainer-${this.gridId}`;
1183
-
1184
- // if we have a backendServiceApi and the enablePagination is undefined, we'll assume that we do want to see it, else get that defined value
1185
- gridOptions.enablePagination = ((gridOptions.backendServiceApi && gridOptions.enablePagination === undefined) ? true : gridOptions.enablePagination) || false;
1186
-
1187
- // use jquery extend to deep merge & copy to avoid immutable properties being changed in GlobalGridOptions after a route change
1188
- const options = $.extend(true, {}, GlobalGridOptions, this.forRootConfig, gridOptions) as GridOption;
1189
-
1190
- // using jQuery extend to do a deep clone has an unwanted side on objects and pageSizes but ES6 spread has other worst side effects
1191
- // so we will just overwrite the pageSizes when needed, this is the only one causing issues so far.
1192
- // jQuery wrote this on their docs:: On a deep extend, Object and Array are extended, but object wrappers on primitive types such as String, Boolean, and Number are not.
1193
- if (options?.pagination && (gridOptions.enablePagination || gridOptions.backendServiceApi) && (this.forRootConfig.pagination || gridOptions.pagination)) {
1194
- options.pagination.pageSize = gridOptions.pagination?.pageSize ?? this.forRootConfig.pagination?.pageSize ?? GlobalGridOptions.pagination!.pageSize;
1195
- options.pagination.pageSizes = gridOptions.pagination?.pageSizes ?? this.forRootConfig.pagination?.pageSizes ?? GlobalGridOptions.pagination!.pageSizes;
1196
- }
1197
-
1198
- // also make sure to show the header row if user have enabled filtering
1199
- this._hideHeaderRowAfterPageLoad = (options.showHeaderRow === false);
1200
- if (options.enableFiltering && !options.showHeaderRow) {
1201
- options.showHeaderRow = options.enableFiltering;
1202
- }
1203
-
1204
- // when we use Pagination on Local Grid, it doesn't seem to work without enableFiltering
1205
- // so we'll enable the filtering but we'll keep the header row hidden
1206
- if (options && !options.enableFiltering && options.enablePagination && this._isLocalGrid) {
1207
- options.enableFiltering = true;
1208
- options.showHeaderRow = false;
1209
- this._hideHeaderRowAfterPageLoad = true;
1210
- if (this.sharedService) {
1211
- this.sharedService.hideHeaderRowAfterPageLoad = true;
1212
- }
1213
- }
1214
-
1215
- return options;
1216
- }
1217
-
1218
- /** Pre-Register any Resource that don't require SlickGrid to be instantiated (for example RxJS Resource) */
1219
- private preRegisterResources() {
1220
- this._registeredResources = this.gridOptions.registerExternalResources || [];
1221
-
1222
- // Angular-Slickgrid requires RxJS, so we'll register it as the first resource
1223
- this.registerRxJsResource(new RxJsResource() as RxJsFacade);
1224
- }
1225
-
1226
- private registerResources() {
1227
- // at this point, we consider all the registered services as external services, anything else registered afterward aren't external
1228
- if (Array.isArray(this._registeredResources)) {
1229
- this.sharedService.externalRegisteredResources = this._registeredResources;
1230
- }
1231
-
1232
- // push all other Services that we want to be registered
1233
- this._registeredResources.push(this.gridService, this.gridStateService);
1234
-
1235
- // when using Grouping/DraggableGrouping/Colspan register its Service
1236
- if (this.gridOptions.createPreHeaderPanel && !this.gridOptions.enableDraggableGrouping) {
1237
- this._registeredResources.push(this.groupingService);
1238
- }
1239
-
1240
- // when using Tree Data View, register its Service
1241
- if (this.gridOptions.enableTreeData) {
1242
- this._registeredResources.push(this.treeDataService);
1243
- }
1244
-
1245
- // when user enables translation, we need to translate Headers on first pass & subsequently in the bindDifferentHooks
1246
- if (this.gridOptions.enableTranslate) {
1247
- this.extensionService.translateColumnHeaders();
1248
- }
1249
-
1250
- if (this.gridOptions.enableRowDetailView) {
1251
- this.slickRowDetailView = new SlickRowDetailView(this.angularUtilService, this.appRef, this._eventPubSubService, this.elm.nativeElement, this.rxjs);
1252
- this.slickRowDetailView.create(this.columnDefinitions, this.gridOptions);
1253
- this._registeredResources.push(this.slickRowDetailView);
1254
- this.extensionService.addExtensionToList(ExtensionName.rowDetailView, { name: ExtensionName.rowDetailView, instance: this.slickRowDetailView });
1255
- }
1256
-
1257
- // also initialize (render) the empty warning component
1258
- this.slickEmptyWarning = new SlickEmptyWarningComponent();
1259
- this._registeredResources.push(this.slickEmptyWarning);
1260
-
1261
- // bind & initialize all Components/Services that were tagged as enabled
1262
- // register all services by executing their init method and providing them with the Grid object
1263
- if (Array.isArray(this._registeredResources)) {
1264
- for (const resource of this._registeredResources) {
1265
- if (typeof resource.init === 'function') {
1266
- resource.init(this.slickGrid, this.containerService);
1267
- }
1268
- }
1269
- }
1270
- }
1271
-
1272
- /** Register the RxJS Resource in all necessary services which uses */
1273
- private registerRxJsResource(resource: RxJsFacade) {
1274
- this.rxjs = resource;
1275
- this.backendUtilityService.addRxJsResource(this.rxjs);
1276
- this.filterFactory.addRxJsResource(this.rxjs);
1277
- this.filterService.addRxJsResource(this.rxjs);
1278
- this.sortService.addRxJsResource(this.rxjs);
1279
- this.paginationService.addRxJsResource(this.rxjs);
1280
- this.containerService.registerInstance('RxJsResource', this.rxjs);
1281
- }
1282
-
1283
- /**
1284
- * Render (or dispose) the Pagination Component, user can optionally provide False (to not show it) which will in term dispose of the Pagination,
1285
- * also while disposing we can choose to omit the disposable of the Pagination Service (if we are simply toggling the Pagination, we want to keep the Service alive)
1286
- * @param {Boolean} showPagination - show (new render) or not (dispose) the Pagination
1287
- * @param {Boolean} shouldDisposePaginationService - when disposing the Pagination, do we also want to dispose of the Pagination Service? (defaults to True)
1288
- */
1289
- private renderPagination(showPagination = true) {
1290
- if (this.gridOptions?.enablePagination && !this._isPaginationInitialized && showPagination) {
1291
- this.slickPagination = new SlickPaginationComponent(this.paginationService, this._eventPubSubService, this.sharedService, this.translaterService);
1292
- this.slickPagination.renderPagination(this.gridContainerElement as HTMLElement);
1293
- this._isPaginationInitialized = true;
1294
- } else if (!showPagination) {
1295
- if (this.slickPagination) {
1296
- this.slickPagination.dispose();
1297
- }
1298
- this._isPaginationInitialized = false;
1299
- }
1300
- }
1301
-
1302
- /**
1303
- * Takes a flat dataset with parent/child relationship, sort it (via its tree structure) and return the sorted flat array
1304
- * @param {Array<Object>} flatDatasetInput - flat dataset input
1305
- * @param {Boolean} forceGridRefresh - optionally force a full grid refresh
1306
- * @returns {Array<Object>} sort flat parent/child dataset
1307
- */
1308
- private sortTreeDataset<T>(flatDatasetInput: T[], forceGridRefresh = false): T[] {
1309
- const prevDatasetLn = this._currentDatasetLength;
1310
- let sortedDatasetResult;
1311
- let flatDatasetOutput: any[] = [];
1312
-
1313
- // if the hierarchical dataset was already initialized then no need to re-convert it, we can use it directly from the shared service ref
1314
- if (this._isDatasetHierarchicalInitialized && this.datasetHierarchical) {
1315
- sortedDatasetResult = this.treeDataService.sortHierarchicalDataset(this.datasetHierarchical);
1316
- flatDatasetOutput = sortedDatasetResult.flat;
1317
- } else if (Array.isArray(flatDatasetInput) && flatDatasetInput.length > 0) {
1318
- if (this.gridOptions?.treeDataOptions?.initialSort) {
1319
- // else we need to first convert the flat dataset to a hierarchical dataset and then sort
1320
- sortedDatasetResult = this.treeDataService.convertFlatParentChildToTreeDatasetAndSort(flatDatasetInput, this._columnDefinitions, this.gridOptions);
1321
- this.sharedService.hierarchicalDataset = sortedDatasetResult.hierarchical;
1322
- flatDatasetOutput = sortedDatasetResult.flat;
1323
- } else {
1324
- // else we assume that the user provided an array that is already sorted (user's responsability)
1325
- // and so we can simply convert the array to a tree structure and we're done, no need to sort
1326
- this.sharedService.hierarchicalDataset = this.treeDataService.convertFlatParentChildToTreeDataset(flatDatasetInput, this.gridOptions);
1327
- flatDatasetOutput = flatDatasetInput || [];
1328
- }
1329
- }
1330
-
1331
- // if we add/remove item(s) from the dataset, we need to also refresh our tree data filters
1332
- if (flatDatasetInput.length > 0 && (forceGridRefresh || flatDatasetInput.length !== prevDatasetLn)) {
1333
- this.filterService.refreshTreeDataFilters(flatDatasetOutput);
1334
- }
1335
-
1336
- return flatDatasetOutput;
1337
- }
1338
-
1339
- /**
1340
- * For convenience to the user, we provide the property "editor" as an Angular-Slickgrid editor complex object
1341
- * however "editor" is used internally by SlickGrid for it's own Editor Factory
1342
- * so in our lib we will swap "editor" and copy it into a new property called "internalColumnEditor"
1343
- * then take back "editor.model" and make it the new "editor" so that SlickGrid Editor Factory still works
1344
- */
1345
- private swapInternalEditorToSlickGridFactoryEditor(columnDefinitions: Column[]) {
1346
- if (columnDefinitions.some(col => `${col.id}`.includes('.'))) {
1347
- console.error('[Angular-Slickgrid] Make sure that none of your Column Definition "id" property includes a dot in its name because that will cause some problems with the Editors. For example if your column definition "field" property is "user.firstName" then use "firstName" as the column "id".');
1348
- }
1349
-
1350
- return columnDefinitions.map((column: Column | any) => {
1351
- // on every Editor that have a "collectionAsync", resolve the data and assign it to the "collection" property
1352
- if (column && column.editor && column.editor.collectionAsync) {
1353
- this.loadEditorCollectionAsync(column);
1354
- }
1355
- return { ...column, editor: column.editor && column.editor.model, internalColumnEditor: { ...column.editor } };
1356
- });
1357
- }
1358
-
1359
- private translateColumnHeaderTitleKeys() {
1360
- // translate all columns (including hidden columns)
1361
- this.extensionUtility.translateItems(this.sharedService.allColumns, 'nameKey', 'name');
1362
- }
1363
-
1364
- private translateColumnGroupKeys() {
1365
- // translate all column groups (including hidden columns)
1366
- this.extensionUtility.translateItems(this.sharedService.allColumns, 'columnGroupKey', 'columnGroup');
1367
- }
1368
-
1369
- /**
1370
- * Update the "internalColumnEditor.collection" property.
1371
- * Since this is called after the async call resolves, the pointer will not be the same as the "column" argument passed.
1372
- * Once we found the new pointer, we will reassign the "editor" and "collection" to the "internalColumnEditor" so it has newest collection
1373
- */
1374
- private updateEditorCollection<T = any>(column: Column<T>, newCollection: T[]) {
1375
- (column.editor as ColumnEditor).collection = newCollection;
1376
- (column.editor as ColumnEditor).disabled = false;
1377
-
1378
- // find the new column reference pointer & re-assign the new editor to the internalColumnEditor
1379
- const columns = this.slickGrid.getColumns();
1380
- if (Array.isArray(columns)) {
1381
- const columnRef = columns.find((col: Column) => col.id === column.id);
1382
- if (columnRef) {
1383
- columnRef.internalColumnEditor = column.editor as ColumnEditor;
1384
- }
1385
- }
1386
-
1387
- // get current Editor, remove it from the DOM then re-enable it and re-render it with the new collection.
1388
- const currentEditor = this.slickGrid.getCellEditor() as AutoCompleteEditor | SelectEditor;
1389
- if (currentEditor?.disable && currentEditor?.renderDomElement) {
1390
- currentEditor.destroy();
1391
- currentEditor.disable(false);
1392
- currentEditor.renderDomElement(newCollection);
1393
- }
1394
- }
1395
- }