@unifylib/ui-lib 1.0.3 → 1.1.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 (259) hide show
  1. package/esm2022/iq-ui-lib.mjs +5 -0
  2. package/esm2022/lib/base-model/SearchStrConfig.mjs +11 -0
  3. package/esm2022/lib/base-model/api-response.mjs +2 -0
  4. package/esm2022/lib/base-model/audit-log-entry.mjs +3 -0
  5. package/esm2022/lib/base-model/button-action-settings.mjs +16 -0
  6. package/esm2022/lib/base-model/column-def.model.mjs +28 -0
  7. package/esm2022/lib/base-model/do-action-request.mjs +8 -0
  8. package/esm2022/lib/base-model/field-action.mjs +6 -0
  9. package/esm2022/lib/base-model/field-filter.model.mjs +3 -0
  10. package/esm2022/lib/base-model/field-info.mjs +57 -0
  11. package/esm2022/lib/base-model/field-predicate.model.mjs +10 -0
  12. package/esm2022/lib/base-model/filter-request.mjs +13 -0
  13. package/esm2022/lib/base-model/filter.model.mjs +25 -0
  14. package/esm2022/lib/base-model/get-items-list.mjs +10 -0
  15. package/esm2022/lib/base-model/index.mjs +12 -0
  16. package/esm2022/lib/base-model/items-total.model.mjs +8 -0
  17. package/esm2022/lib/base-model/line-item.model.mjs +11 -0
  18. package/esm2022/lib/base-model/lookupItem.mjs +16 -0
  19. package/esm2022/lib/base-model/page-info.mjs +17 -0
  20. package/esm2022/lib/base-model/report-request.model.mjs +17 -0
  21. package/esm2022/lib/base-model/response-envelop.model.mjs +10 -0
  22. package/esm2022/lib/base-model/snack-message.model.mjs +11 -0
  23. package/esm2022/lib/base-model/table-column.interface.mjs +2 -0
  24. package/esm2022/lib/base-model/table-page-user-action.interface.mjs +21 -0
  25. package/esm2022/lib/base-model/workflow/workflow-steps.model.mjs +9 -0
  26. package/esm2022/lib/base-model/workflow/workflow.model.mjs +42 -0
  27. package/esm2022/lib/components/action-comment/action-comment.component.mjs +101 -0
  28. package/esm2022/lib/components/action-confirmation/action-confirmation.component.mjs +55 -0
  29. package/esm2022/lib/components/activity-report-form/activity-report-form.component.mjs +499 -0
  30. package/esm2022/lib/components/advanced-filter/field-filter/field-filter.component.mjs +41 -0
  31. package/esm2022/lib/components/advanced-filter/filter-builder/filter-builder.component.mjs +162 -0
  32. package/esm2022/lib/components/audit-log-details-dialog/audit-log-details-dialog.component.mjs +70 -0
  33. package/esm2022/lib/components/audit-log-list/audit-log.component.mjs +99 -0
  34. package/esm2022/lib/components/auto-complete/auto-complete.component.mjs +292 -0
  35. package/esm2022/lib/components/base-form/base-form.component.mjs +297 -0
  36. package/esm2022/lib/components/base-form-canvas/base-form-canvas.component.mjs +591 -0
  37. package/esm2022/lib/components/base-input-dialog/base-input-dialog.component.mjs +72 -0
  38. package/esm2022/lib/components/base-table/base-table.component.mjs +514 -0
  39. package/esm2022/lib/components/button-actions/button-actions.component.mjs +70 -0
  40. package/esm2022/lib/components/editable-base-table/editable-base-table.component.mjs +496 -0
  41. package/esm2022/lib/components/equation-builder/equation-builder.component.mjs +112 -0
  42. package/esm2022/lib/components/item-line-editor/item-line-editor.component.mjs +299 -0
  43. package/esm2022/lib/components/multi-auto-complete/multi-auto-complete.component.mjs +278 -0
  44. package/esm2022/lib/components/paginator/paginator.component.mjs +91 -0
  45. package/esm2022/lib/components/report-details-dialog/report-details-dialog.component.mjs +102 -0
  46. package/esm2022/lib/components/report-form/report-form.component.mjs +498 -0
  47. package/esm2022/lib/components/search-bar/search-bar.component.mjs +62 -0
  48. package/esm2022/lib/components/section-form-canvas/section-form-canvas.component.mjs +81 -0
  49. package/esm2022/lib/components/shared/action-button/action-button.component.mjs +59 -0
  50. package/esm2022/lib/components/shared/action-card/action-card.component.mjs +93 -0
  51. package/esm2022/lib/components/shared/attachment-uploader/attachment-uploader.component.mjs +70 -0
  52. package/esm2022/lib/components/shared-list/shared-list.component.mjs +47 -0
  53. package/esm2022/lib/components/snackbar-static/snackbar-static.component.mjs +43 -0
  54. package/esm2022/lib/components/title-bar/title-bar.component.mjs +119 -0
  55. package/esm2022/lib/services/backend-service.mjs +240 -0
  56. package/esm2022/lib/services/index.mjs +4 -0
  57. package/esm2022/lib/services/top-panel.mjs +22 -0
  58. package/esm2022/lib/services/trigger-form.service.mjs +17 -0
  59. package/esm2022/lib/utils/base-utils.mjs +97 -0
  60. package/esm2022/lib/validators/date-range-validator.mjs +27 -0
  61. package/esm2022/lib/validators/index.mjs +4 -0
  62. package/esm2022/lib/validators/match-list.validator.mjs +9 -0
  63. package/esm2022/lib/validators/multi-email-validator.mjs +13 -0
  64. package/esm2022/public-api.mjs +29 -0
  65. package/esm2022/q-btech-ui-lib.mjs +5 -0
  66. package/esm2022/unifylib-ui-lib.mjs +5 -0
  67. package/fesm2022/iq-ui-lib.mjs +5625 -0
  68. package/fesm2022/iq-ui-lib.mjs.map +1 -0
  69. package/fesm2022/q-btech-ui-lib.mjs +5619 -0
  70. package/fesm2022/q-btech-ui-lib.mjs.map +1 -0
  71. package/fesm2022/unifylib-ui-lib.mjs +5625 -0
  72. package/fesm2022/unifylib-ui-lib.mjs.map +1 -0
  73. package/index.d.ts +5 -0
  74. package/lib/base-model/SearchStrConfig.d.ts +8 -0
  75. package/{src/lib/base-model/api-response.ts → lib/base-model/api-response.d.ts} +5 -7
  76. package/lib/base-model/audit-log-entry.d.ts +7 -0
  77. package/lib/base-model/button-action-settings.d.ts +15 -0
  78. package/lib/base-model/column-def.model.d.ts +11 -0
  79. package/lib/base-model/do-action-request.d.ts +10 -0
  80. package/lib/base-model/field-action.d.ts +6 -0
  81. package/lib/base-model/field-filter.model.d.ts +7 -0
  82. package/lib/base-model/field-info.d.ts +53 -0
  83. package/lib/base-model/field-predicate.model.d.ts +7 -0
  84. package/lib/base-model/filter-request.d.ts +15 -0
  85. package/lib/base-model/filter.model.d.ts +22 -0
  86. package/lib/base-model/get-items-list.d.ts +21 -0
  87. package/lib/base-model/index.d.ts +11 -0
  88. package/lib/base-model/items-total.model.d.ts +6 -0
  89. package/lib/base-model/line-item.model.d.ts +9 -0
  90. package/lib/base-model/lookupItem.d.ts +13 -0
  91. package/{src/lib/base-model/page-info.ts → lib/base-model/page-info.d.ts} +25 -24
  92. package/lib/base-model/report-request.model.d.ts +18 -0
  93. package/lib/base-model/response-envelop.model.d.ts +8 -0
  94. package/lib/base-model/snack-message.model.d.ts +7 -0
  95. package/lib/base-model/table-column.interface.d.ts +28 -0
  96. package/lib/base-model/table-page-user-action.interface.d.ts +14 -0
  97. package/lib/base-model/workflow/workflow-steps.model.d.ts +7 -0
  98. package/lib/base-model/workflow/workflow.model.d.ts +13 -0
  99. package/lib/components/action-comment/action-comment.component.d.ts +32 -0
  100. package/lib/components/action-confirmation/action-confirmation.component.d.ts +19 -0
  101. package/lib/components/activity-report-form/activity-report-form.component.d.ts +93 -0
  102. package/lib/components/advanced-filter/field-filter/field-filter.component.d.ts +20 -0
  103. package/lib/components/advanced-filter/filter-builder/filter-builder.component.d.ts +28 -0
  104. package/lib/components/audit-log-details-dialog/audit-log-details-dialog.component.d.ts +25 -0
  105. package/lib/components/audit-log-list/audit-log.component.d.ts +36 -0
  106. package/lib/components/auto-complete/auto-complete.component.d.ts +51 -0
  107. package/lib/components/base-form/base-form.component.d.ts +59 -0
  108. package/lib/components/base-form-canvas/base-form-canvas.component.d.ts +124 -0
  109. package/lib/components/base-input-dialog/base-input-dialog.component.d.ts +23 -0
  110. package/lib/components/base-table/base-table.component.d.ts +128 -0
  111. package/lib/components/button-actions/button-actions.component.d.ts +17 -0
  112. package/lib/components/editable-base-table/editable-base-table.component.d.ts +106 -0
  113. package/lib/components/equation-builder/equation-builder.component.d.ts +23 -0
  114. package/lib/components/item-line-editor/item-line-editor.component.d.ts +64 -0
  115. package/lib/components/multi-auto-complete/multi-auto-complete.component.d.ts +51 -0
  116. package/lib/components/paginator/paginator.component.d.ts +26 -0
  117. package/lib/components/report-details-dialog/report-details-dialog.component.d.ts +34 -0
  118. package/lib/components/report-form/report-form.component.d.ts +92 -0
  119. package/lib/components/search-bar/search-bar.component.d.ts +29 -0
  120. package/lib/components/section-form-canvas/section-form-canvas.component.d.ts +27 -0
  121. package/lib/components/shared/action-button/action-button.component.d.ts +17 -0
  122. package/lib/components/shared/action-card/action-card.component.d.ts +37 -0
  123. package/lib/components/shared/attachment-uploader/attachment-uploader.component.d.ts +16 -0
  124. package/lib/components/shared-list/shared-list.component.d.ts +21 -0
  125. package/lib/components/snackbar-static/snackbar-static.component.d.ts +15 -0
  126. package/lib/components/title-bar/title-bar.component.d.ts +42 -0
  127. package/lib/services/backend-service.d.ts +59 -0
  128. package/{src/lib/services/index.ts → lib/services/index.d.ts} +1 -1
  129. package/lib/services/top-panel.d.ts +8 -0
  130. package/lib/services/trigger-form.service.d.ts +7 -0
  131. package/lib/utils/base-utils.d.ts +13 -0
  132. package/lib/validators/date-range-validator.d.ts +2 -0
  133. package/lib/validators/match-list.validator.d.ts +4 -0
  134. package/lib/validators/multi-email-validator.d.ts +6 -0
  135. package/package.json +19 -4
  136. package/{src/public-api.ts → public-api.d.ts} +22 -18
  137. package/ng-package.json +0 -7
  138. package/src/lib/base-model/SearchStrConfig.ts +0 -12
  139. package/src/lib/base-model/audit-log-entry.ts +0 -7
  140. package/src/lib/base-model/button-action-settings.ts +0 -25
  141. package/src/lib/base-model/column-def.model.ts +0 -34
  142. package/src/lib/base-model/do-action-request.ts +0 -11
  143. package/src/lib/base-model/field-action.ts +0 -7
  144. package/src/lib/base-model/field-filter.model.ts +0 -14
  145. package/src/lib/base-model/field-info.ts +0 -98
  146. package/src/lib/base-model/field-predicate.model.ts +0 -7
  147. package/src/lib/base-model/filter-request.ts +0 -27
  148. package/src/lib/base-model/filter.model.ts +0 -49
  149. package/src/lib/base-model/get-items-list.ts +0 -24
  150. package/src/lib/base-model/index.ts +0 -11
  151. package/src/lib/base-model/lookupItem.ts +0 -21
  152. package/src/lib/base-model/null-snackmessage.ts +0 -9
  153. package/src/lib/base-model/report-request.model.ts +0 -33
  154. package/src/lib/base-model/response-envelop.model.ts +0 -15
  155. package/src/lib/base-model/snack-message.model.ts +0 -14
  156. package/src/lib/base-model/snackmessage-interface.ts +0 -7
  157. package/src/lib/base-model/table-column.interface.ts +0 -29
  158. package/src/lib/base-model/table-page-user-action.interface.ts +0 -33
  159. package/src/lib/base-model/workflow/workflow-steps.model.ts +0 -9
  160. package/src/lib/base-model/workflow/workflow.model.ts +0 -52
  161. package/src/lib/components/action-confirmation/action-confirmation.component.css +0 -34
  162. package/src/lib/components/action-confirmation/action-confirmation.component.html +0 -18
  163. package/src/lib/components/action-confirmation/action-confirmation.component.spec.ts +0 -23
  164. package/src/lib/components/action-confirmation/action-confirmation.component.ts +0 -58
  165. package/src/lib/components/activity-report-form/activity-report-form.component.html +0 -109
  166. package/src/lib/components/activity-report-form/activity-report-form.component.scss +0 -0
  167. package/src/lib/components/activity-report-form/activity-report-form.component.spec.ts +0 -25
  168. package/src/lib/components/activity-report-form/activity-report-form.component.ts +0 -605
  169. package/src/lib/components/audit-log-details-dialog/audit-log-details-dialog.component.css +0 -51
  170. package/src/lib/components/audit-log-details-dialog/audit-log-details-dialog.component.html +0 -23
  171. package/src/lib/components/audit-log-details-dialog/audit-log-details-dialog.component.spec.ts +0 -23
  172. package/src/lib/components/audit-log-details-dialog/audit-log-details-dialog.component.ts +0 -69
  173. package/src/lib/components/audit-log-list/audit-log.component.html +0 -23
  174. package/src/lib/components/audit-log-list/audit-log.component.scss +0 -0
  175. package/src/lib/components/audit-log-list/audit-log.component.spec.ts +0 -25
  176. package/src/lib/components/audit-log-list/audit-log.component.ts +0 -116
  177. package/src/lib/components/auto-complete/auto-complete.component.css +0 -14
  178. package/src/lib/components/auto-complete/auto-complete.component.html +0 -29
  179. package/src/lib/components/auto-complete/auto-complete.component.spec.ts +0 -23
  180. package/src/lib/components/auto-complete/auto-complete.component.ts +0 -330
  181. package/src/lib/components/base-form/base-form.component.html +0 -58
  182. package/src/lib/components/base-form/base-form.component.scss +0 -0
  183. package/src/lib/components/base-form/base-form.component.spec.ts +0 -25
  184. package/src/lib/components/base-form/base-form.component.ts +0 -305
  185. package/src/lib/components/base-form-canvas/base-form-canvas.component.css +0 -22
  186. package/src/lib/components/base-form-canvas/base-form-canvas.component.html +0 -1006
  187. package/src/lib/components/base-form-canvas/base-form-canvas.component.spec.ts +0 -23
  188. package/src/lib/components/base-form-canvas/base-form-canvas.component.ts +0 -573
  189. package/src/lib/components/base-input-dialog/base-input-dialog.component.css +0 -0
  190. package/src/lib/components/base-input-dialog/base-input-dialog.component.html +0 -42
  191. package/src/lib/components/base-input-dialog/base-input-dialog.component.spec.ts +0 -23
  192. package/src/lib/components/base-input-dialog/base-input-dialog.component.ts +0 -78
  193. package/src/lib/components/base-table/base-table.component.html +0 -242
  194. package/src/lib/components/base-table/base-table.component.scss +0 -31
  195. package/src/lib/components/base-table/base-table.component.spec.ts +0 -25
  196. package/src/lib/components/base-table/base-table.component.ts +0 -568
  197. package/src/lib/components/button-actions/button-actions.component.html +0 -28
  198. package/src/lib/components/button-actions/button-actions.component.scss +0 -6
  199. package/src/lib/components/button-actions/button-actions.component.spec.ts +0 -23
  200. package/src/lib/components/button-actions/button-actions.component.ts +0 -72
  201. package/src/lib/components/editable-base-table/editable-base-table.component.html +0 -372
  202. package/src/lib/components/editable-base-table/editable-base-table.component.scss +0 -44
  203. package/src/lib/components/editable-base-table/editable-base-table.component.spec.ts +0 -25
  204. package/src/lib/components/editable-base-table/editable-base-table.component.ts +0 -570
  205. package/src/lib/components/equation-builder/equation-builder.component.css +0 -0
  206. package/src/lib/components/equation-builder/equation-builder.component.html +0 -31
  207. package/src/lib/components/equation-builder/equation-builder.component.spec.ts +0 -23
  208. package/src/lib/components/equation-builder/equation-builder.component.ts +0 -121
  209. package/src/lib/components/multi-auto-complete/multi-auto-complete.component.css +0 -11
  210. package/src/lib/components/multi-auto-complete/multi-auto-complete.component.html +0 -38
  211. package/src/lib/components/multi-auto-complete/multi-auto-complete.component.spec.ts +0 -23
  212. package/src/lib/components/multi-auto-complete/multi-auto-complete.component.ts +0 -317
  213. package/src/lib/components/paginator/paginator.component.css +0 -25
  214. package/src/lib/components/paginator/paginator.component.html +0 -34
  215. package/src/lib/components/paginator/paginator.component.ts +0 -94
  216. package/src/lib/components/rejection-comment/action-comment.component.css +0 -33
  217. package/src/lib/components/rejection-comment/action-comment.component.html +0 -46
  218. package/src/lib/components/rejection-comment/action-comment.component.spec.ts +0 -23
  219. package/src/lib/components/rejection-comment/action-comment.component.ts +0 -86
  220. package/src/lib/components/report-details-dialog/report-details-dialog.component.css +0 -17
  221. package/src/lib/components/report-details-dialog/report-details-dialog.component.html +0 -16
  222. package/src/lib/components/report-details-dialog/report-details-dialog.component.spec.ts +0 -23
  223. package/src/lib/components/report-details-dialog/report-details-dialog.component.ts +0 -113
  224. package/src/lib/components/report-form/report-form.component.html +0 -94
  225. package/src/lib/components/report-form/report-form.component.scss +0 -0
  226. package/src/lib/components/report-form/report-form.component.spec.ts +0 -25
  227. package/src/lib/components/report-form/report-form.component.ts +0 -588
  228. package/src/lib/components/search-bar/search-bar.component.html +0 -62
  229. package/src/lib/components/search-bar/search-bar.component.scss +0 -8
  230. package/src/lib/components/search-bar/search-bar.component.spec.ts +0 -25
  231. package/src/lib/components/search-bar/search-bar.component.ts +0 -70
  232. package/src/lib/components/shared/attachment-uploader/attachment-uploader.component.css +0 -54
  233. package/src/lib/components/shared/attachment-uploader/attachment-uploader.component.html +0 -22
  234. package/src/lib/components/shared/attachment-uploader/attachment-uploader.component.spec.ts +0 -23
  235. package/src/lib/components/shared/attachment-uploader/attachment-uploader.component.ts +0 -45
  236. package/src/lib/components/shared-list/shared-list.component.css +0 -0
  237. package/src/lib/components/shared-list/shared-list.component.html +0 -17
  238. package/src/lib/components/shared-list/shared-list.component.spec.ts +0 -23
  239. package/src/lib/components/shared-list/shared-list.component.ts +0 -53
  240. package/src/lib/components/title-bar/title-bar.component.css +0 -0
  241. package/src/lib/components/title-bar/title-bar.component.css.map +0 -1
  242. package/src/lib/components/title-bar/title-bar.component.html +0 -31
  243. package/src/lib/components/title-bar/title-bar.component.scss +0 -23
  244. package/src/lib/components/title-bar/title-bar.component.spec.ts +0 -23
  245. package/src/lib/components/title-bar/title-bar.component.ts +0 -119
  246. package/src/lib/services/backend-service.ts +0 -286
  247. package/src/lib/services/top-panel.ts +0 -17
  248. package/src/lib/services/trigger-form.service.ts +0 -11
  249. package/src/lib/share-module/shared-module.ts +0 -10
  250. package/src/lib/styles/invoiceq-theme.scss +0 -252
  251. package/src/lib/styles/styles.scss +0 -1723
  252. package/src/lib/utils/base-utils.ts +0 -102
  253. package/src/lib/validators/date-range-validator.ts +0 -31
  254. package/src/lib/validators/match-list.validator.ts +0 -10
  255. package/src/lib/validators/multi-email-validator.ts +0 -15
  256. package/tsconfig.lib.json +0 -15
  257. package/tsconfig.lib.prod.json +0 -11
  258. package/tsconfig.spec.json +0 -15
  259. /package/{src/lib/validators/index.ts → lib/validators/index.d.ts} +0 -0
@@ -1,570 +0,0 @@
1
- import {
2
- Component,
3
- ElementRef,
4
- EventEmitter,
5
- Input,
6
- OnChanges,
7
- OnInit,
8
- Output,
9
- SimpleChanges,
10
- ViewChild
11
- } from "@angular/core";
12
- import {
13
- MatCell,
14
- MatCellDef,
15
- MatColumnDef,
16
- MatHeaderCell,
17
- MatHeaderCellDef,
18
- MatHeaderRow,
19
- MatHeaderRowDef,
20
- MatRow,
21
- MatRowDef,
22
- MatTable
23
- } from "@angular/material/table";
24
- import {TranslateModule} from "@ngx-translate/core";
25
- import {MatSortModule} from "@angular/material/sort";
26
- import {NgClass, NgForOf, NgIf, NgSwitch, NgSwitchCase, NgSwitchDefault} from "@angular/common";
27
- import {MatIcon} from "@angular/material/icon";
28
- import {MatButton, MatButtonModule} from "@angular/material/button";
29
- import {NgxPaginationModule} from "ngx-pagination";
30
- import {FlexLayoutModule} from "@angular/flex-layout";
31
- import {Router} from "@angular/router";
32
- import {AbstractControl, FormArray, FormBuilder, FormControl, FormGroup, ReactiveFormsModule} from "@angular/forms";
33
- import {MatError, MatFormField, MatInput, MatLabel, MatSuffix} from "@angular/material/input";
34
- import {BackendService} from "../../services";
35
- import {
36
- BaseUtils,
37
- buildFormFields,
38
- getNegativeWfActionKey,
39
- getPositiveWfActionKey,
40
- getWfActionId
41
- } from "../../utils/base-utils";
42
- import {
43
- EMPTY_PAGE_INFO,
44
- FieldInfo,
45
- Filter,
46
- FilterRequest,
47
- LookupItem,
48
- PageInfo,
49
- SELECT_RECORD_ACTION,
50
- SnackMessage,
51
- TableColumn
52
- } from "../../base-model";
53
- import {DoActionRequest, REJECT, SAVE} from "../../base-model/do-action-request";
54
- import {ActionCommentComponent} from "../rejection-comment/action-comment.component";
55
- import {MatDialog} from "@angular/material/dialog";
56
- import {MatDatepicker, MatDatepickerInput, MatDatepickerToggle} from "@angular/material/datepicker";
57
- import moment, {Moment} from 'moment';
58
- import {AutoCompleteComponent} from "../auto-complete/auto-complete.component";
59
- import {DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE, MatOption} from "@angular/material/core";
60
- import {MatChipListbox, MatChipOption} from "@angular/material/chips";
61
- import {TitleBarComponent} from "../title-bar/title-bar.component";
62
- import {PaginatorComponent} from "../paginator/paginator.component";
63
- import {Directionality} from "@angular/cdk/bidi";
64
- import {AttachmentUploaderComponent} from "../shared/attachment-uploader/attachment-uploader.component";
65
- import {EquationBuilderComponent} from "../equation-builder/equation-builder.component";
66
- import {MatSelect} from "@angular/material/select";
67
-
68
- import {BaseFormCanvasComponent} from "../base-form-canvas/base-form-canvas.component";
69
- import {MatCheckbox} from "@angular/material/checkbox";
70
- @Component({
71
- selector: 'app-editable-base-table',
72
- standalone: true,
73
- templateUrl: './editable-base-table.component.html',
74
- styleUrls: ['./editable-base-table.component.scss'],
75
- animations: [],
76
- imports: [
77
- NgClass,
78
- TranslateModule,
79
- MatIcon,
80
- MatSortModule,
81
- MatColumnDef,
82
- MatHeaderCellDef,
83
- NgIf,
84
- MatTable,
85
- MatHeaderCell,
86
- NgSwitch,
87
- MatButtonModule,
88
- MatCell,
89
- MatCellDef,
90
- NgxPaginationModule,
91
- MatRow,
92
- MatRowDef,
93
- MatHeaderRow,
94
- NgSwitchCase,
95
- NgSwitchDefault,
96
- MatHeaderRowDef,
97
- NgForOf,
98
- FlexLayoutModule,
99
- MatButton,
100
- ReactiveFormsModule,
101
- MatInput,
102
- AutoCompleteComponent,
103
- MatFormField,
104
- MatDatepicker,
105
- MatDatepickerInput,
106
- MatDatepickerToggle,
107
- MatLabel,
108
- MatSuffix,
109
- MatChipListbox,
110
- MatChipOption,
111
- TitleBarComponent,
112
- PaginatorComponent,
113
- AttachmentUploaderComponent,
114
- EquationBuilderComponent,
115
- MatSelect,
116
- MatOption,
117
- BaseFormCanvasComponent,
118
- MatCheckbox,
119
- ],
120
- providers: [
121
- // `MomentDateAdapter` can be automatically provided by importing `MomentDateModule` in your
122
- // application's root module. We provide it at the component level here, due to limitations of
123
- // our example generation script.
124
- // {
125
- // provide: DateAdapter,
126
- // useClass: MomentDateAdapter,
127
- // deps: [MAT_DATE_LOCALE, MAT_MOMENT_DATE_ADAPTER_OPTIONS],
128
- // },
129
-
130
- // { provide: MAT_DATE_FORMATS, useValue: MY_FORMATS },
131
- ],
132
- })
133
-
134
- export class EditableBaseTableComponent extends BaseUtils implements OnInit, OnChanges {
135
-
136
- collection = {count: 60, data: []};
137
- config = {
138
- itemsPerPage: 10,
139
- currentPage: 1,
140
- totalItems: this.collection.count
141
- };
142
- public maxSize: number = 7;
143
- public directionLinks: boolean = true;
144
- public autoHide: boolean = false;
145
- public responsive: boolean = true;
146
- public labels: any = {
147
- previousLabel: '<',
148
- nextLabel: '>',
149
- screenReaderPaginationLabel: 'Pagination',
150
- screenReaderPageLabel: 'page',
151
- screenReaderCurrentLabel: `You're on page`
152
- };
153
-
154
- private timer: any;
155
- dataElements: any[] = [];
156
- noDataFound = false;
157
- isLoaded: boolean = false;
158
- totalElements = 0;
159
- pagesCount = 0;
160
- pageIndex = 0;
161
- formParam: FormGroup;
162
- searchForm: FormGroup;
163
-
164
- @Input()
165
- filterRequest: FilterRequest;
166
-
167
- @Input()
168
- superDataElements: any[];
169
-
170
- @Input()
171
- override pageInfo: PageInfo = EMPTY_PAGE_INFO;
172
-
173
- @Input() //@ts-ignore
174
- enforceRefresh: boolean = false;
175
-
176
- @Input()
177
- isPending: boolean = false;
178
-
179
- @Input()
180
- isBulkItemsSupported: boolean = false;
181
-
182
- @Input()// @ts-ignore
183
- public fields: FieldInfo[] = [];
184
-
185
- @Input()// @ts-ignore
186
- public searchFormFields: FieldInfo[] = [];
187
-
188
- @Input() translationKey: string = 'addNew';
189
-
190
- @Output()
191
- formUpdated: EventEmitter<FormGroup> = new EventEmitter<FormGroup>();
192
-
193
- @Output()
194
- saveActionEmitter: EventEmitter<any> = new EventEmitter<any>();
195
- @Output()
196
- saveAttachmentEmitter: EventEmitter<any> = new EventEmitter<any>();
197
-
198
- @Input() actionRequestCallback!: (actionRequest: DoActionRequest) => DoActionRequest;
199
-
200
- @ViewChild('uploader') uploaderComponent!: AttachmentUploaderComponent;
201
-
202
- currentDirection: 'ltr' | 'rtl';
203
- selectedFileFromUploader: File | null = null;
204
- private selectedItem: any;
205
-
206
-
207
- constructor(
208
- private backendService: BackendService,
209
- private router: Router,
210
- private fb: FormBuilder,
211
- public dialog: MatDialog,
212
- private directionality: Directionality
213
- ) {
214
- super();
215
- }
216
-
217
- get dataFormArray(): FormArray {
218
- return this.formParam.get('dataFormArray') as FormArray;
219
- }
220
-
221
- extractFormat(column: TableColumn<any>) {
222
- return column?.format || 'd/M/yyyy, h:mm a';
223
- }
224
-
225
- get dataSource() {
226
- return this.dataFormArray.value;
227
- }
228
-
229
- ngOnInit(): void {
230
-
231
- this.currentDirection = this.directionality.value;
232
- this.directionality.change.subscribe((value) => {
233
- this.currentDirection = value;
234
- })
235
-
236
- if(this.superDataElements?.length>0){
237
- this.dataElements=this.superDataElements;
238
- this.buildForm();
239
- this.isLoaded = true;
240
- }else {
241
- this.loadData();
242
- }
243
- }
244
-
245
- private loadData() {
246
- if (this.isPending) {
247
- this.fields.forEach(field => {
248
- field.readonly = true;
249
- });
250
- } else {
251
- this.fields.forEach(field => {
252
- field.readonly = false;
253
- });
254
- }
255
-
256
- this.filterRequest.pendingPage = this.isPending
257
- this.backendService.getItemsByFilter(this.filterRequest, this.pageInfo.apiUri).subscribe(resp => {
258
- if (resp?.valid) {
259
- this.dataElements = resp.body;
260
- this.totalElements = resp.totalSize || 0;
261
- this.noDataFound = resp.body.length < 1;
262
- this.pagesCount = resp.pagesCount || 1;
263
- this.pageIndex = this.filterRequest.pageIndex + 1;
264
- this.buildForm();
265
- this.isLoaded = true;
266
- }
267
- });
268
- }
269
-
270
- private buildForm() {
271
- this.formParam = this.fb.group({
272
- dataFormArray: this.fb.array(this.dataElements.map(item => this.fb.group(buildFormFields(this.fields, item)))),
273
- });
274
- }
275
-
276
- onPageChange(event: number) {
277
- this.getNext(event - 1);
278
- this.config.currentPage = event;
279
- }
280
- getNext($event: number) {
281
- this.filterRequest.pageIndex = $event;
282
- this.loadData()
283
- }
284
-
285
- extractFieldName(element: any, property: string) {
286
- if (property.includes('.')) {
287
- return property.split('.').reduce((acc, part) => acc && acc[part], element);
288
- } else {
289
- return element[property];
290
- }
291
- }
292
-
293
- get visibleColumns() {
294
- return this.fields.filter(column => column.visible).map(column => column.property);
295
- }
296
-
297
-
298
- ngOnChanges(changes: SimpleChanges): void {
299
- if (changes["enforceRefresh"] && !changes["enforceRefresh"].isFirstChange() && changes["enforceRefresh"].currentValue === true) {
300
- // this.loadData();
301
- }
302
- }
303
-
304
- onSelectItem(row: any) {
305
- if (this.pageInfo.selfRouting) {
306
- const mode = this.isPending ? 'pending' : 'view';
307
- const url = `${this.pageInfo.listRoutePath || this.router.url}/${mode}`;
308
- this.router.navigate([`${url}`, row?.id]);
309
- }
310
- const action = SELECT_RECORD_ACTION;
311
- action.id = row?.id;
312
- // this.userAction.emit(action)
313
- this.selectedItem = row;
314
- }
315
-
316
- openNewTab(row) {
317
- if (!this.pageInfo.embededTableOnly) {
318
- const mode = this.isPending ? 'pending' : 'view';
319
- window.open(`${this.pageInfo.listRoutePath}/${mode}` + '/' + row?.id);
320
- }
321
- }
322
-
323
-
324
- getField(element, column: FieldInfo) {
325
- return element.controls[column.property];
326
- }
327
-
328
- fieldButtonEvent(column, element, actionId: number) {
329
- this.doSaveApproveAction(element, actionId);
330
- }
331
-
332
- patchLookupValue($event: LookupItem, property: string) {
333
- this.formUpdated.emit(this.selectedItem)
334
- }
335
-
336
- addNewItem() {
337
- const currentValues = this.formParam?.get('dataFormArray')?.value;
338
- if (currentValues) {
339
- this.dataElements = [...currentValues];
340
- }
341
- this.dataElements.push({});
342
- this.buildForm();
343
- }
344
-
345
-
346
- doSaveApproveAction(element, userActionId) {
347
- let actionId = getWfActionId(element.value.stateType);
348
- if (userActionId === REJECT && this.isPending) {
349
- actionId =3
350
- }
351
- let request = new DoActionRequest();
352
- request.actionId = actionId;
353
- request.subject = element.value;
354
-
355
- if (this.actionRequestCallback) {
356
- request = this.actionRequestCallback(request);
357
- if (request.subject.id === "") {
358
- request.subject.id = null;
359
- request.subject.stateType = "NEW";
360
- }
361
- }
362
-
363
- if (request.subject.id === "") {
364
- request.subject.id = null;
365
- request.subject.stateType = "NEW";
366
- }
367
-
368
-
369
- const dialogRef = this.dialog.open(ActionCommentComponent, {
370
- data: {label: userActionId === 2 ? 'save' : 'reject', isTermination: false},
371
- width: '600px',
372
- height: 'auto',
373
- direction: this.currentDirection
374
- });
375
- console.log(actionId)
376
- dialogRef.afterClosed().subscribe(result => {
377
- if (result) {
378
- request.comment = result.comment;
379
- this.backendService.doActionWithAttachments(request, [], this.pageInfo!).subscribe(resp => {
380
- if (resp.valid) {
381
- this.loadData();
382
- console.log("actionId", actionId);
383
- let message = '';
384
- if (actionId === 1 ) {
385
- message = 'saved_successfully' ;
386
- } else if (actionId ===2 ) {
387
- message = 'updated_successfully';
388
- } else if (actionId ===3 ) {
389
- message = 'successful_reject_message';
390
- } else if (actionId ===4 ) {
391
- message = 'approve_successfully';
392
- }
393
- this.backendService.topPanelMessage$.next(new SnackMessage(message, true, 'success'));
394
- }else {
395
- const x = resp.message?.length >0 ? resp.message[0].errorMessage : 'FAILED_CONTACT_ADMIN';
396
- this.backendService.topPanelMessage$.next(new SnackMessage(x, true, 'error'));
397
- }
398
- this.saveActionEmitter.emit({item:request.subject, resp});
399
- });
400
- }
401
- });
402
- }
403
- protected readonly getPositiveWfActionKey = getPositiveWfActionKey;
404
- protected readonly getNegativeWfActionKey = getNegativeWfActionKey;
405
- protected readonly SAVE = SAVE;
406
- protected readonly REJECT = REJECT;
407
-
408
-
409
- setMonthAndYear(normalizedMonthAndYear: Moment, picker: MatDatepicker<Moment>, element, column) {
410
- const date = new FormControl(moment());
411
- const ctrlValue = date.value;
412
- ctrlValue.year(normalizedMonthAndYear.year());
413
- ctrlValue.month(1);
414
- ctrlValue.dayOfYear(1);
415
- element.controls[column.property].setValue(ctrlValue);
416
- picker.close();
417
- }
418
-
419
- switchViewMode(b: boolean) {
420
- this.isPending = b;
421
- this.loadData();
422
- }
423
-
424
- addBulkItems() {
425
- const merged: any[] = [];
426
-
427
- this.dataFormArray.controls.forEach((group: AbstractControl) => {
428
- merged.push(group.value);
429
- });
430
-
431
- let request = new DoActionRequest();
432
- request.actionId = 1;
433
-
434
- request.subject = { invoices: merged };
435
-
436
- if (this.actionRequestCallback) {
437
- request = this.actionRequestCallback(request);
438
-
439
- request.subject.invoices = request.subject.invoices.map((item: any) => {
440
- if (item.id === "") {
441
- item.id = null;
442
- item.stateType = "NEW";
443
- }
444
- return item;
445
- });
446
- }
447
-
448
- request.subject.invoices = request.subject.invoices.map((item: any) => {
449
- if (item.id === "") {
450
- item.id = null;
451
- item.stateType = "NEW";
452
- }
453
- return item;
454
- });
455
-
456
-
457
-
458
- const dialogRef = this.dialog.open(ActionCommentComponent, {
459
- data: {label: 'save' , isTermination: false},
460
- width: '600px',
461
- height: 'auto',
462
- direction: this.currentDirection
463
- });
464
- dialogRef.afterClosed().subscribe(result => {
465
- if (result) {
466
- request.comment = result.comment;
467
- this.backendService.doActionWithAttachment(request, this.selectedFileFromUploader, this.pageInfo!).subscribe(resp => {
468
- if (resp.valid) {
469
- this.clearBulkItems();
470
- this.backendService.topPanelMessage$.next(new SnackMessage('saved_successfully', true, 'success'));
471
- this.loadData();
472
- }else {
473
- this.backendService.topPanelMessage$.next(new SnackMessage(this.pageInfo.labelsSection + '.' + resp.message?.[0]?.errorCode, true, 'error'));
474
- }
475
- this.saveAttachmentEmitter.emit({item:request.subject, resp});
476
- });
477
- }
478
- }); }
479
-
480
- @ViewChild('fileUpload') fileUpload: ElementRef<HTMLInputElement>;
481
-
482
- handleFileUpload($event: File) {
483
- let actionId = getWfActionId('NEW');
484
- let request = new DoActionRequest();
485
- request.actionId = actionId;
486
-
487
- this.selectedFileFromUploader = $event;
488
-
489
- }
490
-
491
- shouldDisableBulkAdd() {
492
- const hasFile = !!this.selectedFileFromUploader;
493
- return (!this.formParam?.valid || this.dataFormArray.controls.length === 0) && !hasFile;
494
- }
495
- handleEquationChange(event: { value: any[], valid: boolean }, element: FormGroup, column: any): void {
496
- element.value[column.property] = event.value;
497
- const { value, valid } = event;
498
- element.get(column.property)?.setValue(value);
499
- if (!valid) {
500
- element.get(column.property)?.setErrors({ invalidEquation: true });
501
- } else {
502
- element.get(column.property)?.setErrors(null);
503
- }
504
- }
505
-
506
- clearBulkItems() {
507
- this.dataElements = [];
508
- this.selectedFileFromUploader = null;
509
- this.uploaderComponent.clearFile();
510
- this.buildForm();
511
- this.formUpdated.emit(this.formParam);
512
- }
513
-
514
- hasDataToClear(): boolean {
515
- return (this.dataElements && this.dataElements.length > 0) || !!this.selectedFileFromUploader;
516
- }
517
- getOptionValue(item: any) {
518
- const value = typeof item === 'object' ?
519
- item.englishName : item;
520
- return value;
521
- }
522
-
523
- disabledSaveButton(element) {
524
- return !element.valid || (!this.isPending && element.value.stateType == 'PENDING');
525
- }
526
-
527
- doSearch() {
528
- if (this.searchForm.valid) {
529
- const rawValues = this.searchForm.getRawValue();
530
- this.filterRequest.pageIndex=0;
531
- this.filterRequest.filters = [];
532
- this.searchFormFields.forEach(x => {
533
- const value = rawValues[x.property];
534
- if (value !== null && value !== undefined && value !== '') {
535
- const filter = new Filter({
536
- key: 0,
537
- label: x.property,
538
- fieldName: x.searchAttribute,
539
- valueObject : x.searchAttribute.includes('.') ? value[x.searchAttribute.split('.').pop()] : value,
540
- operator: x.searchOperator,
541
- filterType: 'FILED_FILTER'
542
- });
543
- this.filterRequest.filters.push(filter);
544
- }
545
- });
546
- this.loadData();
547
- } else {
548
- this.backendService.topPanelMessage$.next(new SnackMessage('INVALID_SEARCH_FORM', true, 'error'));
549
- }
550
- }
551
-
552
- showSearch() {
553
- return this.searchFormFields?.length > 0;
554
- }
555
-
556
- clearSearch() {
557
- this.searchForm.get('sectorType').setValue({id:-100, englishName:'aaa', code:'aaa', arabicName:'aaa'});
558
- this.searchForm.reset();
559
- this.doSearch();
560
- }
561
-
562
- updateSearchForm($event: FormGroup) {
563
- this.searchForm = $event
564
- }
565
-
566
- validSearchData() {
567
- return !this.searchForm.valid || true;
568
- }
569
-
570
- }
@@ -1,31 +0,0 @@
1
- <div fxLayout="row" fxLayoutGap="10px" fxFlexFill fxLayoutAlign="start center">
2
- <ng-container *ngFor="let item of items; let i = index">
3
- <div fxLayout="row" fxLayoutAlign="start center" fxLayoutGap="5px">
4
- <ng-container [ngSwitch]="item.type">
5
- <ng-container *ngSwitchCase="'lookup'">
6
- <app-auto-complete
7
- fxFlex
8
- [field]="field"
9
- [form]="form"
10
- [defaultValue]="item.value"
11
- (selectedValue)="onLookupChange(i, $event)">
12
- </app-auto-complete>
13
- </ng-container>
14
-
15
- <ng-container *ngSwitchCase="'dropdown'">
16
- <mat-form-field appearance="outline" fxFlex="none" style="width: 100px">
17
- <mat-select [disabled]="readOnly" [value]="item.value" (selectionChange)="onDropdownChange(i, $event.value)">
18
- <mat-option *ngFor="let opt of operators" [value]="opt.value">
19
- {{ opt.label }}
20
- </mat-option>
21
- </mat-select>
22
- </mat-form-field>
23
- </ng-container>
24
- </ng-container>
25
- </div>
26
- </ng-container>
27
-
28
- <button [disabled]="isPending" mat-icon-button color="warn" (click)="onClearAll()" *ngIf="items.length > 0">
29
- <mat-icon>delete</mat-icon>
30
- </button>
31
- </div>
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { EquationBuilderComponent } from './equation-builder.component';
4
-
5
- describe('EquationBuilderComponent', () => {
6
- let component: EquationBuilderComponent;
7
- let fixture: ComponentFixture<EquationBuilderComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- imports: [EquationBuilderComponent]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(EquationBuilderComponent);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });