@one-paragon/angular-utilities 2.0.0-beta.2 → 2.0.0-beta.4

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 (290) hide show
  1. package/karma.conf.js +44 -0
  2. package/ng-package.json +7 -0
  3. package/package.json +15 -27
  4. package/src/action-state/action-state-spinner/action-state-spinner.component.css +16 -0
  5. package/src/action-state/action-state-spinner/action-state-spinner.component.html +6 -0
  6. package/src/action-state/action-state-spinner/action-state-spinner.component.spec.ts +25 -0
  7. package/src/action-state/action-state-spinner/action-state-spinner.component.ts +25 -0
  8. package/src/action-state/action-state-ui/action-state-ui.module.ts +13 -0
  9. package/{action-state/index.d.ts → src/action-state/index.ts} +8 -4
  10. package/src/action-state/ngrx-ext/ngrx-ext.module.ts +15 -0
  11. package/src/action-state/ngrx.ts +69 -0
  12. package/src/http-request-state/HttpRequestStateFactory.ts +66 -0
  13. package/src/http-request-state/HttpRequestStateStore.ts +191 -0
  14. package/src/http-request-state/directives/HttpStateDirectiveBase.ts +29 -0
  15. package/src/http-request-state/directives/http-error-state-directive.ts +21 -0
  16. package/src/http-request-state/directives/http-inProgress-state-directive.ts +19 -0
  17. package/src/http-request-state/directives/http-notStarted-state-directive.ts +19 -0
  18. package/src/http-request-state/directives/http-success-state-directive.ts +29 -0
  19. package/{http-request-state/directives/index.d.ts → src/http-request-state/directives/index.ts} +5 -5
  20. package/src/http-request-state/directives/request-state-directive.spec.ts +72 -0
  21. package/src/http-request-state/directives/request-state-directive.ts +78 -0
  22. package/src/http-request-state/helpers.ts +30 -0
  23. package/src/http-request-state/http-request-state.ts +69 -0
  24. package/src/http-request-state/http-state-module.ts +23 -0
  25. package/{http-request-state/index.d.ts → src/http-request-state/index.ts} +6 -6
  26. package/src/http-request-state/observable.spec.ts +43 -0
  27. package/src/http-request-state/rxjs/getRequestorBody.ts +10 -0
  28. package/src/http-request-state/rxjs/getRequestorState.ts +8 -0
  29. package/{http-request-state/rxjs/index.d.ts → src/http-request-state/rxjs/index.ts} +4 -4
  30. package/src/http-request-state/rxjs/tapError.ts +16 -0
  31. package/src/http-request-state/rxjs/tapSuccess.ts +16 -0
  32. package/src/http-request-state/strategies.spec.ts +42 -0
  33. package/src/http-request-state/types.ts +55 -0
  34. package/src/ngrx/actionable-selector.ts +150 -0
  35. package/src/ngrx/index.ts +1 -0
  36. package/{public-api.d.ts → src/public-api.ts} +35 -16
  37. package/src/rxjs/defaultShareReplay.ts +8 -0
  38. package/{rxjs/index.d.ts → src/rxjs/index.ts} +5 -5
  39. package/src/rxjs/mapError.ts +8 -0
  40. package/src/rxjs/rxjs-operators.ts +132 -0
  41. package/src/rxjs/subjectifier.ts +17 -0
  42. package/src/rxjs/subscriber.directive.ts +57 -0
  43. package/src/specs/clickSubject.spec.ts +95 -0
  44. package/src/specs/dialog.spec.ts +101 -0
  45. package/src/specs/toggleGroupDirective.spec.ts +229 -0
  46. package/src/table-builder/classes/DefaultSettings.ts +11 -0
  47. package/src/table-builder/classes/MatTableObservableDataSource.ts +23 -0
  48. package/src/table-builder/classes/TableBuilderConfig.ts +42 -0
  49. package/src/table-builder/classes/TableBuilderDataSource.ts +66 -0
  50. package/src/table-builder/classes/TableState.ts +93 -0
  51. package/src/table-builder/classes/data-store.ts +10 -0
  52. package/{table-builder/classes/display-col.d.ts → src/table-builder/classes/display-col.ts} +5 -5
  53. package/src/table-builder/classes/filter-info.ts +123 -0
  54. package/src/table-builder/classes/table-builder-general-settings.ts +141 -0
  55. package/src/table-builder/classes/table-builder.ts +95 -0
  56. package/src/table-builder/classes/table-store.helpers.ts +102 -0
  57. package/src/table-builder/classes/table-store.ts +355 -0
  58. package/src/table-builder/components/array-column.component.ts +34 -0
  59. package/src/table-builder/components/column-builder/column-builder.component.html +69 -0
  60. package/src/table-builder/components/column-builder/column-builder.component.scss +43 -0
  61. package/src/table-builder/components/column-builder/column-builder.component.spec.ts +49 -0
  62. package/src/table-builder/components/column-builder/column-builder.component.ts +128 -0
  63. package/src/table-builder/components/column-builder/column-helpers.ts +52 -0
  64. package/src/table-builder/components/date-filter/date-filter.component.html +23 -0
  65. package/src/table-builder/components/date-filter/date-filter.component.ts +22 -0
  66. package/src/table-builder/components/date-time-filter/date-time-filter.component.html +9 -0
  67. package/src/table-builder/components/date-time-filter/date-time-filter.component.ts +20 -0
  68. package/src/table-builder/components/filter/filter.component.html +91 -0
  69. package/src/table-builder/components/filter/filter.component.scss +60 -0
  70. package/src/table-builder/components/filter/filter.component.spec.ts +87 -0
  71. package/src/table-builder/components/filter/filter.component.ts +59 -0
  72. package/src/table-builder/components/filter/in-list/in-list-filter.component.ts +85 -0
  73. package/src/table-builder/components/gen-col-displayer/gen-col-displayer.component.html +55 -0
  74. package/src/table-builder/components/gen-col-displayer/gen-col-displayer.component.scss +57 -0
  75. package/src/table-builder/components/gen-col-displayer/gen-col-displayer.component.ts +44 -0
  76. package/src/table-builder/components/generic-table/generic-table.component.html +77 -0
  77. package/src/table-builder/components/generic-table/generic-table.component.scss +38 -0
  78. package/src/table-builder/components/generic-table/generic-table.component.ts +330 -0
  79. package/src/table-builder/components/generic-table/paginator.component.ts +97 -0
  80. package/src/table-builder/components/group-by-list/group-by-list.component.css +8 -0
  81. package/src/table-builder/components/group-by-list/group-by-list.component.html +12 -0
  82. package/src/table-builder/components/group-by-list/group-by-list.component.spec.ts +23 -0
  83. package/src/table-builder/components/group-by-list/group-by-list.component.ts +18 -0
  84. package/src/table-builder/components/header-menu/header-menu.component.html +105 -0
  85. package/src/table-builder/components/header-menu/header-menu.component.scss +96 -0
  86. package/src/table-builder/components/header-menu/header-menu.component.ts +93 -0
  87. package/src/table-builder/components/in-filter/in-filter.component.css +3 -0
  88. package/src/table-builder/components/in-filter/in-filter.component.html +19 -0
  89. package/src/table-builder/components/in-filter/in-filter.component.ts +65 -0
  90. package/{table-builder/components/index.d.ts → src/table-builder/components/index.ts} +9 -9
  91. package/src/table-builder/components/initialization-component/initialization-component.html +29 -0
  92. package/src/table-builder/components/initialization-component/initialization-component.ts +22 -0
  93. package/src/table-builder/components/link-column.component.ts +45 -0
  94. package/src/table-builder/components/number-filter/number-filter.component.css +10 -0
  95. package/src/table-builder/components/number-filter/number-filter.component.html +22 -0
  96. package/src/table-builder/components/number-filter/number-filter.component.spec.ts +30 -0
  97. package/src/table-builder/components/number-filter/number-filter.component.ts +25 -0
  98. package/src/table-builder/components/profiles-menu/profiles-menu.component.html +73 -0
  99. package/src/table-builder/components/profiles-menu/profiles-menu.component.scss +126 -0
  100. package/src/table-builder/components/profiles-menu/profiles-menu.component.spec.ts +23 -0
  101. package/src/table-builder/components/profiles-menu/profiles-menu.component.ts +63 -0
  102. package/src/table-builder/components/scroll-strategy.ts +76 -0
  103. package/src/table-builder/components/sort-menu/sort-menu.component-store.ts +57 -0
  104. package/src/table-builder/components/sort-menu/sort-menu.component.html +109 -0
  105. package/src/table-builder/components/sort-menu/sort-menu.component.scss +119 -0
  106. package/src/table-builder/components/sort-menu/sort-menu.component.ts +88 -0
  107. package/{table-builder/components/table-container/table-container-imports.d.ts → src/table-builder/components/table-container/table-container-imports.ts} +27 -13
  108. package/src/table-builder/components/table-container/table-container.helpers/data-state.helpers.ts +141 -0
  109. package/src/table-builder/components/table-container/table-container.helpers/filter-state.helpers.ts +126 -0
  110. package/src/table-builder/components/table-container/table-container.helpers/groupBy.helpers.ts +86 -0
  111. package/src/table-builder/components/table-container/table-container.helpers/meta-data.helpers.ts +15 -0
  112. package/src/table-builder/components/table-container/table-container.helpers/sort-state.helpers.ts +45 -0
  113. package/src/table-builder/components/table-container/table-container.html +94 -0
  114. package/src/table-builder/components/table-container/table-container.scss +47 -0
  115. package/src/table-builder/components/table-container/table-container.spec.ts +154 -0
  116. package/src/table-builder/components/table-container/table-container.ts +307 -0
  117. package/src/table-builder/components/table-container/tableProps.ts +18 -0
  118. package/src/table-builder/components/table-container/virtual-scroll-container.ts +155 -0
  119. package/src/table-builder/components/table-container-filter/filter-list/filter-list.component.html +31 -0
  120. package/src/table-builder/components/table-container-filter/filter-list/filter-list.component.ts +44 -0
  121. package/src/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.css +42 -0
  122. package/src/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.html +10 -0
  123. package/src/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.spec.ts +85 -0
  124. package/src/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.ts +32 -0
  125. package/src/table-builder/components/table-container-filter/table-wrapper-filter-store.ts +23 -0
  126. package/src/table-builder/directives/custom-cell-directive.ts +58 -0
  127. package/{table-builder/directives/index.d.ts → src/table-builder/directives/index.ts} +6 -5
  128. package/src/table-builder/directives/multi-sort.directive.spec.ts +124 -0
  129. package/src/table-builder/directives/multi-sort.directive.ts +50 -0
  130. package/src/table-builder/directives/resize-column.directive.ts +107 -0
  131. package/src/table-builder/directives/table-wrapper.directive.ts +13 -0
  132. package/src/table-builder/directives/tb-filter.directive.ts +372 -0
  133. package/src/table-builder/enums/filterTypes.ts +40 -0
  134. package/src/table-builder/functions/boolean-filter-function.ts +12 -0
  135. package/src/table-builder/functions/date-filter-function.ts +68 -0
  136. package/src/table-builder/functions/download-data.ts +11 -0
  137. package/src/table-builder/functions/null-filter-function.ts +9 -0
  138. package/src/table-builder/functions/number-filter-function.ts +41 -0
  139. package/src/table-builder/functions/sort-data-function.ts +23 -0
  140. package/src/table-builder/functions/string-filter-function.ts +51 -0
  141. package/{table-builder/interfaces/ColumnInfo.d.ts → src/table-builder/interfaces/ColumnInfo.ts} +7 -6
  142. package/src/table-builder/interfaces/column-template.ts +9 -0
  143. package/{table-builder/interfaces/dictionary.d.ts → src/table-builder/interfaces/dictionary.ts} +3 -3
  144. package/src/table-builder/interfaces/report-def.ts +160 -0
  145. package/src/table-builder/ngrx/tableBuilderStateStore.ts +199 -0
  146. package/src/table-builder/pipes/column-total.pipe.ts +16 -0
  147. package/src/table-builder/pipes/format-filter-type.pipe.ts +12 -0
  148. package/src/table-builder/pipes/format-filter-value.pipe.ts +42 -0
  149. package/src/table-builder/pipes/key-display.ts +13 -0
  150. package/src/table-builder/services/export-to-csv.service.ts +75 -0
  151. package/src/table-builder/services/link-creator.service.ts +67 -0
  152. package/src/table-builder/services/table-template-service.ts +59 -0
  153. package/src/table-builder/services/transform-creator.ts +94 -0
  154. package/src/table-builder/specs/table-custom-filters.spec.ts +262 -0
  155. package/src/table-builder/styles/collapser.styles.scss +16 -0
  156. package/src/table-builder/table-builder.module.ts +73 -0
  157. package/src/test.ts +17 -0
  158. package/src/utilities/array-helpers.ts +13 -0
  159. package/src/utilities/directives/auto-focus.directive.ts +20 -0
  160. package/src/utilities/directives/clickEmitterDirective.ts +15 -0
  161. package/src/utilities/directives/clickSubject.ts +19 -0
  162. package/src/utilities/directives/conditional-classes.directive.ts +35 -0
  163. package/src/utilities/directives/dialog-service.ts +19 -0
  164. package/src/utilities/directives/dialog.ts +142 -0
  165. package/src/utilities/directives/mat-toggle-group-directive.ts +60 -0
  166. package/src/utilities/directives/prevent-enter.directive.ts +12 -0
  167. package/src/utilities/directives/stop-propagation.directive.ts +19 -0
  168. package/src/utilities/directives/styler.ts +39 -0
  169. package/src/utilities/directives/trim-whitespace.directive.ts +20 -0
  170. package/{utilities/index.d.ts → src/utilities/index.ts} +22 -15
  171. package/src/utilities/module.ts +55 -0
  172. package/src/utilities/pipes/function.pipe.ts +21 -0
  173. package/src/utilities/pipes/phone.pipe.ts +15 -0
  174. package/src/utilities/pipes/space-case.pipes.spec.ts +47 -0
  175. package/src/utilities/pipes/space-case.pipes.ts +26 -0
  176. package/tsconfig.lib.json +19 -0
  177. package/tsconfig.lib.prod.json +10 -0
  178. package/tsconfig.spec.json +17 -0
  179. package/action-state/action-state-spinner/action-state-spinner.component.d.ts +0 -12
  180. package/action-state/action-state-ui/action-state-ui.module.d.ts +0 -7
  181. package/action-state/ngrx-ext/ngrx-ext.module.d.ts +0 -8
  182. package/action-state/ngrx.d.ts +0 -31
  183. package/fesm2022/one-paragon-angular-utilities.mjs +0 -5681
  184. package/fesm2022/one-paragon-angular-utilities.mjs.map +0 -1
  185. package/http-request-state/HttpRequestStateFactory.d.ts +0 -17
  186. package/http-request-state/HttpRequestStateStore.d.ts +0 -58
  187. package/http-request-state/directives/HttpStateDirectiveBase.d.ts +0 -14
  188. package/http-request-state/directives/http-error-state-directive.d.ts +0 -9
  189. package/http-request-state/directives/http-inProgress-state-directive.d.ts +0 -9
  190. package/http-request-state/directives/http-notStarted-state-directive.d.ts +0 -9
  191. package/http-request-state/directives/http-success-state-directive.d.ts +0 -16
  192. package/http-request-state/directives/request-state-directive.d.ts +0 -34
  193. package/http-request-state/helpers.d.ts +0 -9
  194. package/http-request-state/http-request-state.d.ts +0 -12
  195. package/http-request-state/http-state-module.d.ts +0 -11
  196. package/http-request-state/rxjs/getRequestorBody.d.ts +0 -3
  197. package/http-request-state/rxjs/getRequestorState.d.ts +0 -3
  198. package/http-request-state/rxjs/tapError.d.ts +0 -3
  199. package/http-request-state/rxjs/tapSuccess.d.ts +0 -3
  200. package/http-request-state/types.d.ts +0 -41
  201. package/index.d.ts +0 -5
  202. package/ngrx/actionable-selector.d.ts +0 -31
  203. package/ngrx/index.d.ts +0 -1
  204. package/rxjs/defaultShareReplay.d.ts +0 -2
  205. package/rxjs/mapError.d.ts +0 -2
  206. package/rxjs/rxjs-operators.d.ts +0 -13
  207. package/rxjs/subjectifier.d.ts +0 -8
  208. package/rxjs/subscriber.directive.d.ts +0 -14
  209. package/table-builder/classes/DefaultSettings.d.ts +0 -9
  210. package/table-builder/classes/MatTableObservableDataSource.d.ts +0 -9
  211. package/table-builder/classes/TableBuilderConfig.d.ts +0 -23
  212. package/table-builder/classes/TableBuilderDataSource.d.ts +0 -18
  213. package/table-builder/classes/TableState.d.ts +0 -66
  214. package/table-builder/classes/data-store.d.ts +0 -8
  215. package/table-builder/classes/filter-info.d.ts +0 -37
  216. package/table-builder/classes/table-builder-general-settings.d.ts +0 -85
  217. package/table-builder/classes/table-builder.d.ts +0 -18
  218. package/table-builder/classes/table-store.d.ts +0 -130
  219. package/table-builder/classes/table-store.helpers.d.ts +0 -28
  220. package/table-builder/components/array-column.component.d.ts +0 -15
  221. package/table-builder/components/column-builder/column-builder.component.d.ts +0 -40
  222. package/table-builder/components/column-builder/column-helpers.d.ts +0 -36
  223. package/table-builder/components/date-filter/date-filter.component.d.ts +0 -37
  224. package/table-builder/components/date-time-filter/date-time-filter.component.d.ts +0 -37
  225. package/table-builder/components/filter/filter.component.d.ts +0 -46
  226. package/table-builder/components/filter/in-list/in-list-filter.component.d.ts +0 -23
  227. package/table-builder/components/gen-col-displayer/gen-col-displayer.component.d.ts +0 -17
  228. package/table-builder/components/generic-table/generic-table.component.d.ts +0 -72
  229. package/table-builder/components/generic-table/paginator.component.d.ts +0 -28
  230. package/table-builder/components/group-by-list/group-by-list.component.d.ts +0 -7
  231. package/table-builder/components/header-menu/header-menu.component.d.ts +0 -49
  232. package/table-builder/components/in-filter/in-filter.component.d.ts +0 -20
  233. package/table-builder/components/initialization-component/initialization-component.d.ts +0 -13
  234. package/table-builder/components/link-column.component.d.ts +0 -25
  235. package/table-builder/components/number-filter/number-filter.component.d.ts +0 -39
  236. package/table-builder/components/profiles-menu/profiles-menu.component.d.ts +0 -32
  237. package/table-builder/components/scroll-strategy.d.ts +0 -22
  238. package/table-builder/components/sort-menu/sort-menu.component-store.d.ts +0 -24
  239. package/table-builder/components/sort-menu/sort-menu.component.d.ts +0 -19
  240. package/table-builder/components/table-container/table-container.d.ts +0 -83
  241. package/table-builder/components/table-container/table-container.helpers/data-state.helpers.d.ts +0 -6
  242. package/table-builder/components/table-container/table-container.helpers/filter-state.helpers.d.ts +0 -19
  243. package/table-builder/components/table-container/table-container.helpers/groupBy.helpers.d.ts +0 -17
  244. package/table-builder/components/table-container/table-container.helpers/meta-data.helpers.d.ts +0 -2
  245. package/table-builder/components/table-container/table-container.helpers/sort-state.helpers.d.ts +0 -8
  246. package/table-builder/components/table-container/tableProps.d.ts +0 -10
  247. package/table-builder/components/table-container/virtual-scroll-container.d.ts +0 -36
  248. package/table-builder/components/table-container-filter/filter-list/filter-list.component.d.ts +0 -15
  249. package/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.d.ts +0 -12
  250. package/table-builder/components/table-container-filter/table-wrapper-filter-store.d.ts +0 -14
  251. package/table-builder/directives/custom-cell-directive.d.ts +0 -32
  252. package/table-builder/directives/multi-sort.directive.d.ts +0 -10
  253. package/table-builder/directives/resize-column.directive.d.ts +0 -43
  254. package/table-builder/directives/table-wrapper.directive.d.ts +0 -8
  255. package/table-builder/directives/tb-filter.directive.d.ts +0 -113
  256. package/table-builder/enums/filterTypes.d.ts +0 -36
  257. package/table-builder/functions/boolean-filter-function.d.ts +0 -3
  258. package/table-builder/functions/date-filter-function.d.ts +0 -4
  259. package/table-builder/functions/download-data.d.ts +0 -1
  260. package/table-builder/functions/null-filter-function.d.ts +0 -2
  261. package/table-builder/functions/number-filter-function.d.ts +0 -4
  262. package/table-builder/functions/sort-data-function.d.ts +0 -6
  263. package/table-builder/functions/string-filter-function.d.ts +0 -5
  264. package/table-builder/interfaces/report-def.d.ts +0 -151
  265. package/table-builder/ngrx/tableBuilderStateStore.d.ts +0 -70
  266. package/table-builder/pipes/column-total.pipe.d.ts +0 -8
  267. package/table-builder/pipes/format-filter-type.pipe.d.ts +0 -8
  268. package/table-builder/pipes/format-filter-value.pipe.d.ts +0 -11
  269. package/table-builder/pipes/key-display.d.ts +0 -9
  270. package/table-builder/services/export-to-csv.service.d.ts +0 -14
  271. package/table-builder/services/link-creator.service.d.ts +0 -16
  272. package/table-builder/services/table-template-service.d.ts +0 -14
  273. package/table-builder/services/transform-creator.d.ts +0 -15
  274. package/table-builder/table-builder.module.d.ts +0 -21
  275. package/utilities/array-helpers.d.ts +0 -1
  276. package/utilities/directives/auto-focus.directive.d.ts +0 -9
  277. package/utilities/directives/clickEmitterDirective.d.ts +0 -7
  278. package/utilities/directives/clickSubject.d.ts +0 -9
  279. package/utilities/directives/conditional-classes.directive.d.ts +0 -13
  280. package/utilities/directives/dialog-service.d.ts +0 -10
  281. package/utilities/directives/dialog.d.ts +0 -44
  282. package/utilities/directives/mat-toggle-group-directive.d.ts +0 -21
  283. package/utilities/directives/prevent-enter.directive.d.ts +0 -6
  284. package/utilities/directives/stop-propagation.directive.d.ts +0 -7
  285. package/utilities/directives/styler.d.ts +0 -15
  286. package/utilities/directives/trim-whitespace.directive.d.ts +0 -7
  287. package/utilities/module.d.ts +0 -19
  288. package/utilities/pipes/function.pipe.d.ts +0 -11
  289. package/utilities/pipes/phone.pipe.d.ts +0 -7
  290. package/utilities/pipes/space-case.pipes.d.ts +0 -17
@@ -0,0 +1,87 @@
1
+ import { TestBed, ComponentFixture } from '@angular/core/testing';
2
+ import { FilterComponent } from '../filter/filter.component';
3
+ import { CommonModule, DatePipe } from '@angular/common';
4
+ import { FormsModule } from '@angular/forms';
5
+ import { FieldType } from '../../interfaces/report-def';
6
+ import { By } from '@angular/platform-browser';
7
+ import { NoopAnimationsModule } from '@angular/platform-browser/animations';
8
+ import { SpaceCasePipe } from '../../../utilities/pipes/space-case.pipes';
9
+ import { DateFilterComponent } from '../date-filter/date-filter.component';
10
+ import { FilterTypes } from '../../enums/filterTypes';
11
+ import {TestbedHarnessEnvironment} from '@angular/cdk/testing/testbed';
12
+ import {MatButtonHarness} from '@angular/material/button/testing';
13
+ import { MatSelectHarness } from '@angular/material/select/testing';
14
+ import { HarnessLoader } from '@angular/cdk/testing';
15
+ import { OptionHarnessFilters } from '@angular/material/core/testing';
16
+ import { TableBuilderConfigToken } from '../../classes/TableBuilderConfig';
17
+ import { provideMockStore } from '@ngrx/store/testing';
18
+ import { isObservable } from 'rxjs';
19
+
20
+ function fillInput<T>(fixture: ComponentFixture<T>, name: string, value: string) {
21
+ const input = fixture.debugElement.query(By.css('input[name=' + name + ']')).nativeElement as HTMLInputElement;
22
+ input.value = value;
23
+ input.dispatchEvent(new Event('input'));
24
+ fixture.detectChanges();
25
+ }
26
+
27
+ async function setSelect(loader: HarnessLoader, filter: Pick<OptionHarnessFilters, 'isSelected' | 'selector' | 'text'>) {
28
+ const select = await loader.getHarness<MatSelectHarness>(MatSelectHarness);
29
+ await select.open();
30
+ await select.clickOptions(filter);
31
+ }
32
+
33
+ describe('filter component', () => {
34
+
35
+ beforeEach(() => {
36
+
37
+ TestBed.configureTestingModule({
38
+ declarations: [FilterComponent, DatePipe, SpaceCasePipe, DateFilterComponent],
39
+ providers: [
40
+ DatePipe,
41
+ { provide : TableBuilderConfigToken , useValue: {defaultTableState: { }}},
42
+ provideMockStore({ initialState: {} }),
43
+ ],
44
+ imports: [
45
+ NoopAnimationsModule,
46
+ CommonModule,
47
+ FormsModule,
48
+ ]
49
+ })
50
+ .compileComponents();
51
+ });
52
+
53
+ it('filter info object should be populated', async () => {
54
+ const fixture = TestBed.createComponent(FilterComponent);
55
+ const component = fixture.componentInstance;
56
+
57
+ const originFunc = component.state.addFilter;
58
+
59
+ const spy = spyOn(component.state, 'addFilter');
60
+
61
+
62
+
63
+ spy.and.callFake( a => {
64
+ if(isObservable(a)) {
65
+ throw new Error('Observable not supported');
66
+ } else {
67
+ expect(a.filterType).toBe(FilterTypes.StringContains);
68
+ expect(a.filterValue).toBe('a');
69
+ }
70
+ return originFunc(a);
71
+ });
72
+
73
+ component.filter = {
74
+ key: 'name',
75
+ fieldType: FieldType.String
76
+ };
77
+
78
+ const loader = TestbedHarnessEnvironment.loader(fixture);
79
+ const button = await loader.getHarness<MatButtonHarness>(MatButtonHarness.with( {text: 'Apply'}));
80
+
81
+ await setSelect(loader, {text: 'Contains'});
82
+ fillInput(fixture, 'filterValue', 'a');
83
+ await button.click();
84
+
85
+ expect(spy).toHaveBeenCalled();
86
+ });
87
+ });
@@ -0,0 +1,59 @@
1
+ import { Component, ChangeDetectionStrategy, inject, input, computed, output, signal } from '@angular/core';
2
+ import { filterTypeMap, FilterInfo, PartialFilter } from '../../classes/filter-info';
3
+ import { TableStore } from '../../classes/table-store';
4
+ import { FilterType, FilterTypes } from '../../enums/filterTypes';
5
+ import { FieldType } from '../../interfaces/report-def';
6
+ import { MatCardModule } from '@angular/material/card';
7
+ import { NgTemplateOutlet } from '@angular/common';
8
+ import { FormsModule } from '@angular/forms';
9
+ import { SpaceCasePipe } from '../../../utilities';
10
+ import { MatButtonModule } from '@angular/material/button';
11
+ import { MatTooltipModule } from '@angular/material/tooltip';
12
+ import { MatIconModule } from '@angular/material/icon';
13
+ import { MatInputModule } from '@angular/material/input';
14
+ import { MatSelectModule } from '@angular/material/select';
15
+ import { NumberFilterComponent } from '../number-filter/number-filter.component';
16
+ import { DateFilterComponent } from '../date-filter/date-filter.component';
17
+ import { DateTimeFilterComponent } from '../date-time-filter/date-time-filter.component';
18
+ import { MatRadioModule } from '@angular/material/radio';
19
+ import { InFilterComponent } from '../in-filter/in-filter.component';
20
+ import { InListFilterComponent } from './in-list/in-list-filter.component';
21
+
22
+ @Component({
23
+ selector: 'tb-filter',
24
+ templateUrl: './filter.component.html',
25
+ styleUrls: ['./filter.component.scss'],
26
+ changeDetection: ChangeDetectionStrategy.OnPush,
27
+ imports: [
28
+ MatCardModule, FormsModule, SpaceCasePipe, MatButtonModule, MatTooltipModule, MatIconModule,
29
+ MatInputModule, MatSelectModule, NumberFilterComponent,
30
+ DateFilterComponent, DateTimeFilterComponent, MatRadioModule, InFilterComponent, InListFilterComponent,
31
+ NgTemplateOutlet
32
+ ]
33
+ })
34
+ export class FilterComponent {
35
+ protected state = inject(TableStore);
36
+
37
+ filterTypes = filterTypeMap;
38
+ FilterType = FilterTypes;
39
+ FieldType = FieldType;
40
+
41
+ $filter = input.required<PartialFilter, PartialFilter>({
42
+ alias: 'filter',
43
+ transform: (f) => ({ ...f })
44
+ });
45
+
46
+ close = output();
47
+
48
+ $enteredFilterType = signal<FilterType | undefined>(undefined);
49
+ $currentFilterType = computed(() => this.$enteredFilterType() || this.$filter()?.filterType);
50
+ $availableFilterTypes = computed(() => this.filterTypes[this.$filter()?.fieldType]);
51
+
52
+ onEnter(filter: FilterInfo, event: any) {
53
+ event.preventDefault();
54
+ if (filter.filterValue != null && filter.filterType) {
55
+ this.state.addFilter(filter);
56
+ this.close.emit();
57
+ }
58
+ }
59
+ }
@@ -0,0 +1,85 @@
1
+ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, computed, inject, input, signal } from '@angular/core';
2
+ import { ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms';
3
+ import { TableStore } from '../../../classes/table-store';
4
+ import { FieldType } from '../../../interfaces/report-def';
5
+ import { KeyValuePipe } from '@angular/common';
6
+ import { MatCheckboxModule } from '@angular/material/checkbox';
7
+ import { FunctionPipe, SpaceCasePipe, StopPropagationDirective } from '../../../../utilities';
8
+
9
+
10
+ @Component({
11
+ selector: 'tb-in-list-filter , [tb-in-list-filter]',
12
+ template: `
13
+ @for (item of $keyValues() | keyvalue; track item.key) {
14
+ <div>
15
+ <mat-checkbox [checked]="'includes' | func : $selectedKeys() : item.key" stop-propagation (change)='selectFilterChanged($event, item.key)' >
16
+ {{$metaData().fieldType === FieldType.Enum ? (item.value | spaceCase) : item.value}}
17
+ </mat-checkbox>
18
+ </div>
19
+ }
20
+
21
+ `,
22
+ changeDetection: ChangeDetectionStrategy.OnPush,
23
+ providers: [{
24
+ provide: NG_VALUE_ACCESSOR,
25
+ useExisting: InListFilterComponent,
26
+ multi: true
27
+ }],
28
+ imports: [
29
+ KeyValuePipe, MatCheckboxModule, StopPropagationDirective, SpaceCasePipe, FunctionPipe
30
+ ]
31
+ })
32
+ export class InListFilterComponent implements ControlValueAccessor {
33
+ private ref = inject(ChangeDetectorRef);
34
+ private tableState = inject(TableStore);
35
+
36
+ value: string[] = [];
37
+ FieldType = FieldType;
38
+ writeValue(obj: string[]): void {
39
+ this.value = obj;
40
+
41
+ if(this.value) {
42
+ this.$selectedKeys.set(this.value.map( f => f ));
43
+ }
44
+ this.ref.markForCheck();
45
+ }
46
+
47
+ onChange = (_: any) => { };
48
+
49
+ registerOnChange(fn: any): void {
50
+ this.onChange = fn;
51
+ }
52
+ onTouched = () => { };
53
+ registerOnTouched(fn: any): void {
54
+ this.onTouched = fn;
55
+ }
56
+
57
+ $key = input.required<string>({ alias: 'key' });
58
+ $selectedKeys = signal<string[]>([]);
59
+ $metaData = computed(() => this.tableState.$getMetaData(this.$key())());
60
+ $keyValues = computed((): {
61
+ [key: number]: string;
62
+ } => {
63
+ const metaData = this.$metaData();
64
+ if(metaData?.additional?.filterOptions?.filterableValues ) {
65
+ return metaData.additional.filterOptions.filterableValues.reduce((prev: any, cur)=> { prev[cur] = cur; return prev }, {});
66
+ } else {
67
+ if(metaData?.fieldType === FieldType.Enum ) {
68
+ return metaData.additional!.enumMap!;
69
+ }
70
+ }
71
+ return {};
72
+ });
73
+
74
+ selectFilterChanged($event, val: string) {
75
+ if($event.checked) {
76
+ this.$selectedKeys.update( keys => [...keys, val]);
77
+ } else {
78
+ this.$selectedKeys.update(keys => keys.filter( item => item !== val));
79
+ }
80
+
81
+ this.value = this.$selectedKeys();
82
+ this.onChange(this.value);
83
+ }
84
+
85
+ }
@@ -0,0 +1,55 @@
1
+ @if($columns(); as displayCols){
2
+ <span matTooltip="Show/hide columns">
3
+ <button mat-icon-button [matMenuTriggerFor]="menu">
4
+ <mat-icon color="primary">visibility_off</mat-icon>
5
+ </button>
6
+ </span>
7
+ <mat-menu #menu="matMenu" class="my-mat-menu">
8
+
9
+ <button mat-menu-item>
10
+ <span matTooltip="Close">
11
+ <button class="filter-button" mat-icon-button>
12
+ <mat-icon>close</mat-icon>
13
+ </button>
14
+ </span>
15
+ </button>
16
+
17
+ <button mat-menu-item stop-propagation>
18
+ <span matTooltip="Show all columns">
19
+ <button mat-icon-button (click)="reset(displayCols)">
20
+ <mat-icon color="primary">done_all</mat-icon>
21
+ </button>
22
+ </span>
23
+
24
+ <span matTooltip="Hide all columns">
25
+ <button mat-icon-button (click)="unset(displayCols)">
26
+ <mat-icon color="primary">cancel</mat-icon>
27
+ </button>
28
+ </span>
29
+ </button>
30
+
31
+ <div cdkDropList (cdkDropListDropped)="drop($event)" stop-propagation [cdkDropListLockAxis]="'y'">
32
+ @for (col of displayCols; track col.key) {
33
+ <button [class.isHidden]="!col.isVisible" stop-propagation mat-menu-item cdkDrag [cdkDragData]="col">
34
+ <div (click)="col.isVisible = !col.isVisible; emit(displayCols)" style="display: flex; align-items: center;">
35
+ @if(col.isVisible){
36
+ <button mat-icon-button matTooltip="Hide Column" class="show-hide">
37
+ <mat-icon color="primary">check_box</mat-icon>
38
+ </button>
39
+ } @else {
40
+ <button mat-icon-button matTooltip="Show Column" class="show-hide">
41
+ <mat-icon>indeterminate_check_box</mat-icon>
42
+ </button>
43
+ }
44
+
45
+ <p class="label">
46
+ {{col.displayName || (col.key | spaceCase) }}
47
+ </p>
48
+
49
+ </div>
50
+ </button>
51
+ }
52
+
53
+ </div>
54
+ </mat-menu>
55
+ }
@@ -0,0 +1,57 @@
1
+ .show-hide {
2
+ margin-right: 15px;
3
+ height: 24px;
4
+ width: 24px;
5
+ padding: 4px;
6
+ }
7
+
8
+ .label {
9
+ color: cornflowerblue;
10
+ text-overflow: ellipsis;
11
+ overflow: hidden;
12
+ white-space: nowrap;
13
+ text-align: left;
14
+ margin: 0;
15
+ font-size: 17px;
16
+ font-weight: 700;
17
+ display: inline-block;
18
+ width: 66%;
19
+ }
20
+
21
+ .row {
22
+ margin: 0;
23
+ padding: 0;
24
+ }
25
+
26
+ .isHidden {
27
+ background-color: lightgrey;
28
+ color: darkgray;
29
+ font-weight: 700;
30
+ font-size: 17px;
31
+ white-space: nowrap;
32
+ }
33
+
34
+ .filter-button {
35
+ margin-top: 10px;
36
+ }
37
+
38
+ .cdk-drag-preview {
39
+ box-sizing: border-box;
40
+ border-radius: 4px;
41
+ box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2),
42
+ 0 8px 10px 1px rgba(0, 0, 0, 0.14),
43
+ 0 3px 14px 2px rgba(0, 0, 0, 0.12);
44
+ }
45
+
46
+ .cdk-drag-placeholder {
47
+ opacity: 0;
48
+ }
49
+
50
+ .cdk-drag-animating {
51
+ transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
52
+ }
53
+ .mdc-list-item__primary-text{
54
+ display: inline-block;
55
+ width: 100%;
56
+ }
57
+
@@ -0,0 +1,44 @@
1
+ import { Component, ChangeDetectionStrategy, inject, computed } from '@angular/core';
2
+ import { DisplayCol } from '../../classes/display-col';
3
+ import { TableStore } from '../../classes/table-store';
4
+ import {CdkDragDrop, DragDropModule} from '@angular/cdk/drag-drop';
5
+ import { MatTooltipModule } from '@angular/material/tooltip';
6
+ import { MatIconModule } from '@angular/material/icon';
7
+ import { MatButtonModule } from '@angular/material/button';
8
+ import { MatMenuModule } from '@angular/material/menu';
9
+ import { SpaceCasePipe, StopPropagationDirective } from '../../../utilities';
10
+
11
+ @Component({
12
+ selector: 'tb-col-displayer',
13
+ templateUrl: './gen-col-displayer.component.html',
14
+ styleUrls: ['./gen-col-displayer.component.scss'],
15
+ changeDetection: ChangeDetectionStrategy.OnPush ,
16
+ imports: [
17
+ MatTooltipModule, MatIconModule, MatButtonModule, MatMenuModule, StopPropagationDirective,
18
+ DragDropModule, SpaceCasePipe
19
+ ]
20
+ })
21
+ export class GenColDisplayerComponent {
22
+ private tableState = inject(TableStore);
23
+ $columns = computed(() => this.tableState.$orderedCodeVisibleMetaDatas().map( md => ({
24
+ key: md.key,
25
+ displayName: md.displayName,
26
+ isVisible: !this.tableState.$hiddenKeys().includes(md.key)
27
+ })));
28
+
29
+ reset(displayCols: DisplayCol[]) {
30
+ displayCols.forEach(c => c.isVisible = true);
31
+ this.emit(displayCols);
32
+ }
33
+ drop(event: CdkDragDrop<string[]>) {
34
+ this.tableState.setUserDefinedOrder({ newOrder: event.currentIndex, oldOrder:event.previousIndex })
35
+ }
36
+ unset(displayCols: DisplayCol[]) {
37
+ displayCols.forEach(c => c.isVisible = false);
38
+ this.emit(displayCols);
39
+ }
40
+
41
+ emit(displayCols: DisplayCol[]) {
42
+ this.tableState.setHiddenColumns(displayCols.map( c => ({key: c.key, visible: c.isVisible})));
43
+ }
44
+ }
@@ -0,0 +1,77 @@
1
+ <mat-table
2
+ cdkDropList
3
+ cdkDropListLockAxis='x'
4
+ cdkDropListOrientation="horizontal"
5
+ (cdkDropListDropped)="drop($event)"
6
+ class="table-drag-list"
7
+ #table
8
+ [dataSource]="$dataSource()"
9
+ [trackBy]="$trackByFunction()"
10
+ [style]="$tableWidth()"
11
+ >
12
+
13
+ <!-- select column -->
14
+ <ng-container matColumnDef="select">
15
+ @let selection = $selection();
16
+ <mat-header-cell *matHeaderCellDef class="select-column">
17
+ <mat-checkbox (change)="$event ? masterToggle() : null"
18
+ [checked]="!!($masterToggleChecked())"
19
+ [indeterminate]="$masterToggleIndeterminate()">
20
+ </mat-checkbox>
21
+ </mat-header-cell>
22
+
23
+ <mat-cell *matCellDef="let row" class="select-column">
24
+ <mat-checkbox
25
+ (click)="$event.stopPropagation()"
26
+ (change)="$event ? selection.toggle(row) : null"
27
+ [checked]="selection.isSelected(row)"/>
28
+ </mat-cell>
29
+
30
+ <mat-footer-cell *matFooterCellDef class="select-column">
31
+ {{ selection.selected.length }}
32
+ </mat-footer-cell>
33
+ </ng-container>
34
+
35
+
36
+ <!-- index column -->
37
+ <ng-container matColumnDef="index">
38
+ <mat-header-cell *matHeaderCellDef class="f-mat-header-cell" class="index-column">#
39
+ </mat-header-cell>
40
+ <mat-cell *matCellDef="let i = index;" class="index-column">
41
+ {{ 1 + i + $offsetIndex() }}
42
+ </mat-cell>
43
+ <mat-footer-cell *matFooterCellDef class="index-column"></mat-footer-cell>
44
+ </ng-container>
45
+
46
+ <!-- Grouping -->
47
+ <ng-container matColumnDef="groupHeader">
48
+ <mat-cell *matCellDef="let row">
49
+ @let expanded = (state.$getIsExpanded | func : row.key : row.groupName );
50
+ <div [style.paddingLeft]="row.padding + 'px !important'">
51
+ <button mat-icon-button (click)="setExpanded(row.key, row.groupName, !expanded());">
52
+ @if (!expanded()) {
53
+ <mat-icon>chevron_right</mat-icon>
54
+ } @else {
55
+ <mat-icon>expand_more</mat-icon>
56
+ }
57
+ </button>
58
+ {{ getTransform | func : row.key : row.groupHeaderDisplay }} ({{ row.length }})
59
+ </div>
60
+ <div style="flex-grow: 1">
61
+ <ng-container *ngTemplateOutlet="state.$props().groupHeaderTemplate!; context: { element: row }"></ng-container>
62
+ </div>
63
+ </mat-cell>
64
+ </ng-container>
65
+
66
+ <mat-row [style.height]="$rowHeight()" [style.min-height]="$rowHeight()"
67
+ *matRowDef="let row; columns: $keys(); let i = index"/>
68
+ <mat-row [style.height]="state.$props().groupHeaderHeight ? state.$props().groupHeaderHeight + 'px' : $groupHeaderHeight()"
69
+ [style.min-height]="state.$props().groupHeaderHeight ? state.$props().groupHeaderHeight + 'px' : $groupHeaderHeight()"
70
+ *matRowDef="let row; columns: ['groupHeader']; when: isGroupHeader" style="background-color: white;"/>
71
+ </mat-table>
72
+
73
+ <mat-header-row [style.height]="$headerHeight()" [style.min-height]="$headerHeight()"
74
+ *matHeaderRowDef="$keys(); sticky: state.$props().isSticky" [style.top.px]="($offset()! * -1)"/>
75
+ <mat-footer-row [style.height]="$footerHeight()" [style.min-height]="$footerHeight()"
76
+ *matFooterRowDef="$keys(); sticky: $stickyFooter() "
77
+ [style.bottom.px]="$stickyFooter() ? ($offset()) : undefined"/>
@@ -0,0 +1,38 @@
1
+ :host{
2
+ --mat-paginator-container-size: initial;
3
+ }
4
+ .select-column {
5
+ min-width: var(--tb-min-select-column-width, 42px)
6
+ }
7
+ .index-column {
8
+ min-width: var(--tb-min-index-column-width, 42px)
9
+ }
10
+ .mat-mdc-row:nth-child(odd) {
11
+ background-color: var(--tb-odd-row-background-color, #cdeefe);
12
+ }
13
+ .page-amounts{
14
+ color: rgba(0, 0, 0, 0.54);
15
+ font-family: Roboto, "Helvetica Neue", sans-serif;
16
+ font-size: 12px;
17
+ margin-right: .2rem;
18
+ }
19
+
20
+ :host::ng-deep .table-drag-list.cdk-drop-list-dragging .drag-header:not(.cdk-drag-placeholder) {
21
+ transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
22
+ }
23
+
24
+ :host::ng-deep{
25
+ & .mdc-data-table__cell, .mdc-data-table__header-cell, .mdc-data-table__cell, .mdc-data-table__header-cell{
26
+ padding: var(--tb-cell-padding, 0 0 0 .2rem);
27
+ line-height: var(--tb-cell-line-height, normal);
28
+ }
29
+ }
30
+
31
+ ::ng-deep .op-date-time-input{
32
+ line-height: 3rem;
33
+ font-size: .9rem;
34
+ font-family: Roboto, "Helvetica Neue", sans-serif;
35
+ padding-left: 0.2rem;
36
+ width: 12rem;
37
+
38
+ }