@unifylib/ui-lib 1.1.3 → 1.1.5

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 (286) 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} +21 -23
  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/lib/base-model/page-info.d.ts +52 -0
  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} +3 -3
  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/{src/lib/validators/index.ts → lib/validators/index.d.ts} +3 -3
  134. package/lib/validators/match-list.validator.d.ts +4 -0
  135. package/lib/validators/multi-email-validator.d.ts +6 -0
  136. package/package.json +27 -14
  137. package/{src/public-api.ts → public-api.d.ts} +25 -29
  138. package/ng-package.json +0 -7
  139. package/src/lib/base-model/SearchStrConfig.ts +0 -12
  140. package/src/lib/base-model/audit-log-entry.ts +0 -7
  141. package/src/lib/base-model/button-action-settings.ts +0 -29
  142. package/src/lib/base-model/column-def.model.ts +0 -34
  143. package/src/lib/base-model/do-action-request.ts +0 -11
  144. package/src/lib/base-model/feature-item.ts +0 -9
  145. package/src/lib/base-model/field-action.ts +0 -7
  146. package/src/lib/base-model/field-filter.model.ts +0 -7
  147. package/src/lib/base-model/field-info.ts +0 -102
  148. package/src/lib/base-model/field-predicate.model.ts +0 -7
  149. package/src/lib/base-model/filter-request.ts +0 -27
  150. package/src/lib/base-model/filter.model.ts +0 -49
  151. package/src/lib/base-model/get-items-list.ts +0 -24
  152. package/src/lib/base-model/index.ts +0 -11
  153. package/src/lib/base-model/items-total.model.ts +0 -12
  154. package/src/lib/base-model/line-item.model.ts +0 -18
  155. package/src/lib/base-model/lookupItem.ts +0 -21
  156. package/src/lib/base-model/null-snackmessage.ts +0 -9
  157. package/src/lib/base-model/page-info.ts +0 -54
  158. package/src/lib/base-model/report-request.model.ts +0 -33
  159. package/src/lib/base-model/response-envelop.model.ts +0 -15
  160. package/src/lib/base-model/snack-message.model.ts +0 -14
  161. package/src/lib/base-model/snackmessage-interface.ts +0 -7
  162. package/src/lib/base-model/table-column.interface.ts +0 -29
  163. package/src/lib/base-model/table-page-user-action.interface.ts +0 -33
  164. package/src/lib/base-model/workflow/workflow-steps.model.ts +0 -9
  165. package/src/lib/base-model/workflow/workflow.model.ts +0 -52
  166. package/src/lib/components/action-comment/action-comment.component.css +0 -52
  167. package/src/lib/components/action-comment/action-comment.component.html +0 -47
  168. package/src/lib/components/action-comment/action-comment.component.spec.ts +0 -23
  169. package/src/lib/components/action-comment/action-comment.component.ts +0 -102
  170. package/src/lib/components/action-confirmation/action-confirmation.component.css +0 -46
  171. package/src/lib/components/action-confirmation/action-confirmation.component.html +0 -32
  172. package/src/lib/components/action-confirmation/action-confirmation.component.spec.ts +0 -23
  173. package/src/lib/components/action-confirmation/action-confirmation.component.ts +0 -58
  174. package/src/lib/components/activity-report-form/activity-report-form.component.html +0 -110
  175. package/src/lib/components/activity-report-form/activity-report-form.component.scss +0 -69
  176. package/src/lib/components/activity-report-form/activity-report-form.component.spec.ts +0 -25
  177. package/src/lib/components/activity-report-form/activity-report-form.component.ts +0 -616
  178. package/src/lib/components/advanced-filter/field-filter/field-filter.component.html +0 -8
  179. package/src/lib/components/advanced-filter/field-filter/field-filter.component.scss +0 -0
  180. package/src/lib/components/advanced-filter/field-filter/field-filter.component.spec.ts +0 -25
  181. package/src/lib/components/advanced-filter/field-filter/field-filter.component.ts +0 -55
  182. package/src/lib/components/advanced-filter/filter-builder/filter-builder.component.html +0 -36
  183. package/src/lib/components/advanced-filter/filter-builder/filter-builder.component.scss +0 -130
  184. package/src/lib/components/advanced-filter/filter-builder/filter-builder.component.spec.ts +0 -25
  185. package/src/lib/components/advanced-filter/filter-builder/filter-builder.component.ts +0 -186
  186. package/src/lib/components/audit-log-details-dialog/audit-log-details-dialog.component.css +0 -51
  187. package/src/lib/components/audit-log-details-dialog/audit-log-details-dialog.component.html +0 -23
  188. package/src/lib/components/audit-log-details-dialog/audit-log-details-dialog.component.spec.ts +0 -23
  189. package/src/lib/components/audit-log-details-dialog/audit-log-details-dialog.component.ts +0 -69
  190. package/src/lib/components/audit-log-list/audit-log.component.html +0 -26
  191. package/src/lib/components/audit-log-list/audit-log.component.scss +0 -50
  192. package/src/lib/components/audit-log-list/audit-log.component.spec.ts +0 -25
  193. package/src/lib/components/audit-log-list/audit-log.component.ts +0 -114
  194. package/src/lib/components/auto-complete/auto-complete.component.css +0 -55
  195. package/src/lib/components/auto-complete/auto-complete.component.html +0 -45
  196. package/src/lib/components/auto-complete/auto-complete.component.spec.ts +0 -23
  197. package/src/lib/components/auto-complete/auto-complete.component.ts +0 -331
  198. package/src/lib/components/base-form/base-form.component.html +0 -59
  199. package/src/lib/components/base-form/base-form.component.scss +0 -68
  200. package/src/lib/components/base-form/base-form.component.spec.ts +0 -25
  201. package/src/lib/components/base-form/base-form.component.ts +0 -323
  202. package/src/lib/components/base-form-canvas/base-form-canvas.component.css +0 -196
  203. package/src/lib/components/base-form-canvas/base-form-canvas.component.html +0 -1095
  204. package/src/lib/components/base-form-canvas/base-form-canvas.component.spec.ts +0 -23
  205. package/src/lib/components/base-form-canvas/base-form-canvas.component.ts +0 -680
  206. package/src/lib/components/base-input-dialog/base-input-dialog.component.css +0 -67
  207. package/src/lib/components/base-input-dialog/base-input-dialog.component.html +0 -47
  208. package/src/lib/components/base-input-dialog/base-input-dialog.component.spec.ts +0 -23
  209. package/src/lib/components/base-input-dialog/base-input-dialog.component.ts +0 -77
  210. package/src/lib/components/base-table/base-table.component.html +0 -268
  211. package/src/lib/components/base-table/base-table.component.scss +0 -140
  212. package/src/lib/components/base-table/base-table.component.spec.ts +0 -25
  213. package/src/lib/components/base-table/base-table.component.ts +0 -621
  214. package/src/lib/components/button-actions/button-actions.component.html +0 -27
  215. package/src/lib/components/button-actions/button-actions.component.scss +0 -101
  216. package/src/lib/components/button-actions/button-actions.component.spec.ts +0 -23
  217. package/src/lib/components/button-actions/button-actions.component.ts +0 -70
  218. package/src/lib/components/editable-base-table/editable-base-table.component.html +0 -337
  219. package/src/lib/components/editable-base-table/editable-base-table.component.scss +0 -126
  220. package/src/lib/components/editable-base-table/editable-base-table.component.spec.ts +0 -25
  221. package/src/lib/components/editable-base-table/editable-base-table.component.ts +0 -579
  222. package/src/lib/components/equation-builder/equation-builder.component.css +0 -39
  223. package/src/lib/components/equation-builder/equation-builder.component.html +0 -31
  224. package/src/lib/components/equation-builder/equation-builder.component.spec.ts +0 -23
  225. package/src/lib/components/equation-builder/equation-builder.component.ts +0 -119
  226. package/src/lib/components/item-line-editor/item-line-editor.component.html +0 -102
  227. package/src/lib/components/item-line-editor/item-line-editor.component.scss +0 -152
  228. package/src/lib/components/item-line-editor/item-line-editor.component.spec.ts +0 -23
  229. package/src/lib/components/item-line-editor/item-line-editor.component.ts +0 -306
  230. package/src/lib/components/multi-auto-complete/multi-auto-complete.component.css +0 -19
  231. package/src/lib/components/multi-auto-complete/multi-auto-complete.component.html +0 -38
  232. package/src/lib/components/multi-auto-complete/multi-auto-complete.component.spec.ts +0 -23
  233. package/src/lib/components/multi-auto-complete/multi-auto-complete.component.ts +0 -315
  234. package/src/lib/components/paginator/paginator.component.css +0 -65
  235. package/src/lib/components/paginator/paginator.component.html +0 -30
  236. package/src/lib/components/paginator/paginator.component.ts +0 -87
  237. package/src/lib/components/report-details-dialog/report-details-dialog.component.css +0 -17
  238. package/src/lib/components/report-details-dialog/report-details-dialog.component.html +0 -16
  239. package/src/lib/components/report-details-dialog/report-details-dialog.component.spec.ts +0 -23
  240. package/src/lib/components/report-details-dialog/report-details-dialog.component.ts +0 -111
  241. package/src/lib/components/report-form/report-form.component.html +0 -92
  242. package/src/lib/components/report-form/report-form.component.scss +0 -51
  243. package/src/lib/components/report-form/report-form.component.spec.ts +0 -25
  244. package/src/lib/components/report-form/report-form.component.ts +0 -599
  245. package/src/lib/components/search-bar/search-bar.component.html +0 -51
  246. package/src/lib/components/search-bar/search-bar.component.scss +0 -63
  247. package/src/lib/components/search-bar/search-bar.component.spec.ts +0 -25
  248. package/src/lib/components/search-bar/search-bar.component.ts +0 -68
  249. package/src/lib/components/section-form-canvas/section-form-canvas.component.html +0 -43
  250. package/src/lib/components/section-form-canvas/section-form-canvas.component.scss +0 -81
  251. package/src/lib/components/section-form-canvas/section-form-canvas.component.spec.ts +0 -23
  252. package/src/lib/components/section-form-canvas/section-form-canvas.component.ts +0 -67
  253. package/src/lib/components/shared/action-button/action-button.component.html +0 -12
  254. package/src/lib/components/shared/action-button/action-button.component.scss +0 -45
  255. package/src/lib/components/shared/action-button/action-button.component.ts +0 -51
  256. package/src/lib/components/shared/action-card/action-card.component.html +0 -78
  257. package/src/lib/components/shared/action-card/action-card.component.scss +0 -238
  258. package/src/lib/components/shared/action-card/action-card.component.ts +0 -56
  259. package/src/lib/components/shared/attachment-uploader/attachment-uploader.component.css +0 -135
  260. package/src/lib/components/shared/attachment-uploader/attachment-uploader.component.html +0 -36
  261. package/src/lib/components/shared/attachment-uploader/attachment-uploader.component.spec.ts +0 -23
  262. package/src/lib/components/shared/attachment-uploader/attachment-uploader.component.ts +0 -71
  263. package/src/lib/components/shared-list/shared-list.component.css +0 -0
  264. package/src/lib/components/shared-list/shared-list.component.html +0 -17
  265. package/src/lib/components/shared-list/shared-list.component.spec.ts +0 -23
  266. package/src/lib/components/shared-list/shared-list.component.ts +0 -53
  267. package/src/lib/components/snackbar-static/snackbar-static.component.html +0 -20
  268. package/src/lib/components/snackbar-static/snackbar-static.component.scss +0 -135
  269. package/src/lib/components/snackbar-static/snackbar-static.component.ts +0 -26
  270. package/src/lib/components/title-bar/title-bar.component.css +0 -0
  271. package/src/lib/components/title-bar/title-bar.component.css.map +0 -1
  272. package/src/lib/components/title-bar/title-bar.component.html +0 -35
  273. package/src/lib/components/title-bar/title-bar.component.scss +0 -126
  274. package/src/lib/components/title-bar/title-bar.component.spec.ts +0 -23
  275. package/src/lib/components/title-bar/title-bar.component.ts +0 -126
  276. package/src/lib/services/backend-service.ts +0 -287
  277. package/src/lib/services/top-panel.ts +0 -17
  278. package/src/lib/services/trigger-form.service.ts +0 -11
  279. package/src/lib/share-module/shared-module.ts +0 -10
  280. package/src/lib/utils/base-utils.ts +0 -102
  281. package/src/lib/validators/date-range-validator.ts +0 -31
  282. package/src/lib/validators/match-list.validator.ts +0 -10
  283. package/src/lib/validators/multi-email-validator.ts +0 -15
  284. package/tsconfig.lib.json +0 -15
  285. package/tsconfig.lib.prod.json +0 -11
  286. package/tsconfig.spec.json +0 -15
@@ -1,119 +0,0 @@
1
- import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
2
- import { FormGroup } from "@angular/forms";
3
- import { AutoCompleteComponent } from "../auto-complete/auto-complete.component";
4
- import { MatFormField, MatOption, MatSelect } from "@angular/material/select";
5
- import {NgForOf, NgIf, NgSwitch, NgSwitchCase} from "@angular/common";
6
- import {MatIcon} from "@angular/material/icon";
7
- import {MatIconButton} from "@angular/material/button";
8
-
9
- @Component({
10
- selector: 'lib-equation-builder',
11
- standalone: true,
12
- imports: [
13
- AutoCompleteComponent,
14
- MatSelect,
15
- MatOption,
16
- MatFormField,
17
- NgSwitch,
18
- NgForOf,
19
- NgSwitchCase,
20
- MatIcon,
21
- MatIconButton,
22
- NgIf
23
- ],
24
- templateUrl: './equation-builder.component.html',
25
- styleUrl: './equation-builder.component.css'
26
- })
27
- export class EquationBuilderComponent implements OnInit {
28
- @Input() form!: FormGroup;
29
- @Input() field!: any;
30
- @Input() isPending!: boolean;
31
- @Output() valueChanged = new EventEmitter<any>();
32
-
33
- operators = [
34
- { label: '+', value: '+' },
35
- { label: '-', value: '-' },
36
- { label: '=', value: '=' }
37
- ];
38
-
39
- items: any[] = [];
40
- @Input() readOnly!: boolean;
41
-
42
- ngOnInit() {
43
- const fieldValues: any[] = this.form.get('fieldValue')?.value;
44
-
45
- if (Array.isArray(fieldValues) && fieldValues.length > 0) {
46
- this.items = fieldValues.map(val => {
47
- if (this.operators.some(op => op.value === val)) {
48
- return { type: 'dropdown', value: val };
49
- } else {
50
- return {
51
- type: 'lookup',
52
- value: this.getLookupByCode(val)
53
- };
54
- }
55
- });
56
- } else {
57
- this.items = [{ type: 'lookup', value: null }];
58
- }
59
-
60
- }
61
-
62
- getLookupByCode(code: string): any {
63
- return { code: code, id: 1, englishName: code, arabicName: code }
64
- }
65
-
66
- onLookupChange(index: number, value: any) {
67
- this.items[index].value = value;
68
-
69
- if (index === this.items.length - 1) {
70
- this.items.push({ type: 'dropdown', value: null});
71
- }
72
-
73
- this.emitChange();
74
- }
75
-
76
- onDropdownChange(index: number, value: any) {
77
- this.items[index].value = value;
78
-
79
- if (index !== this.items.length - 1) {
80
- this.emitChange();
81
- return;
82
- }
83
-
84
- if (value === '=') {
85
- this.items = this.items.slice(0, index + 1);
86
- } else if (value != null && value !== '') {
87
- const lastItem = this.items[this.items.length - 1];
88
- if (lastItem.type !== 'lookup') {
89
- this.items.push({ type: 'lookup', value: null });
90
- }
91
- }
92
-
93
- this.emitChange();
94
- }
95
-
96
- emitChange() {
97
- const simplifiedItems = this.items.map(item => {
98
- if (item?.type === 'lookup') {
99
- return item.value?.code ?? null;
100
- } else if (item?.type === 'dropdown') {
101
- return item.value ?? null;
102
- }
103
- return null;
104
- });
105
- const isValid = simplifiedItems[simplifiedItems.length - 1] === '=';
106
-
107
- this.valueChanged.emit({
108
- value: simplifiedItems.filter(val => val !== '='),
109
- valid: isValid
110
- });
111
- }
112
-
113
- onClearAll(): void {
114
- this.items = [{ type: 'lookup', value: null }];
115
- this.emitChange();
116
- }
117
-
118
-
119
- }
@@ -1,102 +0,0 @@
1
- <div class="item-line-editor">
2
-
3
- <h3 class="title">{{ title | translate }}</h3>
4
- <p class="subtitle">{{ subtitle | translate }}</p>
5
-
6
- <div class="table-header" [ngStyle]="{ 'grid-template-columns': gridTemplate }">
7
- <ng-container *ngFor="let f of headerFields; let idx = index">
8
- <div class="col">
9
- {{ labelOf(f) | translate }}
10
- </div>
11
- </ng-container>
12
- </div>
13
- @if (!noDataFound) {
14
- <div class="table-body" *ngFor="let it of items; let i = index; trackBy: trackByIndex">
15
-
16
- <div class="table-row">
17
-
18
- <div class="row-inputs">
19
- <app-base-form-canvas
20
- [pageInfo]="pageInfo"
21
- [fields]="fields"
22
- [editable]="editing[i]"
23
- [emitOnValueChanges]="true"
24
- [item]="it"
25
- [currency]="currency"
26
- (formUpdated)="onFormUpdated($event, i)">
27
- </app-base-form-canvas>
28
- </div>
29
-
30
-
31
- </div>
32
- <div class="row-actions">
33
-
34
- <button *ngIf="editing[i]" mat-stroked-button class="btn-none-background-primary save-btn" (click)="saveRow(i)"
35
- [disabled]="!canSave(i)">
36
- <div class="button-text">
37
- <mat-icon>check</mat-icon>
38
- <span>{{ 'item-line.save' | translate }}</span>
39
- </div>
40
- </button>
41
-
42
- <button *ngIf="!editing[i] && editable" mat-stroked-button class="btn-none-background-primary edit-btn"
43
- (click)="editRow(i)">
44
- <div class="button-text">
45
- <mat-icon>edit</mat-icon>
46
- <span>{{ 'item-line.edit' | translate }}</span>
47
- </div>
48
- </button>
49
-
50
- <button *ngIf="allowDelete && editable" mat-stroked-button class="btn-none-background-primary delete-btn"
51
- (click)="deleteItem(i)" type="button">
52
- <div class="button-text">
53
- <mat-icon>delete</mat-icon>
54
- <span>{{ 'item-line.delete' | translate }}</span>
55
- </div>
56
- </button>
57
- </div>
58
- </div>
59
- }
60
- @if (noDataFound) {
61
- <div class="dataNotFound flex-column">
62
- <mat-icon class="dataNotFound__icon">{{ noDataFoundIcon }}</mat-icon>
63
- <span class="dataNotFound__title">{{ noDataFoundTitle | translate }}</span>
64
- <span class="dataNotFound__subtitle">{{ noDataFoundSubtitle | translate }}</span>
65
- </div>
66
-
67
- }
68
- <div class="add-item" *ngIf="allowAdd && editable">
69
- <div class="divider" style="border-top: 1px solid var(--primary-color-3nd)"></div>
70
- <button mat-stroked-button color="primary" class="btn-none-background-primary" (click)="addNewItem()"
71
- [disabled]="!canAddNew">
72
- <div class="button-text">
73
- <mat-icon>add</mat-icon>
74
- <span> {{ 'item-line.addNewItem' | translate }}</span>
75
- </div>
76
- </button>
77
-
78
- </div>
79
-
80
- @if (!noDataFound) {
81
- <div class="totals-box">
82
-
83
- <div class="total-row">
84
- <span class="label">{{ 'item-line.discount' | translate }}</span>
85
- <span class="value red">{{ discountTotal | currency:currency }}</span>
86
- </div>
87
-
88
- <div class="total-row">
89
- <span class="label">{{ 'item-line.amount' | translate }}</span>
90
- <span class="value">{{ subtotal | currency:currency }}</span>
91
- </div>
92
-
93
- <div class="divider"></div>
94
-
95
- <div class="total-row grand">
96
- <span class="label">{{ 'item-line.grandTotal' | translate }}</span>
97
- <span class="value strong green">{{ grandTotal | currency:currency }}</span>
98
- </div>
99
- </div>
100
- }
101
-
102
- </div>
@@ -1,152 +0,0 @@
1
- .item-line-editor {
2
- background: #fff;
3
- border-radius: 8px;
4
- padding: 20px;
5
- }
6
-
7
- .title {
8
- font-size: 20px;
9
- margin-bottom: 4px;
10
- font-weight: 600;
11
- }
12
-
13
- .subtitle {
14
- color: #777;
15
- font-size: 13px;
16
- margin-bottom: 16px;
17
- }
18
-
19
- .table-header {
20
- display: grid;
21
- grid-template-columns: 20% 25% 15% 10% 15% 15%;
22
- font-weight: 600;
23
- font-size: 13px;
24
- padding-bottom: 8px;
25
- border-bottom: 2px solid var(--primary-color-3nd);
26
- margin-bottom: 12px;
27
- }
28
-
29
- .col {
30
- padding-left: 4px;
31
- }
32
-
33
- .table-body .table-row {
34
- display: grid;
35
- padding: 10px 0;
36
- border-bottom: 1px solid #e6e6e6;
37
- }
38
-
39
- .row-inputs {
40
- padding-right: 10px;
41
- }
42
-
43
- .row-actions {
44
- display: flex;
45
- flex-direction: row;
46
- align-items: center;
47
- justify-content: flex-end;
48
- gap: 6px;
49
- margin-top: 24px;
50
- }
51
-
52
-
53
- .line-total {
54
- font-weight: 600;
55
- font-size: 14px;
56
- }
57
-
58
- .save-btn , .edit-btn , .delete-btn {
59
- width: 114px !important;
60
- height: 32px !important;
61
- border-radius: 9999px !important;
62
- border: 1px solid var(--primary-color-3nd);
63
- background: #FFF;
64
- }
65
- .delete-btn {
66
- color: #ce3b3a !important;
67
- border: 1px solid #ce3b3a !important;
68
- }
69
- .add-item {
70
- margin-top: 16px;
71
- }
72
- .totals-box {
73
- margin-top: 20px;
74
- width: 400px;
75
- }
76
-
77
- .total-row {
78
- display: flex;
79
- justify-content: space-between;
80
- font-size: 15px;
81
- margin: 6px 0;
82
- }
83
-
84
- .grand{
85
- font-family: 'lusail-bold', sans-serif !important;
86
- }
87
-
88
- .total-row .label {
89
- font-weight: 500;
90
- color: #333;
91
- }
92
-
93
- .total-row .value {
94
- font-weight: 600;
95
- }
96
-
97
- .divider {
98
- border-top: 1px solid #e0e0e0;
99
- margin: 10px 0;
100
- }
101
-
102
- .red {
103
- color: #d9534f;
104
- }
105
-
106
- .green {
107
- color: #0c7d5e;
108
- font-weight: 700;
109
- }
110
-
111
- .grand .value {
112
- font-size: 16px;
113
- }
114
-
115
- .button-text {
116
-
117
- span{
118
- font-size: 16px;
119
- }
120
- mat-icon {
121
- font-size: 16px !important;
122
- }
123
- }
124
- .dataNotFound {
125
- display: flex;
126
- flex-direction: column;
127
- justify-content: center;
128
- align-items: center;
129
- height: 100%;
130
- text-align: center;
131
-
132
- &__icon {
133
- color: var(--primary-color-3nd);
134
- font-size: 24px;
135
- height: 24px;
136
- width: 24px;
137
- margin-bottom: 8px;
138
- }
139
-
140
- &__title {
141
- color: #6A6A6A;
142
- font-size: 18px;
143
- font-weight: 700;
144
- margin-bottom: 4px;
145
- }
146
-
147
- &__subtitle {
148
- color: #6A6A6A;
149
- font-size: 16px;
150
- font-weight: 400;
151
- }
152
- }
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { ItemLineEditorComponent } from './item-line-editor.component';
4
-
5
- describe('ItemLineEditorComponent', () => {
6
- let component: ItemLineEditorComponent;
7
- let fixture: ComponentFixture<ItemLineEditorComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- imports: [ItemLineEditorComponent]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(ItemLineEditorComponent);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });
@@ -1,306 +0,0 @@
1
- import {Component, EventEmitter, Input, OnChanges, Output, SimpleChanges} from '@angular/core';
2
- import {AbstractControl, FormsModule} from "@angular/forms";
3
- import {CommonModule} from "@angular/common";
4
- import {MatButtonModule} from "@angular/material/button";
5
- import {MatIconModule} from "@angular/material/icon";
6
- import {BaseFormCanvasComponent} from "../base-form-canvas/base-form-canvas.component";
7
- import {FieldInfo, EMPTY_PAGE_INFO, PageInfo} from "../../base-model";
8
- import {FormGroup} from "@angular/forms";
9
- import {TranslateModule} from "@ngx-translate/core";
10
- import {LineItem} from "../../base-model/line-item.model";
11
- import {ItemsTotal} from "../../base-model/items-total.model";
12
- @Component({
13
- selector: 'app-item-line-editor',
14
- templateUrl: './item-line-editor.component.html',
15
- standalone: true,
16
- imports: [
17
- CommonModule,
18
- FormsModule,
19
- MatButtonModule,
20
- MatIconModule,
21
- BaseFormCanvasComponent,
22
- TranslateModule
23
- ],
24
- styleUrls: ['./item-line-editor.component.scss']
25
- })
26
-
27
-
28
- export class ItemLineEditorComponent implements OnChanges {
29
- @Input() noDataFoundIcon: string;
30
- @Input() noDataFoundTitle: string;
31
- @Input() noDataFoundSubtitle: string;
32
-
33
- @Input() pageInfo: PageInfo;
34
- @Input() columnHeaderWidths: string[];
35
- @Input() title: string;
36
- @Input() subtitle: string;
37
- @Input() allowAdd: boolean = true;
38
- @Input() allowDelete: boolean = true;
39
- @Input() editable: boolean = true;
40
- @Input() currency: string;
41
- @Input() fields: FieldInfo[] = [];
42
-
43
- private baseFieldsSnapshot: FieldInfo[] | undefined;
44
-
45
-
46
- @Input() items: LineItem[] = [this.blankItem()];
47
-
48
- @Output() itemsChange = new EventEmitter<LineItem[]>();
49
- @Output() itemSaved = new EventEmitter<{ index: number, item: any }>();
50
- @Output() itemDeleted = new EventEmitter<{ index: number }>();
51
- @Output() totalsChange = new EventEmitter<ItemsTotal>();
52
- @Output() editStateChange = new EventEmitter<{ index: number, editing: boolean }>();
53
- formRefs: (FormGroup | undefined)[] = [];
54
-
55
- editing: boolean[] = [true];
56
- noDataFound: boolean = false
57
-
58
- get headerFields(): FieldInfo[] {
59
- return (this.fields || []).filter(f => f.visible && f.row === 1 && f.type !== 'spacer');
60
- }
61
-
62
- get hasInvalidEditingForm(): boolean {
63
- if (!this.formRefs || !this.editing) return false;
64
- for (let i = 0; i < this.formRefs.length; i++) {
65
- const frm = this.formRefs[i];
66
- if (this.editing[i] && frm && frm.invalid) {
67
- return true;
68
- }
69
- }
70
- return false;
71
- }
72
-
73
- get canAddNew(): boolean {
74
- return !this.hasInvalidEditingForm;
75
- }
76
-
77
- canSave(index: number): boolean {
78
- const frm = this.formRefs?.[index];
79
- if (!this.editing?.[index]) return true;
80
- return !!frm && frm.valid;
81
- }
82
-
83
- labelOf(field: FieldInfo): string {
84
- const configuredKey = field.label ? field.label : field.property;
85
- return configuredKey.startsWith(this.pageInfo.labelsSection)
86
- ? configuredKey
87
- : `${this.pageInfo.labelsSection}.${configuredKey}`;
88
- }
89
-
90
- private blankItem() {
91
- return { gtinCode: '', description: '', unitPrice: null, qty: null, discount: null, total: null };
92
- }
93
- ngOnChanges(changes: SimpleChanges): void {
94
- if (changes['items'] && changes['items'].currentValue) {
95
- const len = (this.items || []).length;
96
- this.noDataFound = len <= 0;
97
- if (changes['items'].firstChange) {
98
- this.formRefs = new Array(len).fill(undefined);
99
- this.editing = len > 0 ? new Array(len).fill(false) : [true];
100
- } else {
101
- const oldLen = this.editing?.length || 0;
102
-
103
-
104
- if (!this.formRefs) this.formRefs = [];
105
- if (this.formRefs.length > len) {
106
- this.formRefs = this.formRefs.slice(0, len);
107
- } else {
108
- while (this.formRefs.length < len) this.formRefs.push(undefined);
109
- }
110
-
111
-
112
- if (!this.editing) this.editing = [];
113
- if (this.editing.length > len) {
114
- this.editing = this.editing.slice(0, len);
115
- } else {
116
- for (let i = this.editing.length; i < len; i++) {
117
- this.editing[i] = true;
118
- }
119
- }
120
-
121
-
122
- if (oldLen === 0 && len > 0 && this.editing[0] === undefined) {
123
- this.editing[0] = true;
124
- }
125
- }
126
- this.emitTotals();
127
- }
128
- if (changes['fields'] && changes['fields'].currentValue) {
129
- this.baseFieldsSnapshot = (this.fields || []).map(f => ({...f}));
130
- }
131
- }
132
-
133
- onFormUpdated(form: FormGroup, index: number) {
134
- const discountCtrl = form.get('discount');
135
-
136
- if (discountCtrl) {
137
-
138
- const existing = discountCtrl.validator ? [discountCtrl.validator] : [];
139
- discountCtrl.setValidators([
140
- ...existing,
141
- this.discountValidator(index)
142
- ]);
143
-
144
- discountCtrl.updateValueAndValidity({ emitEvent: false });
145
- }
146
-
147
- this.formRefs[index] = form;
148
- try {
149
- const emittedItems = this.items.map((it, i) => {
150
- if (i !== index) return it;
151
- const v = this.getCurrentValues(i) || it || {};
152
- const up = Number(v?.unitPrice || 0);
153
- const q = Number(v?.qty || 0);
154
- const disc = Number(v?.discount || 0);
155
- const total = Math.max(0, up * q - disc);
156
- return { ...it, ...v, total };
157
- });
158
- this.itemsChange.emit(emittedItems);
159
- } catch (_e) {
160
-
161
- }
162
- this.emitTotals();
163
- }
164
-
165
- addNewItem() {
166
- this.items.push(this.blankItem());
167
- this.formRefs.push(undefined);
168
- this.editing.push(true);
169
-
170
- this.restoreFieldsFromSnapshot();
171
- this.itemsChange.emit([...this.items]);
172
- this.editStateChange.emit({ index: this.items.length - 1, editing: true });
173
- this.emitTotals();
174
- }
175
-
176
- saveRow(index: number) {
177
-
178
- const frm = this.formRefs?.[index];
179
- if (this.editing[index] && frm && frm.invalid) {
180
-
181
- Object.values(frm.controls).forEach(c => c.markAsTouched());
182
- return;
183
- }
184
- const v = this.getCurrentValues(index);
185
- if (!v) return;
186
- this.items[index] = { ...v, total: this.calcLineTotal(index) };
187
-
188
- this.editing[index] = false;
189
-
190
- this.setFieldsReadonly(true);
191
- this.itemsChange.emit([...this.items]);
192
- this.itemSaved.emit({ index, item: this.items[index] });
193
- this.editStateChange.emit({ index, editing: false });
194
- this.emitTotals();
195
- }
196
-
197
- deleteItem(index: number) {
198
- if (index < 0 || index >= this.items.length) return;
199
- this.items.splice(index, 1);
200
- this.formRefs.splice(index, 1);
201
- this.editing.splice(index, 1);
202
-
203
- this.itemsChange.emit([...this.items]);
204
- this.itemDeleted.emit({ index });
205
- this.emitTotals();
206
- }
207
-
208
- clearAll() {
209
- this.items = [this.blankItem()];
210
- this.formRefs = [undefined];
211
- this.editing = [true];
212
- this.itemsChange.emit([...this.items]);
213
- this.emitTotals();
214
- }
215
-
216
- getCurrentValues(index: number) {
217
- const isEditing = this.editing[index];
218
- const frm = this.formRefs[index];
219
-
220
- const base = this.items[index] || {};
221
- const src = (isEditing && frm) ? { ...base, ...frm.value } : { ...base };
222
- if (!src) return null;
223
- const val: any = { ...src };
224
- val.unitPrice = val.unitPrice === null || val.unitPrice === '' ? null : Number(val.unitPrice);
225
- val.qty = val.qty === null || val.qty === '' ? null : Number(val.qty);
226
- val.discount = val.discount === null || val.discount === '' ? null : Number(val.discount);
227
- return val;
228
- }
229
-
230
- calcLineTotal(index: number): number {
231
- const val = this.getCurrentValues(index);
232
- if (!val) return Number(this.items[index]?.total || 0);
233
- return Math.max(0, (val.unitPrice || 0) * (val.qty || 0) - (val.discount || 0));
234
- }
235
-
236
- get subtotal(): number {
237
- return this.items.reduce((s, _it, i) => {
238
- const v = this.getCurrentValues(i);
239
- const up = Number(v?.unitPrice || 0);
240
- const q = Number(v?.qty || 0);
241
- return s + (up * q);
242
- }, 0);
243
- }
244
-
245
- get discountTotal(): number {
246
- return this.items.reduce((s, _it, i) => {
247
- const v = this.getCurrentValues(i);
248
- return s + Number(v?.discount || 0);
249
- }, 0);
250
- }
251
-
252
- get grandTotal(): number {
253
- return this.items.reduce((s, _it, i) => s + this.calcLineTotal(i), 0);
254
- }
255
-
256
- trackByIndex(index: number, _item: any) {
257
- return index;
258
- }
259
-
260
- editRow(index: number) {
261
- this.editing[index] = true;
262
- this.restoreFieldsFromSnapshot();
263
- this.editStateChange.emit({ index, editing: true });
264
- }
265
-
266
- private emitTotals() {
267
- this.totalsChange.emit({
268
- subtotal: this.subtotal,
269
- discount: this.discountTotal,
270
- grandTotal: this.grandTotal
271
- });
272
- }
273
-
274
- private setFieldsReadonly(state: boolean) {
275
- this.fields = (this.fields || []).map(f => ({ ...f, readonly: state }));
276
- }
277
-
278
- private restoreFieldsFromSnapshot() {
279
- if (this.baseFieldsSnapshot && this.baseFieldsSnapshot.length) {
280
- this.fields = this.baseFieldsSnapshot.map(f => ({...f}));
281
- } else {
282
- this.setFieldsReadonly(false);
283
- }
284
- }
285
-
286
- get gridTemplate() {
287
- return this.columnHeaderWidths.join(' ');
288
- }
289
-
290
- private discountValidator(index: number) {
291
- return (control: AbstractControl) => {
292
- const val = this.getCurrentValues(index);
293
- if (!val) return null;
294
-
295
- const totalBeforeDiscount = (val.unitPrice ?? 0) * (val.qty ?? 0);
296
- const discount = val.discount ?? null;
297
-
298
- if (discount != null && discount > totalBeforeDiscount) {
299
- return { discountTooHigh: true };
300
- }
301
-
302
- return null;
303
- };
304
- }
305
-
306
- }