@pepperi-addons/ngx-lib 0.2.60 → 0.2.61-query-builder.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (521) hide show
  1. package/README.md +39 -39
  2. package/address/address.component.theme.scss +5 -8
  3. package/address/pepperi-addons-ngx-lib-address.metadata.json +1 -1
  4. package/attachment/attachment.component.d.ts +1 -0
  5. package/attachment/attachment.component.theme.scss +1 -3
  6. package/attachment/pepperi-addons-ngx-lib-attachment.metadata.json +1 -1
  7. package/bread-crumbs/bread-crumbs.component.theme.scss +9 -9
  8. package/bread-crumbs/pepperi-addons-ngx-lib-bread-crumbs.metadata.json +1 -1
  9. package/bundles/pepperi-addons-ngx-lib-address.umd.js +2 -2
  10. package/bundles/pepperi-addons-ngx-lib-address.umd.js.map +1 -1
  11. package/bundles/pepperi-addons-ngx-lib-attachment.umd.js +7 -2
  12. package/bundles/pepperi-addons-ngx-lib-attachment.umd.js.map +1 -1
  13. package/bundles/pepperi-addons-ngx-lib-bread-crumbs.umd.js +2 -2
  14. package/bundles/pepperi-addons-ngx-lib-bread-crumbs.umd.js.map +1 -1
  15. package/bundles/pepperi-addons-ngx-lib-button.umd.js +2 -2
  16. package/bundles/pepperi-addons-ngx-lib-button.umd.js.map +1 -1
  17. package/bundles/pepperi-addons-ngx-lib-carousel.umd.js.map +1 -1
  18. package/bundles/pepperi-addons-ngx-lib-checkbox.umd.js +5 -2
  19. package/bundles/pepperi-addons-ngx-lib-checkbox.umd.js.map +1 -1
  20. package/bundles/pepperi-addons-ngx-lib-color.umd.js +9 -4
  21. package/bundles/pepperi-addons-ngx-lib-color.umd.js.map +1 -1
  22. package/bundles/pepperi-addons-ngx-lib-date.umd.js +6 -4
  23. package/bundles/pepperi-addons-ngx-lib-date.umd.js.map +1 -1
  24. package/bundles/pepperi-addons-ngx-lib-dialog.umd.js +3 -3
  25. package/bundles/pepperi-addons-ngx-lib-dialog.umd.js.map +1 -1
  26. package/bundles/pepperi-addons-ngx-lib-field-title.umd.js +2 -2
  27. package/bundles/pepperi-addons-ngx-lib-field-title.umd.js.map +1 -1
  28. package/bundles/pepperi-addons-ngx-lib-files-uploader.umd.js +2 -2
  29. package/bundles/pepperi-addons-ngx-lib-files-uploader.umd.js.map +1 -1
  30. package/bundles/pepperi-addons-ngx-lib-form.umd.js +27 -24
  31. package/bundles/pepperi-addons-ngx-lib-form.umd.js.map +1 -1
  32. package/bundles/pepperi-addons-ngx-lib-group-buttons.umd.js +2 -2
  33. package/bundles/pepperi-addons-ngx-lib-group-buttons.umd.js.map +1 -1
  34. package/bundles/pepperi-addons-ngx-lib-icon.umd.js.map +1 -1
  35. package/bundles/pepperi-addons-ngx-lib-image.umd.js +7 -2
  36. package/bundles/pepperi-addons-ngx-lib-image.umd.js.map +1 -1
  37. package/bundles/pepperi-addons-ngx-lib-images-filmstrip.umd.js +7 -2
  38. package/bundles/pepperi-addons-ngx-lib-images-filmstrip.umd.js.map +1 -1
  39. package/bundles/pepperi-addons-ngx-lib-list.umd.js +9 -9
  40. package/bundles/pepperi-addons-ngx-lib-list.umd.js.map +1 -1
  41. package/bundles/pepperi-addons-ngx-lib-menu.umd.js +2 -2
  42. package/bundles/pepperi-addons-ngx-lib-menu.umd.js.map +1 -1
  43. package/bundles/pepperi-addons-ngx-lib-page-layout.umd.js +1 -1
  44. package/bundles/pepperi-addons-ngx-lib-page-layout.umd.js.map +1 -1
  45. package/bundles/pepperi-addons-ngx-lib-quantity-selector.umd.js +7 -2
  46. package/bundles/pepperi-addons-ngx-lib-quantity-selector.umd.js.map +1 -1
  47. package/bundles/pepperi-addons-ngx-lib-query-builder.umd.js +1101 -0
  48. package/bundles/pepperi-addons-ngx-lib-query-builder.umd.js.map +1 -0
  49. package/bundles/pepperi-addons-ngx-lib-rich-html-textarea.umd.js +7 -2
  50. package/bundles/pepperi-addons-ngx-lib-rich-html-textarea.umd.js.map +1 -1
  51. package/bundles/pepperi-addons-ngx-lib-search.umd.js +1 -1
  52. package/bundles/pepperi-addons-ngx-lib-search.umd.js.map +1 -1
  53. package/bundles/pepperi-addons-ngx-lib-select.umd.js +7 -2
  54. package/bundles/pepperi-addons-ngx-lib-select.umd.js.map +1 -1
  55. package/bundles/pepperi-addons-ngx-lib-separator.umd.js +10 -2
  56. package/bundles/pepperi-addons-ngx-lib-separator.umd.js.map +1 -1
  57. package/bundles/pepperi-addons-ngx-lib-side-bar.umd.js +2 -2
  58. package/bundles/pepperi-addons-ngx-lib-side-bar.umd.js.map +1 -1
  59. package/bundles/pepperi-addons-ngx-lib-signature.umd.js +7 -2
  60. package/bundles/pepperi-addons-ngx-lib-signature.umd.js.map +1 -1
  61. package/bundles/pepperi-addons-ngx-lib-size-detector.umd.js +1 -1
  62. package/bundles/pepperi-addons-ngx-lib-size-detector.umd.js.map +1 -1
  63. package/bundles/pepperi-addons-ngx-lib-slider.umd.js +2 -2
  64. package/bundles/pepperi-addons-ngx-lib-slider.umd.js.map +1 -1
  65. package/bundles/pepperi-addons-ngx-lib-smart-filters.umd.js +308 -41
  66. package/bundles/pepperi-addons-ngx-lib-smart-filters.umd.js.map +1 -1
  67. package/bundles/pepperi-addons-ngx-lib-textarea.umd.js +7 -2
  68. package/bundles/pepperi-addons-ngx-lib-textarea.umd.js.map +1 -1
  69. package/bundles/pepperi-addons-ngx-lib-textbox-icon.umd.js +1 -1
  70. package/bundles/pepperi-addons-ngx-lib-textbox-icon.umd.js.map +1 -1
  71. package/bundles/pepperi-addons-ngx-lib-textbox.umd.js +6 -4
  72. package/bundles/pepperi-addons-ngx-lib-textbox.umd.js.map +1 -1
  73. package/bundles/pepperi-addons-ngx-lib-top-bar.umd.js +2 -2
  74. package/bundles/pepperi-addons-ngx-lib-top-bar.umd.js.map +1 -1
  75. package/bundles/pepperi-addons-ngx-lib.umd.js +38 -36
  76. package/bundles/pepperi-addons-ngx-lib.umd.js.map +1 -1
  77. package/button/button.component.theme.scss +0 -2
  78. package/button/pepperi-addons-ngx-lib-button.metadata.json +1 -1
  79. package/checkbox/checkbox.component.theme.scss +0 -2
  80. package/checkbox/pepperi-addons-ngx-lib-checkbox.metadata.json +1 -1
  81. package/color/color-picker.component.theme.scss +169 -175
  82. package/color/color.component.d.ts +1 -0
  83. package/color/color.component.theme.scss +0 -7
  84. package/color/pepperi-addons-ngx-lib-color.metadata.json +1 -1
  85. package/core/common/services/addon.service.d.ts +1 -2
  86. package/core/common/services/file.service.d.ts +4 -4
  87. package/core/customization/customization.service.d.ts +1 -0
  88. package/date/date.component.theme.scss +0 -169
  89. package/date/pepperi-addons-ngx-lib-date.metadata.json +1 -1
  90. package/dialog/dialog.component.theme.scss +5 -5
  91. package/dialog/pepperi-addons-ngx-lib-dialog.metadata.json +1 -1
  92. package/esm2015/address/address.component.js +3 -3
  93. package/esm2015/address/address.module.js +1 -1
  94. package/esm2015/address/public-api.js +1 -1
  95. package/esm2015/attachment/attachment.component.js +8 -3
  96. package/esm2015/attachment/attachment.module.js +1 -1
  97. package/esm2015/attachment/public-api.js +1 -1
  98. package/esm2015/bread-crumbs/bread-crumbs.component.js +3 -3
  99. package/esm2015/bread-crumbs/bread-crumbs.model.js +1 -1
  100. package/esm2015/bread-crumbs/bread-crumbs.module.js +1 -1
  101. package/esm2015/bread-crumbs/public-api.js +1 -1
  102. package/esm2015/button/button.component.js +3 -3
  103. package/esm2015/button/button.model.js +1 -1
  104. package/esm2015/button/button.module.js +1 -1
  105. package/esm2015/button/public-api.js +1 -1
  106. package/esm2015/carousel/carousel-item.directive.js +1 -1
  107. package/esm2015/carousel/carousel.component.js +15 -15
  108. package/esm2015/carousel/carousel.module.js +1 -1
  109. package/esm2015/carousel/public-api.js +1 -1
  110. package/esm2015/checkbox/checkbox.component.js +6 -3
  111. package/esm2015/checkbox/checkbox.module.js +1 -1
  112. package/esm2015/checkbox/public-api.js +1 -1
  113. package/esm2015/color/color-picker.component.js +29 -29
  114. package/esm2015/color/color.component.js +8 -3
  115. package/esm2015/color/color.model.js +1 -1
  116. package/esm2015/color/color.module.js +1 -1
  117. package/esm2015/color/public-api.js +1 -1
  118. package/esm2015/core/clipboard/clipboard.directive.js +1 -1
  119. package/esm2015/core/clipboard/clipboard.service.js +1 -1
  120. package/esm2015/core/clipboard/index.js +1 -1
  121. package/esm2015/core/clipboard/public-api.js +1 -1
  122. package/esm2015/core/common/directives/auto-width.directive.js +1 -1
  123. package/esm2015/core/common/directives/button-blur.directive.js +1 -1
  124. package/esm2015/core/common/directives/button-loader.directive.js +1 -1
  125. package/esm2015/core/common/directives/data-qa.directive.js +1 -1
  126. package/esm2015/core/common/directives/index.js +1 -1
  127. package/esm2015/core/common/directives/menu-blur.directive.js +1 -1
  128. package/esm2015/core/common/directives/prevent-multi-click.directive.js +1 -1
  129. package/esm2015/core/common/directives/public-api.js +1 -1
  130. package/esm2015/core/common/index.js +1 -1
  131. package/esm2015/core/common/model/index.js +1 -1
  132. package/esm2015/core/common/model/papi.model.js +1 -1
  133. package/esm2015/core/common/model/public-api.js +1 -1
  134. package/esm2015/core/common/model/utilities.model.js +1 -1
  135. package/esm2015/core/common/model/wapi.model.js +1 -1
  136. package/esm2015/core/common/pipes/common-pipes.js +1 -1
  137. package/esm2015/core/common/pipes/index.js +1 -1
  138. package/esm2015/core/common/pipes/public-api.js +1 -1
  139. package/esm2015/core/common/public-api.js +1 -1
  140. package/esm2015/core/common/services/addon.service.js +4 -19
  141. package/esm2015/core/common/services/color.service.js +1 -1
  142. package/esm2015/core/common/services/cookie.service.js +1 -1
  143. package/esm2015/core/common/services/data-convertor.service.js +1 -1
  144. package/esm2015/core/common/services/file.service.js +9 -9
  145. package/esm2015/core/common/services/index.js +1 -1
  146. package/esm2015/core/common/services/jwt-helper.service.js +1 -1
  147. package/esm2015/core/common/services/public-api.js +1 -1
  148. package/esm2015/core/common/services/session.service.js +1 -1
  149. package/esm2015/core/common/services/utilities.service.js +25 -4
  150. package/esm2015/core/common/services/validator.service.js +1 -1
  151. package/esm2015/core/common/services/window-scrolling.service.js +5 -5
  152. package/esm2015/core/customization/customization.model.js +1 -1
  153. package/esm2015/core/customization/customization.service.js +4 -2
  154. package/esm2015/core/customization/index.js +1 -1
  155. package/esm2015/core/customization/public-api.js +1 -1
  156. package/esm2015/core/http/index.js +1 -1
  157. package/esm2015/core/http/interceptors/error.interceptor.js +1 -1
  158. package/esm2015/core/http/interceptors/index.js +1 -1
  159. package/esm2015/core/http/interceptors/loader.interceptor.js +1 -1
  160. package/esm2015/core/http/interceptors/profiler.interceptor.js +1 -1
  161. package/esm2015/core/http/public-api.js +1 -1
  162. package/esm2015/core/http/services/http.service.js +1 -1
  163. package/esm2015/core/http/services/loader.service.js +1 -1
  164. package/esm2015/core/index.js +1 -1
  165. package/esm2015/core/layout/index.js +1 -1
  166. package/esm2015/core/layout/layout.service.js +1 -1
  167. package/esm2015/core/layout/public-api.js +1 -1
  168. package/esm2015/core/layout/rtl.directive.js +1 -1
  169. package/esm2015/core/portal/attach.directive.js +1 -1
  170. package/esm2015/core/portal/index.js +1 -1
  171. package/esm2015/core/portal/portal.service.js +1 -1
  172. package/esm2015/core/portal/public-api.js +1 -1
  173. package/esm2015/core/portal/target.directive.js +1 -1
  174. package/esm2015/core/public-api.js +1 -1
  175. package/esm2015/core/scroll-to/index.js +1 -1
  176. package/esm2015/core/scroll-to/public-api.js +1 -1
  177. package/esm2015/core/scroll-to/scroll-to.service.js +1 -1
  178. package/esm2015/date/date.component.js +7 -5
  179. package/esm2015/date/date.module.js +1 -1
  180. package/esm2015/date/public-api.js +1 -1
  181. package/esm2015/dialog/default-dialog.component.js +2 -2
  182. package/esm2015/dialog/dialog.component.js +3 -3
  183. package/esm2015/dialog/dialog.model.js +1 -1
  184. package/esm2015/dialog/dialog.module.js +1 -1
  185. package/esm2015/dialog/dialog.service.js +1 -1
  186. package/esm2015/dialog/public-api.js +1 -1
  187. package/esm2015/field-title/field-title.component.js +3 -3
  188. package/esm2015/field-title/field-title.module.js +1 -1
  189. package/esm2015/field-title/public-api.js +1 -1
  190. package/esm2015/files-uploader/files-uploader.component.js +3 -3
  191. package/esm2015/files-uploader/files-uploader.module.js +1 -1
  192. package/esm2015/files-uploader/public-api.js +1 -1
  193. package/esm2015/form/field-generator.component.js +2 -2
  194. package/esm2015/form/form.component.js +2 -2
  195. package/esm2015/form/form.module.js +1 -1
  196. package/esm2015/form/indicators.component.js +3 -3
  197. package/esm2015/form/internal-button.component.js +21 -18
  198. package/esm2015/form/internal-carusel.component.js +2 -2
  199. package/esm2015/form/internal-carusel.service.js +1 -1
  200. package/esm2015/form/internal-list.component.js +2 -2
  201. package/esm2015/form/internal-menu.component.js +2 -2
  202. package/esm2015/form/internal-page.component.js +2 -2
  203. package/esm2015/form/internal-page.service.js +1 -1
  204. package/esm2015/form/public-api.js +1 -1
  205. package/esm2015/group-buttons/group-buttons.component.js +3 -3
  206. package/esm2015/group-buttons/group-buttons.module.js +1 -1
  207. package/esm2015/group-buttons/public-api.js +1 -1
  208. package/esm2015/icon/icon-generated-all.model.js +1 -1
  209. package/esm2015/icon/icon-generated.model.js +1 -1
  210. package/esm2015/icon/icon-registry.service.js +2 -2
  211. package/esm2015/icon/icon.component.js +1 -1
  212. package/esm2015/icon/icon.module.js +1 -1
  213. package/esm2015/icon/public-api.js +1 -1
  214. package/esm2015/image/image.component.js +8 -3
  215. package/esm2015/image/image.module.js +1 -1
  216. package/esm2015/image/public-api.js +1 -1
  217. package/esm2015/images-filmstrip/images-filmstrip.component.js +8 -3
  218. package/esm2015/images-filmstrip/images-filmstrip.module.js +1 -1
  219. package/esm2015/images-filmstrip/public-api.js +1 -1
  220. package/esm2015/list/list-actions.component.js +2 -2
  221. package/esm2015/list/list-carousel.component.js +2 -2
  222. package/esm2015/list/list-chooser.component.js +2 -2
  223. package/esm2015/list/list-pager.component.js +2 -2
  224. package/esm2015/list/list-sorting.component.js +2 -2
  225. package/esm2015/list/list-total.component.js +3 -3
  226. package/esm2015/list/list-views.component.js +2 -2
  227. package/esm2015/list/list.component.js +2 -2
  228. package/esm2015/list/list.model.js +1 -1
  229. package/esm2015/list/list.module.js +1 -1
  230. package/esm2015/list/public-api.js +1 -1
  231. package/esm2015/menu/menu-item.component.js +2 -2
  232. package/esm2015/menu/menu.component.js +2 -2
  233. package/esm2015/menu/menu.model.js +1 -1
  234. package/esm2015/menu/menu.module.js +1 -1
  235. package/esm2015/menu/public-api.js +1 -1
  236. package/esm2015/ngx-lib.module.js +1 -1
  237. package/esm2015/page-layout/page-layout.component.js +2 -2
  238. package/esm2015/page-layout/page-layout.module.js +1 -1
  239. package/esm2015/page-layout/public-api.js +1 -1
  240. package/esm2015/public-api.js +1 -1
  241. package/esm2015/quantity-selector/public-api.js +1 -1
  242. package/esm2015/quantity-selector/quantity-selector-validation.directive.js +1 -1
  243. package/esm2015/quantity-selector/quantity-selector.component.js +8 -3
  244. package/esm2015/quantity-selector/quantity-selector.module.js +1 -1
  245. package/esm2015/quantity-selector/quantity-selector.pipes.js +1 -1
  246. package/esm2015/query-builder/common/model/filter.js +2 -0
  247. package/esm2015/query-builder/common/model/legacy.js +2 -0
  248. package/esm2015/query-builder/common/model/operator-unit.js +42 -0
  249. package/esm2015/query-builder/common/model/operator.js +207 -0
  250. package/esm2015/query-builder/common/model/structure.js +2 -0
  251. package/esm2015/query-builder/common/model/type-map.js +27 -0
  252. package/esm2015/query-builder/common/model/type.js +6 -0
  253. package/esm2015/query-builder/common/services/output-query.service.js +111 -0
  254. package/esm2015/query-builder/common/services/type-convertor.service.js +40 -0
  255. package/esm2015/query-builder/pepperi-addons-ngx-lib-query-builder.js +9 -0
  256. package/esm2015/query-builder/public-api.js +8 -0
  257. package/esm2015/query-builder/query-builder-item/query-builder-item.component.js +115 -0
  258. package/esm2015/query-builder/query-builder-section/query-builder-section.component.js +64 -0
  259. package/esm2015/query-builder/query-builder.component.js +104 -0
  260. package/esm2015/query-builder/query-builder.module.js +35 -0
  261. package/esm2015/query-builder/query-builder.service.js +280 -0
  262. package/esm2015/rich-html-textarea/public-api.js +1 -1
  263. package/esm2015/rich-html-textarea/rich-html-textarea.component.js +8 -3
  264. package/esm2015/rich-html-textarea/rich-html-textarea.module.js +1 -1
  265. package/esm2015/search/public-api.js +1 -1
  266. package/esm2015/search/search.component.js +2 -2
  267. package/esm2015/search/search.model.js +1 -1
  268. package/esm2015/search/search.module.js +1 -1
  269. package/esm2015/select/public-api.js +1 -1
  270. package/esm2015/select/select.component.js +8 -3
  271. package/esm2015/select/select.module.js +1 -1
  272. package/esm2015/separator/public-api.js +1 -1
  273. package/esm2015/separator/separator.component.js +11 -3
  274. package/esm2015/separator/separator.module.js +1 -1
  275. package/esm2015/side-bar/public-api.js +1 -1
  276. package/esm2015/side-bar/side-bar.component.js +3 -3
  277. package/esm2015/side-bar/side-bar.model.js +1 -1
  278. package/esm2015/side-bar/side-bar.module.js +1 -1
  279. package/esm2015/signature/public-api.js +1 -1
  280. package/esm2015/signature/signature.component.js +8 -3
  281. package/esm2015/signature/signature.module.js +1 -1
  282. package/esm2015/size-detector/public-api.js +1 -1
  283. package/esm2015/size-detector/size-detector.component.js +2 -2
  284. package/esm2015/size-detector/size-detector.module.js +1 -1
  285. package/esm2015/slider/public-api.js +1 -1
  286. package/esm2015/slider/slider.component.js +3 -3
  287. package/esm2015/slider/slider.module.js +1 -1
  288. package/esm2015/smart-filters/boolean-filter/boolean-filter.component.js +23 -3
  289. package/esm2015/smart-filters/common/filter-actions.component.js +2 -2
  290. package/esm2015/smart-filters/common/model/base-filter-component.js +35 -8
  291. package/esm2015/smart-filters/common/model/creator.js +8 -2
  292. package/esm2015/smart-filters/common/model/field.js +12 -1
  293. package/esm2015/smart-filters/common/model/filter.js +1 -1
  294. package/esm2015/smart-filters/common/model/operator.js +8 -8
  295. package/esm2015/smart-filters/common/model/type.js +1 -1
  296. package/esm2015/smart-filters/date-filter/date-filter.component.js +45 -2
  297. package/esm2015/smart-filters/multi-select-filter/multi-select-filter.component.js +53 -14
  298. package/esm2015/smart-filters/number-filter/number-filter.component.js +27 -2
  299. package/esm2015/smart-filters/public-api.js +2 -1
  300. package/esm2015/smart-filters/smart-filters.component.js +3 -3
  301. package/esm2015/smart-filters/smart-filters.module.js +16 -3
  302. package/esm2015/smart-filters/text-filter/text-filter.component.js +79 -0
  303. package/esm2015/textarea/public-api.js +1 -1
  304. package/esm2015/textarea/textarea.component.js +8 -3
  305. package/esm2015/textarea/textarea.module.js +1 -1
  306. package/esm2015/textbox/public-api.js +1 -1
  307. package/esm2015/textbox/textbox-validation.directive.js +1 -1
  308. package/esm2015/textbox/textbox.component.js +7 -5
  309. package/esm2015/textbox/textbox.module.js +1 -1
  310. package/esm2015/textbox-icon/public-api.js +1 -1
  311. package/esm2015/textbox-icon/textbox-icon.component.js +2 -2
  312. package/esm2015/textbox-icon/textbox-icon.module.js +1 -1
  313. package/esm2015/top-bar/public-api.js +1 -1
  314. package/esm2015/top-bar/top-bar.component.js +3 -3
  315. package/esm2015/top-bar/top-bar.model.js +1 -1
  316. package/esm2015/top-bar/top-bar.module.js +1 -1
  317. package/fesm2015/pepperi-addons-ngx-lib-address.js +2 -2
  318. package/fesm2015/pepperi-addons-ngx-lib-address.js.map +1 -1
  319. package/fesm2015/pepperi-addons-ngx-lib-attachment.js +7 -2
  320. package/fesm2015/pepperi-addons-ngx-lib-attachment.js.map +1 -1
  321. package/fesm2015/pepperi-addons-ngx-lib-bread-crumbs.js +2 -2
  322. package/fesm2015/pepperi-addons-ngx-lib-bread-crumbs.js.map +1 -1
  323. package/fesm2015/pepperi-addons-ngx-lib-button.js +2 -2
  324. package/fesm2015/pepperi-addons-ngx-lib-button.js.map +1 -1
  325. package/fesm2015/pepperi-addons-ngx-lib-carousel.js +14 -14
  326. package/fesm2015/pepperi-addons-ngx-lib-carousel.js.map +1 -1
  327. package/fesm2015/pepperi-addons-ngx-lib-checkbox.js +5 -2
  328. package/fesm2015/pepperi-addons-ngx-lib-checkbox.js.map +1 -1
  329. package/fesm2015/pepperi-addons-ngx-lib-color.js +35 -30
  330. package/fesm2015/pepperi-addons-ngx-lib-color.js.map +1 -1
  331. package/fesm2015/pepperi-addons-ngx-lib-date.js +6 -4
  332. package/fesm2015/pepperi-addons-ngx-lib-date.js.map +1 -1
  333. package/fesm2015/pepperi-addons-ngx-lib-dialog.js +3 -3
  334. package/fesm2015/pepperi-addons-ngx-lib-dialog.js.map +1 -1
  335. package/fesm2015/pepperi-addons-ngx-lib-field-title.js +2 -2
  336. package/fesm2015/pepperi-addons-ngx-lib-field-title.js.map +1 -1
  337. package/fesm2015/pepperi-addons-ngx-lib-files-uploader.js +2 -2
  338. package/fesm2015/pepperi-addons-ngx-lib-files-uploader.js.map +1 -1
  339. package/fesm2015/pepperi-addons-ngx-lib-form.js +27 -24
  340. package/fesm2015/pepperi-addons-ngx-lib-form.js.map +1 -1
  341. package/fesm2015/pepperi-addons-ngx-lib-group-buttons.js +2 -2
  342. package/fesm2015/pepperi-addons-ngx-lib-group-buttons.js.map +1 -1
  343. package/fesm2015/pepperi-addons-ngx-lib-icon.js +1 -1
  344. package/fesm2015/pepperi-addons-ngx-lib-icon.js.map +1 -1
  345. package/fesm2015/pepperi-addons-ngx-lib-image.js +7 -2
  346. package/fesm2015/pepperi-addons-ngx-lib-image.js.map +1 -1
  347. package/fesm2015/pepperi-addons-ngx-lib-images-filmstrip.js +7 -2
  348. package/fesm2015/pepperi-addons-ngx-lib-images-filmstrip.js.map +1 -1
  349. package/fesm2015/pepperi-addons-ngx-lib-list.js +9 -9
  350. package/fesm2015/pepperi-addons-ngx-lib-list.js.map +1 -1
  351. package/fesm2015/pepperi-addons-ngx-lib-menu.js +2 -2
  352. package/fesm2015/pepperi-addons-ngx-lib-menu.js.map +1 -1
  353. package/fesm2015/pepperi-addons-ngx-lib-page-layout.js +1 -1
  354. package/fesm2015/pepperi-addons-ngx-lib-page-layout.js.map +1 -1
  355. package/fesm2015/pepperi-addons-ngx-lib-quantity-selector.js +7 -2
  356. package/fesm2015/pepperi-addons-ngx-lib-quantity-selector.js.map +1 -1
  357. package/fesm2015/pepperi-addons-ngx-lib-query-builder.js +1011 -0
  358. package/fesm2015/pepperi-addons-ngx-lib-query-builder.js.map +1 -0
  359. package/fesm2015/pepperi-addons-ngx-lib-rich-html-textarea.js +7 -2
  360. package/fesm2015/pepperi-addons-ngx-lib-rich-html-textarea.js.map +1 -1
  361. package/fesm2015/pepperi-addons-ngx-lib-search.js +1 -1
  362. package/fesm2015/pepperi-addons-ngx-lib-search.js.map +1 -1
  363. package/fesm2015/pepperi-addons-ngx-lib-select.js +7 -2
  364. package/fesm2015/pepperi-addons-ngx-lib-select.js.map +1 -1
  365. package/fesm2015/pepperi-addons-ngx-lib-separator.js +10 -2
  366. package/fesm2015/pepperi-addons-ngx-lib-separator.js.map +1 -1
  367. package/fesm2015/pepperi-addons-ngx-lib-side-bar.js +2 -2
  368. package/fesm2015/pepperi-addons-ngx-lib-side-bar.js.map +1 -1
  369. package/fesm2015/pepperi-addons-ngx-lib-signature.js +7 -2
  370. package/fesm2015/pepperi-addons-ngx-lib-signature.js.map +1 -1
  371. package/fesm2015/pepperi-addons-ngx-lib-size-detector.js +1 -1
  372. package/fesm2015/pepperi-addons-ngx-lib-size-detector.js.map +1 -1
  373. package/fesm2015/pepperi-addons-ngx-lib-slider.js +2 -2
  374. package/fesm2015/pepperi-addons-ngx-lib-slider.js.map +1 -1
  375. package/fesm2015/pepperi-addons-ngx-lib-smart-filters.js +295 -38
  376. package/fesm2015/pepperi-addons-ngx-lib-smart-filters.js.map +1 -1
  377. package/fesm2015/pepperi-addons-ngx-lib-textarea.js +7 -2
  378. package/fesm2015/pepperi-addons-ngx-lib-textarea.js.map +1 -1
  379. package/fesm2015/pepperi-addons-ngx-lib-textbox-icon.js +1 -1
  380. package/fesm2015/pepperi-addons-ngx-lib-textbox-icon.js.map +1 -1
  381. package/fesm2015/pepperi-addons-ngx-lib-textbox.js +6 -4
  382. package/fesm2015/pepperi-addons-ngx-lib-textbox.js.map +1 -1
  383. package/fesm2015/pepperi-addons-ngx-lib-top-bar.js +2 -2
  384. package/fesm2015/pepperi-addons-ngx-lib-top-bar.js.map +1 -1
  385. package/fesm2015/pepperi-addons-ngx-lib.js +42 -34
  386. package/fesm2015/pepperi-addons-ngx-lib.js.map +1 -1
  387. package/field-title/field-title.component.theme.scss +0 -2
  388. package/field-title/pepperi-addons-ngx-lib-field-title.metadata.json +1 -1
  389. package/files-uploader/files-uploader.component.theme.scss +0 -2
  390. package/files-uploader/pepperi-addons-ngx-lib-files-uploader.metadata.json +1 -1
  391. package/form/indicators.component.theme.scss +7 -7
  392. package/form/internal-button.component.d.ts +0 -1
  393. package/form/pepperi-addons-ngx-lib-form.metadata.json +1 -1
  394. package/group-buttons/group-buttons.component.theme.scss +15 -15
  395. package/group-buttons/pepperi-addons-ngx-lib-group-buttons.metadata.json +1 -1
  396. package/image/image.component.d.ts +1 -0
  397. package/image/image.component.theme.scss +33 -35
  398. package/image/pepperi-addons-ngx-lib-image.metadata.json +1 -1
  399. package/images-filmstrip/images-filmstrip.component.d.ts +1 -0
  400. package/images-filmstrip/images-filmstrip.component.theme.scss +33 -32
  401. package/images-filmstrip/pepperi-addons-ngx-lib-images-filmstrip.metadata.json +1 -1
  402. package/list/list-total.component.theme.scss +10 -10
  403. package/list/pepperi-addons-ngx-lib-list.metadata.json +1 -1
  404. package/menu/pepperi-addons-ngx-lib-menu.metadata.json +1 -1
  405. package/package.json +5 -5
  406. package/page-layout/page-layout.component.theme.scss +7 -7
  407. package/page-layout/pepperi-addons-ngx-lib-page-layout.metadata.json +1 -1
  408. package/pepperi-addons-ngx-lib.metadata.json +1 -1
  409. package/quantity-selector/pepperi-addons-ngx-lib-quantity-selector.metadata.json +1 -1
  410. package/quantity-selector/quantity-selector.component.d.ts +1 -0
  411. package/quantity-selector/quantity-selector.component.theme.scss +77 -77
  412. package/query-builder/common/model/filter.d.ts +6 -0
  413. package/query-builder/common/model/legacy.d.ts +26 -0
  414. package/query-builder/common/model/operator-unit.d.ts +13 -0
  415. package/query-builder/common/model/operator.d.ts +21 -0
  416. package/query-builder/common/model/structure.d.ts +4 -0
  417. package/query-builder/common/model/type-map.d.ts +12 -0
  418. package/query-builder/common/model/type.d.ts +4 -0
  419. package/query-builder/common/services/output-query.service.d.ts +44 -0
  420. package/query-builder/common/services/type-convertor.service.d.ts +10 -0
  421. package/query-builder/package.json +14 -0
  422. package/query-builder/pepperi-addons-ngx-lib-query-builder.d.ts +8 -0
  423. package/query-builder/pepperi-addons-ngx-lib-query-builder.metadata.json +1 -0
  424. package/query-builder/public-api.d.ts +4 -0
  425. package/query-builder/query-builder-item/query-builder-item.component.d.ts +37 -0
  426. package/query-builder/query-builder-section/query-builder-section.component.d.ts +27 -0
  427. package/query-builder/query-builder-section/query-builder-section.component.theme.scss +7 -0
  428. package/query-builder/query-builder.component.d.ts +35 -0
  429. package/query-builder/query-builder.module.d.ts +2 -0
  430. package/query-builder/query-builder.service.d.ts +94 -0
  431. package/rich-html-textarea/pepperi-addons-ngx-lib-rich-html-textarea.metadata.json +1 -1
  432. package/rich-html-textarea/rich-html-textarea.component.d.ts +1 -0
  433. package/rich-html-textarea/rich-html-textarea.component.theme.scss +241 -237
  434. package/search/pepperi-addons-ngx-lib-search.metadata.json +1 -1
  435. package/select/pepperi-addons-ngx-lib-select.metadata.json +1 -1
  436. package/select/select.component.d.ts +1 -0
  437. package/select/select.component.theme.scss +0 -2
  438. package/separator/pepperi-addons-ngx-lib-separator.metadata.json +1 -1
  439. package/separator/separator.component.theme.scss +2 -2
  440. package/side-bar/pepperi-addons-ngx-lib-side-bar.metadata.json +1 -1
  441. package/side-bar/side-bar.component.theme.scss +26 -25
  442. package/signature/pepperi-addons-ngx-lib-signature.metadata.json +1 -1
  443. package/signature/signature.component.d.ts +1 -0
  444. package/signature/signature.component.theme.scss +8 -28
  445. package/size-detector/pepperi-addons-ngx-lib-size-detector.metadata.json +1 -1
  446. package/slider/pepperi-addons-ngx-lib-slider.metadata.json +1 -1
  447. package/slider/slider.component.theme.scss +66 -65
  448. package/smart-filters/boolean-filter/boolean-filter.component.d.ts +6 -1
  449. package/smart-filters/common/model/base-filter-component.d.ts +7 -0
  450. package/smart-filters/common/model/field.d.ts +4 -0
  451. package/smart-filters/common/model/operator.d.ts +1 -0
  452. package/smart-filters/common/model/type.d.ts +2 -2
  453. package/smart-filters/date-filter/date-filter.component.d.ts +8 -1
  454. package/smart-filters/multi-select-filter/multi-select-filter.component.d.ts +6 -0
  455. package/smart-filters/number-filter/number-filter.component.d.ts +5 -0
  456. package/smart-filters/pepperi-addons-ngx-lib-smart-filters.metadata.json +1 -1
  457. package/smart-filters/public-api.d.ts +1 -0
  458. package/smart-filters/smart-filters.component.theme.scss +9 -10
  459. package/smart-filters/text-filter/text-filter.component.d.ts +17 -0
  460. package/src/assets/i18n/de.ngx-lib.json +77 -77
  461. package/src/assets/i18n/en.ngx-lib.json +139 -138
  462. package/src/assets/i18n/es.ngx-lib.json +77 -77
  463. package/src/assets/i18n/fr.ngx-lib.json +78 -78
  464. package/src/assets/i18n/he.ngx-lib.json +78 -78
  465. package/src/assets/i18n/hu.ngx-lib.json +78 -78
  466. package/src/assets/i18n/it.ngx-lib.json +78 -78
  467. package/src/assets/i18n/ja.ngx-lib.json +78 -78
  468. package/src/assets/i18n/nl.ngx-lib.json +78 -78
  469. package/src/assets/i18n/pl.ngx-lib.json +78 -78
  470. package/src/assets/i18n/pt.ngx-lib.json +78 -78
  471. package/src/assets/i18n/ru.ngx-lib.json +78 -78
  472. package/src/assets/i18n/zh.ngx-lib.json +76 -76
  473. package/src/assets/images/no-image.svg +41 -41
  474. package/src/core/style/abstracts/breakpoints.scss +37 -35
  475. package/src/core/style/abstracts/functions.scss +439 -422
  476. package/src/core/style/abstracts/mixins.scss +800 -797
  477. package/src/core/style/abstracts/variables.scss +545 -545
  478. package/src/core/style/base/base.scss +874 -873
  479. package/src/core/style/base/grids.scss +4 -4
  480. package/src/core/style/base/helpers.scss +70 -70
  481. package/src/core/style/base/typography.scss +259 -255
  482. package/src/core/style/components/button.scss +346 -349
  483. package/src/core/style/components/checkbox.scss +476 -473
  484. package/src/core/style/components/datetime.scss +182 -22
  485. package/src/core/style/components/file.scss +223 -219
  486. package/src/core/style/components/general.scss +1002 -1086
  487. package/src/core/style/components/input.scss +98 -94
  488. package/src/core/style/components/quantity-selector.scss +17 -14
  489. package/src/core/style/components/radio-button.scss +171 -168
  490. package/src/core/style/components/select.scss +187 -185
  491. package/src/core/style/components/signature.scss +14 -12
  492. package/src/core/style/components/splitter.scss +67 -64
  493. package/src/core/style/components/textarea.scss +198 -195
  494. package/src/core/style/themes/black-theme.scss +7 -7
  495. package/src/core/style/themes/default-theme.scss +144 -144
  496. package/src/core/style/themes/light-theme.scss +7 -7
  497. package/src/core/style/themes/nature-theme.scss +7 -7
  498. package/src/core/style/vendors/normalize.scss +497 -497
  499. package/textarea/pepperi-addons-ngx-lib-textarea.metadata.json +1 -1
  500. package/textarea/textarea.component.d.ts +1 -0
  501. package/textarea/textarea.component.theme.scss +2 -2
  502. package/textbox/pepperi-addons-ngx-lib-textbox.metadata.json +1 -1
  503. package/textbox/textbox.component.theme.scss +3 -3
  504. package/textbox-icon/pepperi-addons-ngx-lib-textbox-icon.metadata.json +1 -1
  505. package/theming.scss +125 -220
  506. package/top-bar/pepperi-addons-ngx-lib-top-bar.metadata.json +1 -1
  507. package/top-bar/top-bar.component.theme.scss +9 -9
  508. package/form/form.component.theme.scss +0 -2
  509. package/form/internal-button.component.theme.scss +0 -2
  510. package/form/internal-menu.component.theme.scss +0 -3
  511. package/list/list-actions.component.theme.scss +0 -3
  512. package/list/list-carousel.component.theme.scss +0 -9
  513. package/list/list-chooser.component.theme.scss +0 -3
  514. package/list/list-pager.component.theme.scss +0 -3
  515. package/list/list-sorting.component.theme.scss +0 -3
  516. package/list/list-views.component.theme.scss +0 -3
  517. package/list/list.component.theme.scss +0 -5
  518. package/list/list_old.component.theme.scss +0 -5
  519. package/menu/menu.component.theme.scss +0 -2
  520. package/search/search.component.theme.scss +0 -3
  521. package/textbox-icon/textbox-icon.component.theme.scss +0 -3
@@ -0,0 +1,1101 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('@angular/flex-layout'), require('@pepperi-addons/ngx-lib/smart-filters'), require('@pepperi-addons/ngx-lib/select'), require('@pepperi-addons/ngx-lib/button'), require('@pepperi-addons/ngx-lib/group-buttons'), require('rxjs')) :
3
+ typeof define === 'function' && define.amd ? define('@pepperi-addons/ngx-lib/query-builder', ['exports', '@angular/core', '@angular/common', '@angular/forms', '@angular/flex-layout', '@pepperi-addons/ngx-lib/smart-filters', '@pepperi-addons/ngx-lib/select', '@pepperi-addons/ngx-lib/button', '@pepperi-addons/ngx-lib/group-buttons', 'rxjs'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['pepperi-addons'] = global['pepperi-addons'] || {}, global['pepperi-addons']['ngx-lib'] = global['pepperi-addons']['ngx-lib'] || {}, global['pepperi-addons']['ngx-lib']['query-builder'] = {}), global.ng.core, global.ng.common, global.ng.forms, global.ng.flexLayout, global['pepperi-addons']['ngx-lib']['smart-filters'], global['pepperi-addons']['ngx-lib'].select, global['pepperi-addons']['ngx-lib'].button, global['pepperi-addons']['ngx-lib']['group-buttons'], global.rxjs));
5
+ }(this, (function (exports, core, common, forms, flexLayout, smartFilters, select, button, groupButtons, rxjs) { 'use strict';
6
+
7
+ var Equals = {
8
+ legacy: 'IsEqual',
9
+ smartFilter: smartFilters.PepSmartFilterOperators.Equals,
10
+ type: ['boolean', 'int', 'text']
11
+ };
12
+ var NotEqual = {
13
+ legacy: 'IsNotEqual',
14
+ smartFilter: smartFilters.PepSmartFilterOperators.NotEqual,
15
+ type: null
16
+ };
17
+ var LessThan = {
18
+ legacy: '<',
19
+ smartFilter: smartFilters.PepSmartFilterOperators.LessThan,
20
+ type: null
21
+ };
22
+ var GreaterThan = {
23
+ legacy: '>',
24
+ smartFilter: smartFilters.PepSmartFilterOperators.GreaterThan,
25
+ type: null
26
+ };
27
+ /*
28
+ const GreaterThanOrEquals: IPepQueryBuilderOperator = {
29
+ legacy: {
30
+ operator: '>=',
31
+ type: 'Integer'
32
+ },
33
+ smartFilter: {
34
+ item: PepSmartFilterOperators.GreaterThanOrEquals,
35
+ type: 'int'
36
+ }
37
+ };
38
+
39
+ const LessThanOrEquals: IPepQueryBuilderOperator = {
40
+ legacy: {
41
+ operator: '<=',
42
+ type: 'Integer'
43
+ },
44
+ smartFilter: {
45
+ item: PepSmartFilterOperators.LessThanOrEquals,
46
+ type: 'int',
47
+ type: 'Integer'
48
+ }
49
+ }; */
50
+ var NumberRange = {
51
+ legacy: 'Between',
52
+ smartFilter: smartFilters.PepSmartFilterOperators.NumberRange,
53
+ type: ['int']
54
+ };
55
+ var Contains = {
56
+ legacy: 'Contains',
57
+ smartFilter: smartFilters.PepSmartFilterOperators.Contains,
58
+ type: null
59
+ };
60
+ /*
61
+ const BeginsWith: IPepQueryBuilderOperator = {
62
+ legacy: {
63
+ operator: 'BeginsWith',
64
+ type: 'String'
65
+ },
66
+ smartFilter: {
67
+ item: PepSmartFilterOperators.BeginsWith,
68
+ type: 'text'
69
+ }
70
+ };
71
+
72
+ const EndsWith: IPepQueryBuilderOperator = {
73
+ legacy: {
74
+ operator: 'EndsWith',
75
+ type: 'String'
76
+ },
77
+ smartFilter: {
78
+ item: PepSmartFilterOperators.EndsWith,
79
+ type: 'text'
80
+ }
81
+ };
82
+
83
+ const Before: IPepQueryBuilderOperator = {
84
+ legacy: {
85
+ operator: 'Before',
86
+ type: 'Date'
87
+ },
88
+ smartFilter: {
89
+ item: PepSmartFilterOperators.Before,
90
+ type: 'date'
91
+ }
92
+ };
93
+
94
+ const After: IPepQueryBuilderOperator = {
95
+ legacy: {
96
+ operator: 'After',
97
+ type: 'Date'
98
+ },
99
+ smartFilter: {
100
+ item: PepSmartFilterOperators.After,
101
+ type: 'date'
102
+ }
103
+ }; */
104
+ var InTheLast = {
105
+ legacy: 'InTheLast',
106
+ smartFilter: smartFilters.PepSmartFilterOperators.InTheLast,
107
+ type: null
108
+ };
109
+ var NotInTheLast = {
110
+ legacy: 'NotInTheLast',
111
+ smartFilter: smartFilters.PepSmartFilterOperators.NotInTheLast,
112
+ type: null
113
+ };
114
+ var Today = {
115
+ legacy: 'Today',
116
+ smartFilter: smartFilters.PepSmartFilterOperators.Today,
117
+ type: null
118
+ };
119
+ var ThisWeek = {
120
+ legacy: 'ThisWeek',
121
+ smartFilter: smartFilters.PepSmartFilterOperators.ThisWeek,
122
+ type: null
123
+ };
124
+ var ThisMonth = {
125
+ legacy: 'ThisMonth',
126
+ smartFilter: smartFilters.PepSmartFilterOperators.ThisMonth,
127
+ type: null
128
+ };
129
+ var DateRange = {
130
+ legacy: 'Between',
131
+ smartFilter: smartFilters.PepSmartFilterOperators.DateRange,
132
+ type: ['date-time']
133
+ };
134
+ var DueIn = {
135
+ legacy: 'DueIn',
136
+ smartFilter: smartFilters.PepSmartFilterOperators.DueIn,
137
+ type: null
138
+ };
139
+ var NotDueIn = {
140
+ legacy: 'NotDueIn',
141
+ smartFilter: smartFilters.PepSmartFilterOperators.NotDueIn,
142
+ type: null
143
+ };
144
+ var On = {
145
+ legacy: 'On',
146
+ smartFilter: smartFilters.PepSmartFilterOperators.On,
147
+ type: null
148
+ };
149
+ var IsEmpty = {
150
+ legacy: 'IsEmpty',
151
+ smartFilter: smartFilters.PepSmartFilterOperators.IsEmpty,
152
+ type: null
153
+ };
154
+ var IsNotEmpty = {
155
+ legacy: 'IsNotEmpty',
156
+ smartFilter: smartFilters.PepSmartFilterOperators.IsNotEmpty,
157
+ type: null
158
+ };
159
+ var In = {
160
+ legacy: 'IsEqual',
161
+ smartFilter: smartFilters.PepSmartFilterOperators.In,
162
+ type: ['multi-select']
163
+ };
164
+ var PepQueryBuilderOperators = [
165
+ Equals,
166
+ NotEqual,
167
+ LessThan,
168
+ // LessThanOrEquals,
169
+ GreaterThan,
170
+ // GreaterThanOrEquals,
171
+ NumberRange,
172
+ Contains,
173
+ // BeginsWith,
174
+ // EndsWith,
175
+ // After,
176
+ // Before,
177
+ InTheLast,
178
+ NotInTheLast,
179
+ Today,
180
+ ThisWeek,
181
+ ThisMonth,
182
+ DateRange,
183
+ DueIn,
184
+ NotDueIn,
185
+ On,
186
+ IsEmpty,
187
+ IsNotEmpty,
188
+ In
189
+ ];
190
+ /**
191
+ * gets a smart filter operator item
192
+ * @param operator legacy operator
193
+ * @param type smart filter's type
194
+ * @returns smart filter operator item
195
+ */
196
+ function getSmartBuilderOperator(operator, type) {
197
+ var smartFilterOperator = PepQueryBuilderOperators.find(function (item) { return item.legacy === operator &&
198
+ (item.type === null || item.type.includes(type)); });
199
+ return smartFilterOperator ? smartFilterOperator.smartFilter : null;
200
+ }
201
+ /**
202
+ * gets a legacy operator value
203
+ * @param operator smart filter operator item
204
+ * @param type smart filter's type
205
+ * @returns legacy operator value
206
+ */
207
+ function getLegacyOperator(operator, type) {
208
+ var legacyOperator = PepQueryBuilderOperators.find(function (item) { return item.smartFilter === operator &&
209
+ (item.type === null || item.type.includes(type)); });
210
+ return legacyOperator ? legacyOperator.legacy : null;
211
+ }
212
+
213
+ var PepTypeConvertorService = /** @class */ (function () {
214
+ function PepTypeConvertorService() {
215
+ this._operators = [];
216
+ this._booleans = [];
217
+ this.initOperators();
218
+ this.initBooleans();
219
+ }
220
+ Object.defineProperty(PepTypeConvertorService.prototype, "operators", {
221
+ get: function () {
222
+ return this._operators;
223
+ },
224
+ enumerable: false,
225
+ configurable: true
226
+ });
227
+ Object.defineProperty(PepTypeConvertorService.prototype, "booleans", {
228
+ get: function () {
229
+ return this._booleans;
230
+ },
231
+ enumerable: false,
232
+ configurable: true
233
+ });
234
+ PepTypeConvertorService.prototype.initOperators = function () {
235
+ this._operators.push({
236
+ key: 'AND',
237
+ value: 'And'
238
+ });
239
+ this._operators.push({
240
+ key: 'OR',
241
+ value: 'Or'
242
+ });
243
+ };
244
+ PepTypeConvertorService.prototype.initBooleans = function () {
245
+ this._booleans.push({
246
+ key: 'True',
247
+ value: 'True'
248
+ });
249
+ this._booleans.push({
250
+ key: 'False',
251
+ value: 'False'
252
+ });
253
+ };
254
+ return PepTypeConvertorService;
255
+ }());
256
+ PepTypeConvertorService.decorators = [
257
+ { type: core.Injectable }
258
+ ];
259
+ PepTypeConvertorService.ctorParameters = function () { return []; };
260
+
261
+ var PepQueryBuilderSectionComponent = /** @class */ (function () {
262
+ function PepQueryBuilderSectionComponent(_typeConvertorService) {
263
+ this._typeConvertorService = _typeConvertorService;
264
+ this.hasFields = true;
265
+ this.createSection = new core.EventEmitter();
266
+ this.createItem = new core.EventEmitter();
267
+ this.remove = new core.EventEmitter();
268
+ this.operatorChange = new core.EventEmitter();
269
+ }
270
+ PepQueryBuilderSectionComponent.prototype.ngOnInit = function () {
271
+ this.initOperators();
272
+ };
273
+ Object.defineProperty(PepQueryBuilderSectionComponent.prototype, "f", {
274
+ get: function () {
275
+ return this.form.controls;
276
+ },
277
+ enumerable: false,
278
+ configurable: true
279
+ });
280
+ PepQueryBuilderSectionComponent.prototype.initOperators = function () {
281
+ var _this = this;
282
+ this.toggleButtons = this._typeConvertorService.operators.map(function (operator) {
283
+ return {
284
+ key: operator.key,
285
+ value: operator.value,
286
+ callback: function (event) { return _this.onOperatorChanged(event); }
287
+ };
288
+ });
289
+ };
290
+ PepQueryBuilderSectionComponent.prototype.onOperatorChanged = function (event) {
291
+ var _a;
292
+ if ((_a = event === null || event === void 0 ? void 0 : event.source) === null || _a === void 0 ? void 0 : _a.key) {
293
+ this.f.operator.setValue(event.source.key);
294
+ this.operatorChange.emit();
295
+ }
296
+ };
297
+ PepQueryBuilderSectionComponent.prototype.onAddRuleClicked = function () {
298
+ this.createItem.emit();
299
+ };
300
+ PepQueryBuilderSectionComponent.prototype.onAddRuleSetClicked = function () {
301
+ this.createSection.emit();
302
+ };
303
+ PepQueryBuilderSectionComponent.prototype.onDeleteSectionClicked = function () {
304
+ this.remove.emit();
305
+ };
306
+ return PepQueryBuilderSectionComponent;
307
+ }());
308
+ PepQueryBuilderSectionComponent.decorators = [
309
+ { type: core.Component, args: [{
310
+ selector: 'pep-query-builder-section',
311
+ template: "<div fxLayout=\"row\" fxLayoutGap=\".5rem\">\r\n <div class=\"query-section-container\" fxLayout=\"column\" fxLayoutGap=\".5rem\">\r\n <div fxLayout=\"row\" fxLayoutAlign=\"space-between\">\r\n <pep-group-buttons [buttons]=\"toggleButtons\" [selectedButtonKey]=\"f.operator?.value || ''\" styleType=\"weak\"\r\n sizeType=\"sm\" [viewType]=\"'toggle'\" [buttonsDisabled]=\"!hasFields\">\r\n </pep-group-buttons>\r\n <div fxLayout=\"row\" fxLayoutGap=\".5rem\">\r\n <pep-button value=\"Add Filter\" styleType=\"weak\" styleStateType=\"system\" sizeType=\"sm\" classNames=\"\"\r\n [disabled]=\"!hasFields\" iconName=\"number_plus\" iconPosition=\"end\" [visible]=\"true\"\r\n (buttonClick)=\"onAddRuleClicked()\"></pep-button>\r\n <ng-container *ngIf=\"depth.current < depth.max-1\">\r\n <pep-button value=\"Add Filter Group\" styleType=\"weak\" styleStateType=\"system\" sizeType=\"sm\"\r\n classNames=\"\" [disabled]=\"!hasFields\" iconName=\"number_plus\" iconPosition=\"end\" [visible]=\"true\"\r\n (buttonClick)=\"onAddRuleSetClicked()\"></pep-button>\r\n </ng-container>\r\n </div>\r\n </div>\r\n <ng-container #sectionContainer></ng-container>\r\n </div>\r\n <pep-button *ngIf=\"depth.current > 0\" styleType=\"weak\" styleStateType=\"system_bin\" sizeType=\"md\" classNames=\"\"\r\n [disabled]=\"false\" iconName=\"system_bin\" iconPosition=\"end\" [visible]=\"true\"\r\n (buttonClick)=\"onDeleteSectionClicked()\">\r\n </pep-button>\r\n</div>",
312
+ styles: [".query-section-container{border-radius:.25rem;border-radius:var(--pep-border-radius-md,.25rem);padding:.5rem;width:100%}", ".query-section-container{box-shadow:0 .25rem .5rem 0 rgba(26,26,26,.08);box-shadow:var(--pep-shadow-sm-offset,0 .25rem .5rem 0) hsla(var(--pep-color-system-primary-h,0),var(--pep-color-system-primary-s,0%),var(--pep-color-system-primary-l,10%),.08);border:1px solid rgba(26,26,26,.24);border:1px solid hsla(var(--pep-color-system-primary-h,0),var(--pep-color-system-primary-s,0%),var(--pep-color-system-primary-l,10%),.24)}"]
313
+ },] }
314
+ ];
315
+ PepQueryBuilderSectionComponent.ctorParameters = function () { return [
316
+ { type: PepTypeConvertorService }
317
+ ]; };
318
+ PepQueryBuilderSectionComponent.propDecorators = {
319
+ form: [{ type: core.Input }],
320
+ depth: [{ type: core.Input }],
321
+ hasFields: [{ type: core.Input }],
322
+ createSection: [{ type: core.Output }],
323
+ createItem: [{ type: core.Output }],
324
+ remove: [{ type: core.Output }],
325
+ operatorChange: [{ type: core.Output }],
326
+ sectionContainer: [{ type: core.ViewChild, args: ['sectionContainer', { read: core.ViewContainerRef, static: true },] }]
327
+ };
328
+
329
+ var PepQueryBuilderItemComponent = /** @class */ (function () {
330
+ function PepQueryBuilderItemComponent(_fb, typeConvertorService) {
331
+ this._fb = _fb;
332
+ this.typeConvertorService = typeConvertorService;
333
+ this._fields = [];
334
+ this._options = [];
335
+ this._selectedField = null;
336
+ this.filterChange = new core.EventEmitter();
337
+ this.remove = new core.EventEmitter();
338
+ this.setupForm(null);
339
+ }
340
+ Object.defineProperty(PepQueryBuilderItemComponent.prototype, "fields", {
341
+ set: function (list) {
342
+ if ((list === null || list === void 0 ? void 0 : list.length) > 0) {
343
+ this._fields = list;
344
+ this._options = list.map(function (field) {
345
+ return {
346
+ key: field.field.id,
347
+ value: field.field.name
348
+ };
349
+ });
350
+ }
351
+ },
352
+ enumerable: false,
353
+ configurable: true
354
+ });
355
+ Object.defineProperty(PepQueryBuilderItemComponent.prototype, "selected", {
356
+ set: function (value) {
357
+ if (value) {
358
+ this._selectedField = value.field;
359
+ this.queryForm.fieldType.setValue(value.fieldType);
360
+ }
361
+ },
362
+ enumerable: false,
363
+ configurable: true
364
+ });
365
+ Object.defineProperty(PepQueryBuilderItemComponent.prototype, "filter", {
366
+ set: function (value) {
367
+ if (value) {
368
+ this._filter = value;
369
+ }
370
+ },
371
+ enumerable: false,
372
+ configurable: true
373
+ });
374
+ Object.defineProperty(PepQueryBuilderItemComponent.prototype, "parentForm", {
375
+ set: function (value) {
376
+ if (value) {
377
+ this._parentForm = value;
378
+ this.addToParentForm();
379
+ }
380
+ },
381
+ enumerable: false,
382
+ configurable: true
383
+ });
384
+ PepQueryBuilderItemComponent.prototype.ngOnInit = function () {
385
+ //
386
+ };
387
+ Object.defineProperty(PepQueryBuilderItemComponent.prototype, "f", {
388
+ get: function () {
389
+ return this.form.controls;
390
+ },
391
+ enumerable: false,
392
+ configurable: true
393
+ });
394
+ Object.defineProperty(PepQueryBuilderItemComponent.prototype, "queryForm", {
395
+ get: function () {
396
+ return this.f.query.controls;
397
+ },
398
+ enumerable: false,
399
+ configurable: true
400
+ });
401
+ PepQueryBuilderItemComponent.prototype.setupForm = function (fieldType) {
402
+ this.form = this._fb.group({
403
+ smart: this._fb.group({
404
+ fieldId: this._fb.control(null),
405
+ fieldType: this._fb.control(null),
406
+ operator: this._fb.control(null),
407
+ operatorUnit: this._fb.control(null),
408
+ values: this._fb.group({
409
+ first: this._fb.control(null),
410
+ second: this._fb.control(null)
411
+ })
412
+ }),
413
+ query: this._fb.group({
414
+ fieldType: this._fb.control(fieldType)
415
+ })
416
+ });
417
+ };
418
+ PepQueryBuilderItemComponent.prototype.addToParentForm = function () {
419
+ this._parentForm.setControl(this.formKey, this.form);
420
+ };
421
+ PepQueryBuilderItemComponent.prototype.onFieldChanged = function (key) {
422
+ var _this = this;
423
+ var item = this._fields.find(function (field) { return field.field.id === key; });
424
+ this.setupForm(item.fieldType);
425
+ this.addToParentForm();
426
+ /**
427
+ * hack due to angular's change detection bug -
428
+ * ERROR Error: There is no FormControl instance attached to form control element with name: [formControlName]
429
+ */
430
+ this._selectedField = null;
431
+ setTimeout(function () {
432
+ _this._selectedField = item ? item.field : null;
433
+ }, 0);
434
+ this._filter = null;
435
+ };
436
+ PepQueryBuilderItemComponent.prototype.onFilterChanged = function () {
437
+ if (this.form.valid) {
438
+ this.filterChange.emit();
439
+ }
440
+ };
441
+ PepQueryBuilderItemComponent.prototype.onDeleteItemClicked = function () {
442
+ this.remove.emit();
443
+ };
444
+ return PepQueryBuilderItemComponent;
445
+ }());
446
+ PepQueryBuilderItemComponent.decorators = [
447
+ { type: core.Component, args: [{
448
+ selector: 'pep-query-builder-item',
449
+ template: "<div fxLayout=\"column\" fxLayoutGap=\".5rem\">\r\n <div fxLayout=\"row\" fxLayoutGap=\".5rem\">\r\n <pep-select fxFlex=\"25%\" [value]=\"_selectedField?.id\" xAlignment=\"left\" [options]=\"_options\"\r\n [renderTitle]=\"false\" (valueChange)=\"onFieldChanged($event)\"></pep-select>\r\n <ng-container *ngIf=\"_selectedField?.componentType\">\r\n <ng-container [ngSwitch]=\"_selectedField.componentType\">\r\n <ng-container *ngSwitchCase=\"'text'\">\r\n <pep-text-filter fxFlex=\"auto\" [showActionButtons]=\"false\" [field]=\"_selectedField\"\r\n [filter]=\"_filter\" [parentForm]=\"f.smart\" [emitOnChange]=\"true\" [inline]=\"true\"\r\n [renderTitle]=\"false\" (filterChange)=\"onFilterChanged()\">\r\n </pep-text-filter>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'boolean'\">\r\n <pep-boolean-filter fxFlex=\"auto\" [showActionButtons]=\"false\" [field]=\"_selectedField\"\r\n [filter]=\"_filter\" [parentForm]=\"f.smart\" [emitOnChange]=\"true\" [inline]=\"true\"\r\n [options]=\"typeConvertorService.booleans\" [renderTitle]=\"false\"\r\n (filterChange)=\"onFilterChanged()\">\r\n </pep-boolean-filter>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'date'\">\r\n <pep-date-filter fxFlex=\"auto\" [showActionButtons]=\"false\" [field]=\"_selectedField\"\r\n [filter]=\"_filter\" [parentForm]=\"f.smart\" [emitOnChange]=\"true\" [inline]=\"true\"\r\n [renderTitle]=\"false\" (filterChange)=\"onFilterChanged()\">\r\n </pep-date-filter>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'multi-select'\">\r\n <pep-multi-select-filter fxFlex=\"auto\" [showActionButtons]=\"false\" [field]=\"_selectedField\"\r\n [filter]=\"_filter\" [parentForm]=\"f.smart\" [emitOnChange]=\"true\" [inline]=\"true\"\r\n [renderTitle]=\"false\" (filterChange)=\"onFilterChanged()\">\r\n </pep-multi-select-filter>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'number'\">\r\n <pep-number-filter fxFlex=\"auto\" [showActionButtons]=\"false\" [field]=\"_selectedField\"\r\n [filter]=\"_filter\" [parentForm]=\"f.smart\" [emitOnChange]=\"true\" [inline]=\"true\"\r\n [renderTitle]=\"false\" (filterChange)=\"onFilterChanged()\">\r\n </pep-number-filter>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <pep-button styleType=\"weak\" styleStateType=\"system_bin\" sizeType=\"md\" classNames=\"\" [disabled]=\"false\"\r\n iconName=\"system_bin\" iconPosition=\"end\" [visible]=\"true\" (buttonClick)=\"onDeleteItemClicked()\">\r\n </pep-button>\r\n </div>\r\n</div>",
450
+ styles: ["::ng-deep .pep-field-no-spacing{min-height:0!important;margin-bottom:0!important}"]
451
+ },] }
452
+ ];
453
+ PepQueryBuilderItemComponent.ctorParameters = function () { return [
454
+ { type: forms.FormBuilder },
455
+ { type: PepTypeConvertorService }
456
+ ]; };
457
+ PepQueryBuilderItemComponent.propDecorators = {
458
+ formKey: [{ type: core.Input }],
459
+ fields: [{ type: core.Input }],
460
+ selected: [{ type: core.Input }],
461
+ filter: [{ type: core.Input }],
462
+ parentForm: [{ type: core.Input }],
463
+ filterChange: [{ type: core.Output }],
464
+ remove: [{ type: core.Output }]
465
+ };
466
+
467
+ var PepQueryBuilderTypeMap = /** @class */ (function () {
468
+ function PepQueryBuilderTypeMap() {
469
+ this.loadTypes();
470
+ }
471
+ PepQueryBuilderTypeMap.prototype.loadTypes = function () {
472
+ this.map = new Map();
473
+ this.map.set('Bool', 'boolean');
474
+ this.map.set('JsonBool', 'boolean');
475
+ this.map.set('Integer', 'int');
476
+ this.map.set('Double', 'int');
477
+ this.map.set('String', 'text');
478
+ this.map.set('Guid', 'text');
479
+ this.map.set('Date', 'date');
480
+ this.map.set('DateTime', 'date-time');
481
+ this.map.set('MultipleStringValues', 'multi-select');
482
+ };
483
+ /**
484
+ * Converts legacy field type to smart builder type
485
+ * @param type legacy type
486
+ * @returns smart builder field type
487
+ */
488
+ PepQueryBuilderTypeMap.prototype.getSmartBuilderType = function (key) {
489
+ var item = this.map.get(key);
490
+ return item ? item : null;
491
+ };
492
+ return PepQueryBuilderTypeMap;
493
+ }());
494
+
495
+ var Days = {
496
+ legacy: 'Days',
497
+ smartFilter: smartFilters.PepSmartFilterOperatorUnits.Days
498
+ };
499
+ var Weeks = {
500
+ legacy: 'Weeks',
501
+ smartFilter: smartFilters.PepSmartFilterOperatorUnits.Weeks
502
+ };
503
+ var Months = {
504
+ legacy: 'Months',
505
+ smartFilter: smartFilters.PepSmartFilterOperatorUnits.Months
506
+ };
507
+ var Years = {
508
+ legacy: 'Years',
509
+ smartFilter: smartFilters.PepSmartFilterOperatorUnits.Years
510
+ };
511
+ var PepQueryBuilderOperationUnit = [
512
+ Days,
513
+ Weeks,
514
+ Months,
515
+ Years,
516
+ ];
517
+ /**
518
+ * gets a smart filter operation unit item
519
+ * @param operationUnit legacy operation unit
520
+ * @returns smart filter operation unit item
521
+ */
522
+ function getSmartBuilderOperationUnit(operationUnit) {
523
+ var smartFilterOperationUnit = PepQueryBuilderOperationUnit.find(function (unit) { return unit.legacy === operationUnit; });
524
+ return smartFilterOperationUnit ? smartFilterOperationUnit.smartFilter : null;
525
+ }
526
+ /**
527
+ * gets a legacy operation unit value
528
+ * @param operationUnit smart filter operation unit item
529
+ * @returns legacy operation unit value
530
+ */
531
+ function getLegacyOperationUnit(operationUnit) {
532
+ var legacyOperationUnit = PepQueryBuilderOperationUnit.find(function (unit) { return unit.smartFilter === operationUnit; });
533
+ return legacyOperationUnit ? legacyOperationUnit.legacy : null;
534
+ }
535
+
536
+ var PepOutputQueryService = /** @class */ (function () {
537
+ function PepOutputQueryService() {
538
+ //
539
+ }
540
+ /**
541
+ * generates a legacy query structure
542
+ * @param filters UI smart filters structure
543
+ * @returns legacy query
544
+ */
545
+ PepOutputQueryService.prototype.generateQuery = function (filters) {
546
+ this.initParams();
547
+ return this.sectionWalk(filters);
548
+ };
549
+ /**
550
+ * init params
551
+ */
552
+ PepOutputQueryService.prototype.initParams = function () {
553
+ this._complexIdCounter = 1;
554
+ this._expressionIdCounter = 1;
555
+ };
556
+ /**
557
+ * a recursive function dynamically builds legacy query structure
558
+ * @param current UI object represents either a section or filter component
559
+ * @returns section query data
560
+ */
561
+ PepOutputQueryService.prototype.sectionWalk = function (current) {
562
+ var _this = this;
563
+ var section = null;
564
+ Object.keys(current).forEach(function (key) {
565
+ if (key.includes('item')) {
566
+ section = _this.addToSection(section, {
567
+ ExpressionId: (_this._expressionIdCounter++).toString(),
568
+ ApiName: current[key].smart.fieldId,
569
+ FieldType: current[key].query.fieldType,
570
+ Operation: getLegacyOperator(current[key].smart.operator, current[key].smart.fieldType),
571
+ Values: _this.getItemValues(current[key].smart)
572
+ }, current.operator);
573
+ }
574
+ else if (key.includes('section')) {
575
+ var childSection = _this.sectionWalk(current[key]);
576
+ if (childSection) {
577
+ section = _this.addToSection(section, childSection, current.operator);
578
+ }
579
+ }
580
+ });
581
+ return section;
582
+ };
583
+ /**
584
+ * adds a legacy filter object to the current query structure
585
+ * @param section section query data
586
+ * @param item filter item
587
+ * @param operator query operator
588
+ * @returns
589
+ */
590
+ PepOutputQueryService.prototype.addToSection = function (section, item, operator) {
591
+ return section ? this.createSection(section, item, operator) : item;
592
+ };
593
+ /**
594
+ * creates a legacy complex object
595
+ * @param left LeftNode object
596
+ * @param right RightNode object
597
+ * @param operator query operator
598
+ * @returns legacy complex object
599
+ */
600
+ PepOutputQueryService.prototype.createSection = function (left, right, operator) {
601
+ return {
602
+ ComplexId: (this._complexIdCounter++).toString(),
603
+ LeftNode: left,
604
+ RightNode: right,
605
+ Operation: operator
606
+ };
607
+ };
608
+ /**
609
+ * gets legacy filter values object
610
+ * @param current UI filter object's values
611
+ * @returns an array represents legacy values
612
+ */
613
+ PepOutputQueryService.prototype.getItemValues = function (current) {
614
+ var _a;
615
+ var values = [];
616
+ if ((_a = current === null || current === void 0 ? void 0 : current.values) === null || _a === void 0 ? void 0 : _a.first) {
617
+ if (current.operator === smartFilters.PepSmartFilterOperators.In) { //multi select
618
+ values = current.values.first;
619
+ }
620
+ else if (current.operator === smartFilters.PepSmartFilterOperators.InTheLast ||
621
+ current.operator === smartFilters.PepSmartFilterOperators.NotInTheLast ||
622
+ current.operator === smartFilters.PepSmartFilterOperators.DueIn ||
623
+ current.operator === smartFilters.PepSmartFilterOperators.NotDueIn) { //operation unit
624
+ values.push(current.values.first);
625
+ if (current.operatorUnit) {
626
+ values.push(getLegacyOperationUnit(current.operatorUnit));
627
+ }
628
+ }
629
+ else {
630
+ values.push(current.values.first);
631
+ if (current.values.second) {
632
+ values.push(current.values.second);
633
+ }
634
+ }
635
+ }
636
+ return values;
637
+ };
638
+ return PepOutputQueryService;
639
+ }());
640
+ PepOutputQueryService.decorators = [
641
+ { type: core.Injectable }
642
+ ];
643
+ PepOutputQueryService.ctorParameters = function () { return []; };
644
+
645
+ var PepOperatorTypes;
646
+ (function (PepOperatorTypes) {
647
+ PepOperatorTypes["And"] = "AND";
648
+ PepOperatorTypes["Or"] = "OR";
649
+ })(PepOperatorTypes || (PepOperatorTypes = {}));
650
+
651
+ var MAX_STRUCTURE_DEPTH = 3;
652
+ var PepQueryBuilderService = /** @class */ (function () {
653
+ function PepQueryBuilderService(_fb, _resolver, _outputQueryService) {
654
+ this._fb = _fb;
655
+ this._resolver = _resolver;
656
+ this._outputQueryService = _outputQueryService;
657
+ this._outputQuery$ = new rxjs.BehaviorSubject(null);
658
+ this._maxStructureDepth = MAX_STRUCTURE_DEPTH;
659
+ this.outputQuery$ = this._outputQuery$.asObservable();
660
+ }
661
+ Object.defineProperty(PepQueryBuilderService.prototype, "maxDepth", {
662
+ get: function () {
663
+ return this._maxStructureDepth;
664
+ },
665
+ set: function (value) {
666
+ this._maxStructureDepth = value;
667
+ },
668
+ enumerable: false,
669
+ configurable: true
670
+ });
671
+ Object.defineProperty(PepQueryBuilderService.prototype, "fields", {
672
+ set: function (list) {
673
+ this._smartFilterFields = this.convertToSmartFilterFields(list);
674
+ },
675
+ enumerable: false,
676
+ configurable: true
677
+ });
678
+ Object.defineProperty(PepQueryBuilderService.prototype, "hasFields", {
679
+ get: function () {
680
+ var _a;
681
+ return ((_a = this._smartFilterFields) === null || _a === void 0 ? void 0 : _a.length) > 0;
682
+ },
683
+ enumerable: false,
684
+ configurable: true
685
+ });
686
+ Object.defineProperty(PepQueryBuilderService.prototype, "form", {
687
+ get: function () {
688
+ return this._form;
689
+ },
690
+ set: function (value) {
691
+ this._form = value;
692
+ },
693
+ enumerable: false,
694
+ configurable: true
695
+ });
696
+ /**
697
+ * builds a dynamic UI query structure
698
+ * might has a different structure than the query's due to parent-child elements merge
699
+ * @param query legacy query
700
+ * @param containerRef reference to root element
701
+ */
702
+ PepQueryBuilderService.prototype.buildQueryStructure = function (query, containerRef) {
703
+ //update root operator
704
+ if (this.hasProperty(query, 'ComplexId') &&
705
+ (query === null || query === void 0 ? void 0 : query.Operation) &&
706
+ query.Operation !== this._form.get('operator').value) {
707
+ this._form.get('operator').setValue(query.Operation);
708
+ }
709
+ this.flatten(this._form.get('operator').value, query, containerRef, this._form, 0);
710
+ };
711
+ /**
712
+ * checks if the object contains property
713
+ * @param obj object
714
+ * @param prop property name
715
+ * @returns true if contains, false otherwise
716
+ */
717
+ PepQueryBuilderService.prototype.hasProperty = function (obj, prop) {
718
+ return Object.prototype.hasOwnProperty.call(obj, prop);
719
+ };
720
+ /**
721
+ * a recursive function dynamically builds UI filters structure
722
+ * @param parentOperator legacy complex operator
723
+ * @param current child legacy object (either another complex or expression type)
724
+ * @param containerRef parent element
725
+ * @param parentForm parent form
726
+ */
727
+ PepQueryBuilderService.prototype.flatten = function (parentOperator, current, containerRef, parentForm, depth) {
728
+ if (this.hasProperty(current, 'ComplexId')) {
729
+ var section = current;
730
+ if (parentOperator === current.Operation) {
731
+ this.flatten(current.Operation, section.LeftNode, containerRef, parentForm, depth);
732
+ this.flatten(current.Operation, section.RightNode, containerRef, parentForm, depth);
733
+ }
734
+ else {
735
+ var result = this.createSection(section.Operation, containerRef, parentForm, depth);
736
+ this.flatten(section.Operation, section.LeftNode, result.containerRef, result.parentForm, depth + 1);
737
+ this.flatten(section.Operation, section.RightNode, result.containerRef, result.parentForm, depth + 1);
738
+ }
739
+ }
740
+ else if (this.hasProperty(current, 'ExpressionId')) {
741
+ this.createItem(current, containerRef, parentForm);
742
+ }
743
+ };
744
+ /**
745
+ * creates a container object of two or more child filter items
746
+ * @param operator AND/OR operator
747
+ * @param containerRef parent element
748
+ * @param parentForm parent form
749
+ * @param depth
750
+ * @returns an object containing the current element and current form
751
+ */
752
+ PepQueryBuilderService.prototype.createSection = function (operator, containerRef, parentForm, depth) {
753
+ var _this = this;
754
+ var factory = this._resolver.resolveComponentFactory(PepQueryBuilderSectionComponent);
755
+ var componentRef = containerRef.createComponent(factory);
756
+ var sectionGroup = this._fb.group({
757
+ operator: this._fb.control(operator)
758
+ });
759
+ var counter = 1;
760
+ Object.keys(parentForm.controls).forEach(function (item) {
761
+ if (item.includes('section')) {
762
+ counter++;
763
+ }
764
+ });
765
+ var formKey = "section" + counter;
766
+ parentForm.addControl(formKey, sectionGroup);
767
+ componentRef.instance.form = sectionGroup;
768
+ componentRef.instance.depth = {
769
+ current: depth,
770
+ max: this._maxStructureDepth
771
+ };
772
+ componentRef.instance.createSection.subscribe(function () {
773
+ var section = _this.createSection(PepOperatorTypes.And, componentRef.instance.sectionContainer, sectionGroup, depth + 1);
774
+ _this.createItem(null, section.containerRef, section.parentForm);
775
+ });
776
+ componentRef.instance.createItem.subscribe(function () {
777
+ _this.createItem(null, componentRef.instance.sectionContainer, sectionGroup);
778
+ });
779
+ componentRef.instance.remove.subscribe(function () {
780
+ parentForm.removeControl(formKey);
781
+ componentRef.destroy();
782
+ _this.createOutputQuery();
783
+ });
784
+ componentRef.instance.operatorChange.subscribe(function () {
785
+ _this.createOutputQuery();
786
+ });
787
+ return {
788
+ containerRef: componentRef.instance.sectionContainer,
789
+ parentForm: sectionGroup
790
+ };
791
+ };
792
+ /**
793
+ * creates a component represents filter item (leaf element - has no childs)
794
+ * @param current filter legacy element
795
+ * @param containerRef parent element
796
+ * @param parentForm parent form
797
+ */
798
+ PepQueryBuilderService.prototype.createItem = function (current, containerRef, parentForm) {
799
+ var _this = this;
800
+ var factory = this._resolver.resolveComponentFactory(PepQueryBuilderItemComponent);
801
+ var componentRef = containerRef.createComponent(factory);
802
+ var counter = 1;
803
+ Object.keys(parentForm.controls).forEach(function (item) {
804
+ if (item.includes('item')) {
805
+ counter++;
806
+ }
807
+ });
808
+ var formKey = "item" + counter;
809
+ componentRef.instance.formKey = formKey;
810
+ componentRef.instance.fields = this._smartFilterFields;
811
+ var selectedField = this.getSelectedField(current);
812
+ if (selectedField) {
813
+ componentRef.instance.selected = selectedField;
814
+ if (current) {
815
+ componentRef.instance.filter = this.getFilter(current, selectedField.field);
816
+ }
817
+ }
818
+ componentRef.instance.parentForm = parentForm;
819
+ componentRef.instance.filterChange.subscribe(function () {
820
+ _this.createOutputQuery();
821
+ });
822
+ componentRef.instance.remove.subscribe(function () {
823
+ parentForm.removeControl(formKey);
824
+ componentRef.destroy();
825
+ _this.createOutputQuery();
826
+ });
827
+ };
828
+ /**
829
+ * creates a smart filter object
830
+ * @param current filter legacy element
831
+ * @param field filter's selected field
832
+ * @returns smart filter object
833
+ */
834
+ PepQueryBuilderService.prototype.getFilter = function (current, field) {
835
+ var operator = getSmartBuilderOperator(current.Operation, field.type);
836
+ if (operator) {
837
+ var filterValues = this.getFilterValues(current, operator, field);
838
+ return smartFilters.createSmartFilter(current.ApiName, operator, filterValues.first, filterValues.second, filterValues.operationUnit);
839
+ }
840
+ else {
841
+ return null;
842
+ }
843
+ };
844
+ /**
845
+ * get smart filter field
846
+ * @param current filter legacy element
847
+ * @returns smart filter field, if not found returns the first field
848
+ */
849
+ PepQueryBuilderService.prototype.getSelectedField = function (current) {
850
+ var _a, _b;
851
+ if (current) {
852
+ var item = this._smartFilterFields.find(function (field) { return field.field.id === current.ApiName; });
853
+ return item ? item : ((_a = this._smartFilterFields) === null || _a === void 0 ? void 0 : _a.length) > 0 ? this._smartFilterFields[0] : null;
854
+ }
855
+ else {
856
+ return ((_b = this._smartFilterFields) === null || _b === void 0 ? void 0 : _b.length) > 0 ? this._smartFilterFields[0] : null;
857
+ }
858
+ };
859
+ /**
860
+ * gets smart filter's values data
861
+ * @param current filter legacy element
862
+ * @param operator smart filter operator
863
+ * @param field filter's selected field
864
+ * @returns object contains the filter values data
865
+ */
866
+ PepQueryBuilderService.prototype.getFilterValues = function (current, operator, field) {
867
+ var _a, _b, _c, _d, _e;
868
+ var data = {
869
+ first: null,
870
+ second: null,
871
+ operationUnit: null
872
+ };
873
+ if (operator === smartFilters.PepSmartFilterOperators.In) { //multi select
874
+ //filter keys don't exist on field options
875
+ data.first = ((_a = current === null || current === void 0 ? void 0 : current.Values) === null || _a === void 0 ? void 0 : _a.length) > 0 ? current.Values.filter(function (item) {
876
+ return field.options.find(function (option) { return option.key === item; });
877
+ }) : null;
878
+ }
879
+ else if (operator === smartFilters.PepSmartFilterOperators.InTheLast ||
880
+ operator === smartFilters.PepSmartFilterOperators.NotInTheLast ||
881
+ operator === smartFilters.PepSmartFilterOperators.DueIn ||
882
+ operator === smartFilters.PepSmartFilterOperators.NotDueIn) { //operation unit
883
+ data.first = ((_b = current === null || current === void 0 ? void 0 : current.Values) === null || _b === void 0 ? void 0 : _b.length) > 0 ? current.Values[0] : null;
884
+ if (((_c = current === null || current === void 0 ? void 0 : current.Values) === null || _c === void 0 ? void 0 : _c.length) === 2) {
885
+ data.operationUnit = getSmartBuilderOperationUnit(current.Values[1]);
886
+ }
887
+ }
888
+ else {
889
+ data.first = ((_d = current === null || current === void 0 ? void 0 : current.Values) === null || _d === void 0 ? void 0 : _d.length) > 0 ? current.Values[0] : null;
890
+ data.second = ((_e = current === null || current === void 0 ? void 0 : current.Values) === null || _e === void 0 ? void 0 : _e.length) === 2 ? current.Values[1] : null;
891
+ }
892
+ return data;
893
+ };
894
+ /**
895
+ * converts legacy fields to smart filter fields
896
+ * @param fields legacy fields array
897
+ * @returns smart filter fields array
898
+ */
899
+ PepQueryBuilderService.prototype.convertToSmartFilterFields = function (fields) {
900
+ if ((fields === null || fields === void 0 ? void 0 : fields.length) > 0) {
901
+ var typeMapper_1 = new PepQueryBuilderTypeMap();
902
+ return fields.map(function (field) {
903
+ var _a;
904
+ return {
905
+ field: smartFilters.createSmartFilterField({
906
+ id: field.FieldID,
907
+ name: field.Title,
908
+ options: (_a = field.OptionalValues) === null || _a === void 0 ? void 0 : _a.map(function (option) {
909
+ return {
910
+ key: option.Key,
911
+ value: option.Value
912
+ };
913
+ })
914
+ }, typeMapper_1.getSmartBuilderType(field.FieldType)),
915
+ fieldType: field.FieldType
916
+ };
917
+ });
918
+ }
919
+ else {
920
+ return [];
921
+ }
922
+ };
923
+ /**
924
+ * creates a legacy output query
925
+ */
926
+ PepQueryBuilderService.prototype.createOutputQuery = function () {
927
+ if (this._form.valid) {
928
+ var query = this._outputQueryService.generateQuery(this._form.value);
929
+ this._outputQuery$.next(query);
930
+ }
931
+ };
932
+ return PepQueryBuilderService;
933
+ }());
934
+ PepQueryBuilderService.decorators = [
935
+ { type: core.Injectable }
936
+ ];
937
+ PepQueryBuilderService.ctorParameters = function () { return [
938
+ { type: forms.FormBuilder },
939
+ { type: core.ComponentFactoryResolver },
940
+ { type: PepOutputQueryService }
941
+ ]; };
942
+
943
+ var PepQueryBuilderComponent = /** @class */ (function () {
944
+ function PepQueryBuilderComponent(_fb, queryBuilderService) {
945
+ var _this = this;
946
+ this._fb = _fb;
947
+ this.queryBuilderService = queryBuilderService;
948
+ this._query = null;
949
+ this.queryChange = new core.EventEmitter();
950
+ this.formValidationChange = new core.EventEmitter();
951
+ this._lastFormValidStatus = true;
952
+ this.hasFields = false;
953
+ this.setupForm();
954
+ this.initDepth();
955
+ this._formSubscription$ = this.queryBuilderService.form.valueChanges.subscribe(function (val) {
956
+ if (_this.queryBuilderService.form.valid !== _this._lastFormValidStatus) {
957
+ _this._lastFormValidStatus = _this.queryBuilderService.form.valid;
958
+ _this.formValidationChange.emit(_this._lastFormValidStatus);
959
+ }
960
+ });
961
+ this._outputQuerySubscription$ = this.queryBuilderService.outputQuery$.subscribe(function (outputQuery) {
962
+ _this.queryChange.emit(outputQuery);
963
+ });
964
+ }
965
+ Object.defineProperty(PepQueryBuilderComponent.prototype, "query", {
966
+ set: function (object) {
967
+ this._query = object;
968
+ this.loadQuery();
969
+ },
970
+ enumerable: false,
971
+ configurable: true
972
+ });
973
+ Object.defineProperty(PepQueryBuilderComponent.prototype, "fields", {
974
+ set: function (list) {
975
+ this.queryBuilderService.fields = list;
976
+ this.hasFields = this.queryBuilderService.hasFields;
977
+ this.loadQuery();
978
+ },
979
+ enumerable: false,
980
+ configurable: true
981
+ });
982
+ Object.defineProperty(PepQueryBuilderComponent.prototype, "maxDepth", {
983
+ set: function (value) {
984
+ this.queryBuilderService.maxDepth = value;
985
+ },
986
+ enumerable: false,
987
+ configurable: true
988
+ });
989
+ PepQueryBuilderComponent.prototype.ngOnInit = function () {
990
+ //
991
+ };
992
+ PepQueryBuilderComponent.prototype.setupForm = function () {
993
+ this.queryBuilderService.form = this._fb.group({
994
+ operator: this._fb.control(PepOperatorTypes.And)
995
+ });
996
+ };
997
+ PepQueryBuilderComponent.prototype.initDepth = function () {
998
+ this.depth = {
999
+ current: 0,
1000
+ max: this.queryBuilderService.maxDepth
1001
+ };
1002
+ };
1003
+ /**
1004
+ * builds UI query structure as soon as both the fields and query loads
1005
+ */
1006
+ PepQueryBuilderComponent.prototype.loadQuery = function () {
1007
+ var _a;
1008
+ if (this._query &&
1009
+ this.queryBuilderService.hasFields &&
1010
+ ((_a = this.root) === null || _a === void 0 ? void 0 : _a.sectionContainer)) {
1011
+ this.queryBuilderService.buildQueryStructure(this._query, this.root.sectionContainer);
1012
+ }
1013
+ };
1014
+ PepQueryBuilderComponent.prototype.onCreateSection = function () {
1015
+ var section = this.queryBuilderService.createSection(PepOperatorTypes.And, this.root.sectionContainer, this.queryBuilderService.form, 1);
1016
+ this.queryBuilderService.createItem(null, section.containerRef, section.parentForm);
1017
+ };
1018
+ PepQueryBuilderComponent.prototype.onCreateItem = function () {
1019
+ this.queryBuilderService.createItem(null, this.root.sectionContainer, this.queryBuilderService.form);
1020
+ };
1021
+ PepQueryBuilderComponent.prototype.onOperatorChange = function () {
1022
+ this.queryBuilderService.createOutputQuery();
1023
+ };
1024
+ PepQueryBuilderComponent.prototype.ngOnDestroy = function () {
1025
+ if (this._formSubscription$) {
1026
+ this._formSubscription$.unsubscribe();
1027
+ }
1028
+ if (this._outputQuerySubscription$) {
1029
+ this._outputQuerySubscription$.unsubscribe();
1030
+ }
1031
+ };
1032
+ return PepQueryBuilderComponent;
1033
+ }());
1034
+ PepQueryBuilderComponent.decorators = [
1035
+ { type: core.Component, args: [{
1036
+ selector: 'pep-query-builder',
1037
+ template: "<pep-query-builder-section #rootContainer [form]=\"queryBuilderService.form\" [depth]=\"depth\" [hasFields]=\"hasFields\"\r\n (createSection)=\"onCreateSection()\" (createItem)=\"onCreateItem()\" (operatorChange)=\"onOperatorChange()\">\r\n</pep-query-builder-section>",
1038
+ providers: [PepQueryBuilderService, PepTypeConvertorService, PepOutputQueryService],
1039
+ styles: [""]
1040
+ },] }
1041
+ ];
1042
+ PepQueryBuilderComponent.ctorParameters = function () { return [
1043
+ { type: forms.FormBuilder },
1044
+ { type: PepQueryBuilderService }
1045
+ ]; };
1046
+ PepQueryBuilderComponent.propDecorators = {
1047
+ query: [{ type: core.Input }],
1048
+ fields: [{ type: core.Input }],
1049
+ maxDepth: [{ type: core.Input }],
1050
+ queryChange: [{ type: core.Output }],
1051
+ formValidationChange: [{ type: core.Output }],
1052
+ root: [{ type: core.ViewChild, args: ['rootContainer', { static: true },] }]
1053
+ };
1054
+
1055
+ var PepQueryBuilderModule = /** @class */ (function () {
1056
+ function PepQueryBuilderModule() {
1057
+ }
1058
+ return PepQueryBuilderModule;
1059
+ }());
1060
+ PepQueryBuilderModule.decorators = [
1061
+ { type: core.NgModule, args: [{
1062
+ imports: [
1063
+ common.CommonModule,
1064
+ forms.ReactiveFormsModule,
1065
+ flexLayout.FlexLayoutModule,
1066
+ select.PepSelectModule,
1067
+ button.PepButtonModule,
1068
+ groupButtons.PepGroupButtonsModule,
1069
+ smartFilters.PepSmartFiltersModule
1070
+ ],
1071
+ exports: [
1072
+ PepQueryBuilderComponent
1073
+ ],
1074
+ declarations: [
1075
+ PepQueryBuilderComponent,
1076
+ PepQueryBuilderSectionComponent,
1077
+ PepQueryBuilderItemComponent
1078
+ ]
1079
+ },] }
1080
+ ];
1081
+
1082
+ /*
1083
+ * Public API Surface of ngx-lib/query-builder
1084
+ */
1085
+
1086
+ /**
1087
+ * Generated bundle index. Do not edit.
1088
+ */
1089
+
1090
+ exports.PepQueryBuilderComponent = PepQueryBuilderComponent;
1091
+ exports.PepQueryBuilderModule = PepQueryBuilderModule;
1092
+ exports.PepQueryBuilderService = PepQueryBuilderService;
1093
+ exports.ɵa = PepOutputQueryService;
1094
+ exports.ɵb = PepTypeConvertorService;
1095
+ exports.ɵc = PepQueryBuilderSectionComponent;
1096
+ exports.ɵd = PepQueryBuilderItemComponent;
1097
+
1098
+ Object.defineProperty(exports, '__esModule', { value: true });
1099
+
1100
+ })));
1101
+ //# sourceMappingURL=pepperi-addons-ngx-lib-query-builder.umd.js.map