@pepperi-addons/ngx-lib 0.2.58-beta.1 → 0.2.59

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 (163) hide show
  1. package/attachment/attachment.component.d.ts +0 -1
  2. package/attachment/pepperi-addons-ngx-lib-attachment.metadata.json +1 -1
  3. package/bundles/pepperi-addons-ngx-lib-attachment.umd.js +1 -6
  4. package/bundles/pepperi-addons-ngx-lib-attachment.umd.js.map +1 -1
  5. package/bundles/pepperi-addons-ngx-lib-checkbox.umd.js +0 -3
  6. package/bundles/pepperi-addons-ngx-lib-checkbox.umd.js.map +1 -1
  7. package/bundles/pepperi-addons-ngx-lib-color.umd.js +1 -6
  8. package/bundles/pepperi-addons-ngx-lib-color.umd.js.map +1 -1
  9. package/bundles/pepperi-addons-ngx-lib-date.umd.js +0 -3
  10. package/bundles/pepperi-addons-ngx-lib-date.umd.js.map +1 -1
  11. package/bundles/pepperi-addons-ngx-lib-form.umd.js +15 -18
  12. package/bundles/pepperi-addons-ngx-lib-form.umd.js.map +1 -1
  13. package/bundles/pepperi-addons-ngx-lib-image.umd.js +1 -6
  14. package/bundles/pepperi-addons-ngx-lib-image.umd.js.map +1 -1
  15. package/bundles/pepperi-addons-ngx-lib-images-filmstrip.umd.js +1 -6
  16. package/bundles/pepperi-addons-ngx-lib-images-filmstrip.umd.js.map +1 -1
  17. package/bundles/pepperi-addons-ngx-lib-quantity-selector.umd.js +1 -6
  18. package/bundles/pepperi-addons-ngx-lib-quantity-selector.umd.js.map +1 -1
  19. package/bundles/pepperi-addons-ngx-lib-rich-html-textarea.umd.js +1 -6
  20. package/bundles/pepperi-addons-ngx-lib-rich-html-textarea.umd.js.map +1 -1
  21. package/bundles/pepperi-addons-ngx-lib-select.umd.js +1 -6
  22. package/bundles/pepperi-addons-ngx-lib-select.umd.js.map +1 -1
  23. package/bundles/pepperi-addons-ngx-lib-separator.umd.js +0 -8
  24. package/bundles/pepperi-addons-ngx-lib-separator.umd.js.map +1 -1
  25. package/bundles/pepperi-addons-ngx-lib-signature.umd.js +1 -6
  26. package/bundles/pepperi-addons-ngx-lib-signature.umd.js.map +1 -1
  27. package/bundles/pepperi-addons-ngx-lib-smart-filters.umd.js +173 -1432
  28. package/bundles/pepperi-addons-ngx-lib-smart-filters.umd.js.map +1 -1
  29. package/bundles/pepperi-addons-ngx-lib-textarea.umd.js +1 -6
  30. package/bundles/pepperi-addons-ngx-lib-textarea.umd.js.map +1 -1
  31. package/bundles/pepperi-addons-ngx-lib-textbox.umd.js +2 -4
  32. package/bundles/pepperi-addons-ngx-lib-textbox.umd.js.map +1 -1
  33. package/bundles/pepperi-addons-ngx-lib.umd.js +101 -85
  34. package/bundles/pepperi-addons-ngx-lib.umd.js.map +1 -1
  35. package/color/color.component.d.ts +0 -1
  36. package/color/pepperi-addons-ngx-lib-color.metadata.json +1 -1
  37. package/core/common/services/color.service.d.ts +3 -3
  38. package/core/customization/customization.service.d.ts +0 -1
  39. package/esm2015/attachment/attachment.component.js +2 -7
  40. package/esm2015/checkbox/checkbox.component.js +1 -4
  41. package/esm2015/color/color.component.js +2 -7
  42. package/esm2015/color/public-api.js +1 -2
  43. package/esm2015/core/common/services/color.service.js +101 -83
  44. package/esm2015/core/customization/customization.service.js +2 -4
  45. package/esm2015/date/date.component.js +1 -4
  46. package/esm2015/form/internal-button.component.js +17 -20
  47. package/esm2015/image/image.component.js +2 -7
  48. package/esm2015/images-filmstrip/images-filmstrip.component.js +2 -7
  49. package/esm2015/quantity-selector/quantity-selector.component.js +2 -7
  50. package/esm2015/rich-html-textarea/rich-html-textarea.component.js +2 -7
  51. package/esm2015/select/select.component.js +2 -7
  52. package/esm2015/separator/separator.component.js +1 -9
  53. package/esm2015/signature/signature.component.js +2 -7
  54. package/esm2015/smart-filters/boolean-filter/boolean-filter.component.js +2 -12
  55. package/esm2015/smart-filters/common/model/base-filter-component.js +10 -40
  56. package/esm2015/smart-filters/common/model/creator.js +2 -8
  57. package/esm2015/smart-filters/common/model/field.js +1 -12
  58. package/esm2015/smart-filters/common/model/operator.js +8 -8
  59. package/esm2015/smart-filters/common/model/type.js +1 -1
  60. package/esm2015/smart-filters/date-filter/date-filter.component.js +2 -45
  61. package/esm2015/smart-filters/multi-select-filter/multi-select-filter.component.js +14 -53
  62. package/esm2015/smart-filters/number-filter/number-filter.component.js +2 -25
  63. package/esm2015/smart-filters/pepperi-addons-ngx-lib-smart-filters.js +1 -8
  64. package/esm2015/smart-filters/public-api.js +1 -2
  65. package/esm2015/smart-filters/smart-filters.module.js +2 -14
  66. package/esm2015/textarea/textarea.component.js +2 -7
  67. package/esm2015/textbox/textbox.component.js +3 -5
  68. package/fesm2015/pepperi-addons-ngx-lib-attachment.js +1 -6
  69. package/fesm2015/pepperi-addons-ngx-lib-attachment.js.map +1 -1
  70. package/fesm2015/pepperi-addons-ngx-lib-checkbox.js +0 -3
  71. package/fesm2015/pepperi-addons-ngx-lib-checkbox.js.map +1 -1
  72. package/fesm2015/pepperi-addons-ngx-lib-color.js +1 -6
  73. package/fesm2015/pepperi-addons-ngx-lib-color.js.map +1 -1
  74. package/fesm2015/pepperi-addons-ngx-lib-date.js +0 -3
  75. package/fesm2015/pepperi-addons-ngx-lib-date.js.map +1 -1
  76. package/fesm2015/pepperi-addons-ngx-lib-form.js +15 -18
  77. package/fesm2015/pepperi-addons-ngx-lib-form.js.map +1 -1
  78. package/fesm2015/pepperi-addons-ngx-lib-image.js +1 -6
  79. package/fesm2015/pepperi-addons-ngx-lib-image.js.map +1 -1
  80. package/fesm2015/pepperi-addons-ngx-lib-images-filmstrip.js +1 -6
  81. package/fesm2015/pepperi-addons-ngx-lib-images-filmstrip.js.map +1 -1
  82. package/fesm2015/pepperi-addons-ngx-lib-quantity-selector.js +1 -6
  83. package/fesm2015/pepperi-addons-ngx-lib-quantity-selector.js.map +1 -1
  84. package/fesm2015/pepperi-addons-ngx-lib-rich-html-textarea.js +1 -6
  85. package/fesm2015/pepperi-addons-ngx-lib-rich-html-textarea.js.map +1 -1
  86. package/fesm2015/pepperi-addons-ngx-lib-select.js +1 -6
  87. package/fesm2015/pepperi-addons-ngx-lib-select.js.map +1 -1
  88. package/fesm2015/pepperi-addons-ngx-lib-separator.js +0 -8
  89. package/fesm2015/pepperi-addons-ngx-lib-separator.js.map +1 -1
  90. package/fesm2015/pepperi-addons-ngx-lib-signature.js +1 -6
  91. package/fesm2015/pepperi-addons-ngx-lib-signature.js.map +1 -1
  92. package/fesm2015/pepperi-addons-ngx-lib-smart-filters.js +128 -1293
  93. package/fesm2015/pepperi-addons-ngx-lib-smart-filters.js.map +1 -1
  94. package/fesm2015/pepperi-addons-ngx-lib-textarea.js +1 -6
  95. package/fesm2015/pepperi-addons-ngx-lib-textarea.js.map +1 -1
  96. package/fesm2015/pepperi-addons-ngx-lib-textbox.js +2 -4
  97. package/fesm2015/pepperi-addons-ngx-lib-textbox.js.map +1 -1
  98. package/fesm2015/pepperi-addons-ngx-lib.js +101 -85
  99. package/fesm2015/pepperi-addons-ngx-lib.js.map +1 -1
  100. package/form/internal-button.component.d.ts +1 -0
  101. package/image/image.component.d.ts +0 -1
  102. package/image/pepperi-addons-ngx-lib-image.metadata.json +1 -1
  103. package/images-filmstrip/images-filmstrip.component.d.ts +0 -1
  104. package/images-filmstrip/pepperi-addons-ngx-lib-images-filmstrip.metadata.json +1 -1
  105. package/package.json +1 -1
  106. package/pepperi-addons-ngx-lib.metadata.json +1 -1
  107. package/quantity-selector/pepperi-addons-ngx-lib-quantity-selector.metadata.json +1 -1
  108. package/quantity-selector/quantity-selector.component.d.ts +0 -1
  109. package/rich-html-textarea/pepperi-addons-ngx-lib-rich-html-textarea.metadata.json +1 -1
  110. package/rich-html-textarea/rich-html-textarea.component.d.ts +0 -1
  111. package/select/pepperi-addons-ngx-lib-select.metadata.json +1 -1
  112. package/select/select.component.d.ts +0 -1
  113. package/separator/pepperi-addons-ngx-lib-separator.metadata.json +1 -1
  114. package/signature/pepperi-addons-ngx-lib-signature.metadata.json +1 -1
  115. package/signature/signature.component.d.ts +0 -1
  116. package/smart-filters/boolean-filter/boolean-filter.component.d.ts +1 -5
  117. package/smart-filters/common/model/base-filter-component.d.ts +1 -10
  118. package/smart-filters/common/model/field.d.ts +0 -4
  119. package/smart-filters/common/model/operator.d.ts +0 -1
  120. package/smart-filters/common/model/type.d.ts +2 -2
  121. package/smart-filters/date-filter/date-filter.component.d.ts +1 -8
  122. package/smart-filters/multi-select-filter/multi-select-filter.component.d.ts +0 -6
  123. package/smart-filters/number-filter/number-filter.component.d.ts +0 -5
  124. package/smart-filters/pepperi-addons-ngx-lib-smart-filters.d.ts +0 -7
  125. package/smart-filters/pepperi-addons-ngx-lib-smart-filters.metadata.json +1 -1
  126. package/smart-filters/public-api.d.ts +0 -1
  127. package/src/assets/i18n/en.ngx-lib.json +1 -2
  128. package/src/core/style/abstracts/mixins.scss +3 -3
  129. package/src/core/style/components/general.scss +2 -4
  130. package/textarea/pepperi-addons-ngx-lib-textarea.metadata.json +1 -1
  131. package/textarea/textarea.component.d.ts +0 -1
  132. package/theming.scss +0 -4
  133. package/esm2015/smart-filters/filter-builder/common/model/filter.js +0 -2
  134. package/esm2015/smart-filters/filter-builder/common/model/legacy.js +0 -2
  135. package/esm2015/smart-filters/filter-builder/common/model/operator-unit.js +0 -42
  136. package/esm2015/smart-filters/filter-builder/common/model/operator.js +0 -207
  137. package/esm2015/smart-filters/filter-builder/common/model/type-map.js +0 -27
  138. package/esm2015/smart-filters/filter-builder/common/model/type.js +0 -6
  139. package/esm2015/smart-filters/filter-builder/common/pipes/filter-item-counter.pipe.js +0 -18
  140. package/esm2015/smart-filters/filter-builder/common/services/output-filter.service.js +0 -132
  141. package/esm2015/smart-filters/filter-builder/common/services/type-convertor.service.js +0 -44
  142. package/esm2015/smart-filters/filter-builder/filter-builder-item/filter-builder-item.component.js +0 -106
  143. package/esm2015/smart-filters/filter-builder/filter-builder-section/filter-builder-section.component.js +0 -50
  144. package/esm2015/smart-filters/filter-builder/filter-builder.component.js +0 -65
  145. package/esm2015/smart-filters/filter-builder/filter-builder.service.js +0 -261
  146. package/esm2015/smart-filters/index.js +0 -5
  147. package/esm2015/smart-filters/text-filter/text-filter.component.js +0 -79
  148. package/smart-filters/filter-builder/common/model/filter.d.ts +0 -6
  149. package/smart-filters/filter-builder/common/model/legacy.d.ts +0 -23
  150. package/smart-filters/filter-builder/common/model/operator-unit.d.ts +0 -13
  151. package/smart-filters/filter-builder/common/model/operator.d.ts +0 -21
  152. package/smart-filters/filter-builder/common/model/type-map.d.ts +0 -12
  153. package/smart-filters/filter-builder/common/model/type.d.ts +0 -4
  154. package/smart-filters/filter-builder/common/pipes/filter-item-counter.pipe.d.ts +0 -5
  155. package/smart-filters/filter-builder/common/services/output-filter.service.d.ts +0 -52
  156. package/smart-filters/filter-builder/common/services/type-convertor.service.d.ts +0 -10
  157. package/smart-filters/filter-builder/filter-builder-item/filter-builder-item.component.d.ts +0 -32
  158. package/smart-filters/filter-builder/filter-builder-section/filter-builder-section.component.d.ts +0 -22
  159. package/smart-filters/filter-builder/filter-builder-section/filter-builder-section.component.theme.scss +0 -6
  160. package/smart-filters/filter-builder/filter-builder.component.d.ts +0 -22
  161. package/smart-filters/filter-builder/filter-builder.service.d.ts +0 -90
  162. package/smart-filters/index.d.ts +0 -1
  163. package/smart-filters/text-filter/text-filter.component.d.ts +0 -17
@@ -1,31 +1,8 @@
1
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('@angular/material/core'), require('@angular/material/checkbox'), require('@angular/material/chips'), require('@angular/material/expansion'), require('@angular/material/icon'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/material/radio'), require('ngx-virtual-scroller'), require('@pepperi-addons/ngx-lib'), require('@pepperi-addons/ngx-lib/checkbox'), require('@pepperi-addons/ngx-lib/date'), require('@pepperi-addons/ngx-lib/select'), require('@pepperi-addons/ngx-lib/textbox'), require('@pepperi-addons/ngx-lib/search'), require('@pepperi-addons/ngx-lib/button'), require('@pepperi-addons/ngx-lib/icon'), require('rxjs/operators'), require('rxjs'), require('@ngx-translate/core')) :
3
- typeof define === 'function' && define.amd ? define('@pepperi-addons/ngx-lib/smart-filters', ['exports', '@angular/core', '@angular/common', '@angular/forms', '@angular/flex-layout', '@angular/material/core', '@angular/material/checkbox', '@angular/material/chips', '@angular/material/expansion', '@angular/material/icon', '@angular/material/form-field', '@angular/material/input', '@angular/material/radio', 'ngx-virtual-scroller', '@pepperi-addons/ngx-lib', '@pepperi-addons/ngx-lib/checkbox', '@pepperi-addons/ngx-lib/date', '@pepperi-addons/ngx-lib/select', '@pepperi-addons/ngx-lib/textbox', '@pepperi-addons/ngx-lib/search', '@pepperi-addons/ngx-lib/button', '@pepperi-addons/ngx-lib/icon', 'rxjs/operators', 'rxjs', '@ngx-translate/core'], 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']['smart-filters'] = {}), global.ng.core, global.ng.common, global.ng.forms, global.ng.flexLayout, global.ng.material.core, global.ng.material.checkbox, global.ng.material.chips, global.ng.material.expansion, global.ng.material.icon, global.ng.material.formField, global.ng.material.input, global.ng.material.radio, global.ngxVirtualScroller, global['pepperi-addons']['ngx-lib'], global['pepperi-addons']['ngx-lib'].checkbox, global['pepperi-addons']['ngx-lib'].date, global['pepperi-addons']['ngx-lib'].select, global['pepperi-addons']['ngx-lib'].textbox, global['pepperi-addons']['ngx-lib'].search, global['pepperi-addons']['ngx-lib'].button, global['pepperi-addons']['ngx-lib'].icon, global.rxjs.operators, global.rxjs, global.translate));
5
- }(this, (function (exports, i0, common, i1, flexLayout, core$1, checkbox, chips, expansion, icon$1, formField, input, radio, ngxVirtualScroller, ngxLib, checkbox$1, date, select, textbox, search, button, icon, operators, rxjs, core) { 'use strict';
6
-
7
- function _interopNamespace(e) {
8
- if (e && e.__esModule) return e;
9
- var n = Object.create(null);
10
- if (e) {
11
- Object.keys(e).forEach(function (k) {
12
- if (k !== 'default') {
13
- var d = Object.getOwnPropertyDescriptor(e, k);
14
- Object.defineProperty(n, k, d.get ? d : {
15
- enumerable: true,
16
- get: function () {
17
- return e[k];
18
- }
19
- });
20
- }
21
- });
22
- }
23
- n['default'] = e;
24
- return Object.freeze(n);
25
- }
26
-
27
- var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
28
- var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('@angular/flex-layout'), require('@angular/material/core'), require('@angular/material/checkbox'), require('@angular/material/chips'), require('@angular/material/expansion'), require('@angular/material/icon'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/material/radio'), require('ngx-virtual-scroller'), require('@pepperi-addons/ngx-lib'), require('@pepperi-addons/ngx-lib/checkbox'), require('@pepperi-addons/ngx-lib/date'), require('@pepperi-addons/ngx-lib/select'), require('@pepperi-addons/ngx-lib/textbox'), require('@pepperi-addons/ngx-lib/search'), require('@pepperi-addons/ngx-lib/icon'), require('rxjs'), require('rxjs/operators'), require('@ngx-translate/core')) :
3
+ typeof define === 'function' && define.amd ? define('@pepperi-addons/ngx-lib/smart-filters', ['exports', '@angular/core', '@angular/common', '@angular/forms', '@angular/flex-layout', '@angular/material/core', '@angular/material/checkbox', '@angular/material/chips', '@angular/material/expansion', '@angular/material/icon', '@angular/material/form-field', '@angular/material/input', '@angular/material/radio', 'ngx-virtual-scroller', '@pepperi-addons/ngx-lib', '@pepperi-addons/ngx-lib/checkbox', '@pepperi-addons/ngx-lib/date', '@pepperi-addons/ngx-lib/select', '@pepperi-addons/ngx-lib/textbox', '@pepperi-addons/ngx-lib/search', '@pepperi-addons/ngx-lib/icon', 'rxjs', 'rxjs/operators', '@ngx-translate/core'], 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']['smart-filters'] = {}), global.ng.core, global.ng.common, global.ng.forms, global.ng.flexLayout, global.ng.material.core, global.ng.material.checkbox, global.ng.material.chips, global.ng.material.expansion, global.ng.material.icon, global.ng.material.formField, global.ng.material.input, global.ng.material.radio, global.ngxVirtualScroller, global['pepperi-addons']['ngx-lib'], global['pepperi-addons']['ngx-lib'].checkbox, global['pepperi-addons']['ngx-lib'].date, global['pepperi-addons']['ngx-lib'].select, global['pepperi-addons']['ngx-lib'].textbox, global['pepperi-addons']['ngx-lib'].search, global['pepperi-addons']['ngx-lib'].icon, global.rxjs, global.rxjs.operators, global.translate));
5
+ }(this, (function (exports, core, common, forms, flexLayout, core$2, checkbox, chips, expansion, icon$1, formField, input, radio, ngxVirtualScroller, ngxLib, checkbox$1, date, select, textbox, search, icon, rxjs, operators, core$1) { 'use strict';
29
6
 
30
7
  /*! *****************************************************************************
31
8
  Copyright (c) Microsoft Corporation.
@@ -350,8 +327,8 @@
350
327
  this._useAsWebComponent = false;
351
328
  // @Output()
352
329
  // filtersClear: EventEmitter<void> = new EventEmitter<void>();
353
- this.filtersChange = new i0.EventEmitter();
354
- this.fieldToggleChange = new i0.EventEmitter();
330
+ this.filtersChange = new core.EventEmitter();
331
+ this.fieldToggleChange = new core.EventEmitter();
355
332
  this.expansionPanelHeaderHeight = '*';
356
333
  }
357
334
  Object.defineProperty(PepSmartFiltersComponent.prototype, "filters", {
@@ -460,30 +437,30 @@
460
437
  return PepSmartFiltersComponent;
461
438
  }());
462
439
  PepSmartFiltersComponent.decorators = [
463
- { type: i0.Component, args: [{
440
+ { type: core.Component, args: [{
464
441
  selector: 'pep-smart-filters',
465
442
  template: "<div class=\"smart-filters-container\" dir=\"{{ layoutService.isRtl() ? 'rtl' : 'ltr' }}\">\n <div class=\"title\">\n <span class=\"body-md bold\">{{ title?.length > 0 ? title : (\"SMART_FILTERS.TITLE\" | translate)}}</span>\n <mat-chip *ngIf=\"filtersDataMap.size > 0\" [selectable]=\"false\" [removable]=\"true\" (click)=\"onFiltersClear()\"\n class=\"clear-filter pep-button chip xs weak\">\n <span class=\"body-xs ellipsis \">\n {{ \"ACTIONS.CLEAR\" | translate}}\n </span>\n </mat-chip>\n </div>\n\n <mat-accordion [displayMode]=\"'flat'\" [multi]=\"true\" class=\"pep-accordion2\">\n <mat-expansion-panel *ngFor=\"let field of fields; let i = index\" hideToggle=\"true\" [expanded]=\"field.isOpen\"\n (opened)=\"toggleField(i, true)\" (closed)=\"toggleField(i, false)\">\n <mat-expansion-panel-header [collapsedHeight]=\"expansionPanelHeaderHeight\"\n [expandedHeight]=\"expansionPanelHeaderHeight\">\n <mat-panel-title class=\"pep-spacing-element-negative\">\n <div class=\"smart-filter-title-container\">\n <mat-icon class=\"pep-spacing-element\">\n <pep-icon [name]=\"field.isOpen ? 'number_minus' : 'number_plus'\"></pep-icon>\n </mat-icon>\n <span class=\"body-sm ellipsis\" [title]=\"field.name\">\n {{ field.name }}\n </span>\n <mat-chip *ngIf=\"filtersDataMap.get(field.id)\" [selectable]=\"false\" [removable]=\"true\"\n (click)=\"onFilterClear(field)\" class=\"clear-filter pep-button chip xs weak\">\n <span *ngIf=\"field.componentType === 'multi-select'\" class=\"body-xs pep-spacing-element\">\n {{ filtersDataMap.get(field.id).value?.first?.length }}\n <!-- {{ field.componentType === 'multi-select' ?\n filtersDataMap.get(field.id).value?.first?.length : 1 }} -->\n </span>\n <mat-icon>\n <pep-icon name=\"system_close\"></pep-icon>\n </mat-icon>\n </mat-chip>\n </div>\n </mat-panel-title>\n </mat-expansion-panel-header>\n <div class=\"expansion-content smart-filter-content\">\n <ng-container [ngSwitch]=\"field.componentType\">\n <ng-container *ngSwitchCase=\"'boolean'\">\n <pep-boolean-filter [field]=\"field\" [filter]=\"filtersDataMap.get(field.id)\"\n (filterChange)=\"onFilterChange(field, $event)\" (filterClear)=\"onFilterClear(field)\">\n </pep-boolean-filter>\n </ng-container>\n <ng-container *ngSwitchCase=\"'date'\">\n <pep-date-filter [field]=\"field\" [filter]=\"filtersDataMap.get(field.id)\"\n (filterChange)=\"onFilterChange(field, $event)\" (filterClear)=\"onFilterClear(field)\">\n </pep-date-filter>\n </ng-container>\n <ng-container *ngSwitchCase=\"'multi-select'\">\n <pep-multi-select-filter [field]=\"field\" [filter]=\"filtersDataMap.get(field.id)\"\n (filterChange)=\"onFilterChange(field, $event)\" (filterClear)=\"onFilterClear(field)\">\n </pep-multi-select-filter>\n </ng-container>\n <ng-container *ngSwitchCase=\"'number'\">\n <pep-number-filter [field]=\"field\" [filter]=\"filtersDataMap.get(field.id)\"\n (filterChange)=\"onFilterChange(field, $event)\" (filterClear)=\"onFilterClear(field)\">\n </pep-number-filter>\n </ng-container>\n <!-- <div *ngSwitchDefault>\n </div> -->\n </ng-container>\n </div>\n </mat-expansion-panel>\n </mat-accordion>\n</div>",
466
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
443
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
467
444
  styles: [".smart-filters-container .title{height:calc(.5rem + 2.5rem);height:calc(var(--pep-top-bar-spacing-bottom, .5rem) + var(--pep-top-bar-field-height, 2.5rem));display:flex;flex-flow:wrap;align-items:center;justify-content:space-between}.smart-filters-container .title .clear-filter{display:flex;flex-direction:row;align-items:center;justify-content:center;margin:0 .25rem;margin:0 var(--pep-spacing-xs,.25rem);padding:0 .75rem;padding:0 var(--pep-spacing-md,.75rem)}.smart-filters-container .title .clear-filter:after{background-color:transparent}.smart-filters-container .smart-filter-title-container{display:grid;grid-auto-flow:column;grid-template-columns:auto 1fr auto;width:100%}.smart-filters-container .smart-filter-title-container>*{align-self:center}.smart-filters-container .smart-filter-title-container .clear-filter{display:flex;flex-direction:row;align-items:center;justify-content:center;-webkit-margin-end:.5rem;margin-inline-end:.5rem;-webkit-margin-end:var(--pep-spacing-sm,.5rem);margin-inline-end:var(--pep-spacing-sm,.5rem)}.smart-filters-container .smart-filter-title-container .clear-filter:after{background-color:transparent}.smart-filters-container .smart-filter-title-container .mat-icon pep-icon{height:.75rem;width:.75rem}"]
468
445
  },] }
469
446
  ];
470
447
  PepSmartFiltersComponent.ctorParameters = function () { return [
471
- { type: i0.ElementRef },
448
+ { type: core.ElementRef },
472
449
  { type: ngxLib.PepLayoutService }
473
450
  ]; };
474
451
  PepSmartFiltersComponent.propDecorators = {
475
- title: [{ type: i0.Input }],
476
- filters: [{ type: i0.Input }],
477
- fields: [{ type: i0.Input }],
478
- useAsWebComponent: [{ type: i0.Input }],
479
- filtersChange: [{ type: i0.Output }],
480
- fieldToggleChange: [{ type: i0.Output }]
452
+ title: [{ type: core.Input }],
453
+ filters: [{ type: core.Input }],
454
+ fields: [{ type: core.Input }],
455
+ useAsWebComponent: [{ type: core.Input }],
456
+ filtersChange: [{ type: core.Output }],
457
+ fieldToggleChange: [{ type: core.Output }]
481
458
  };
482
459
 
483
460
  var PepFilterActionsComponent = /** @class */ (function () {
484
461
  function PepFilterActionsComponent() {
485
- this.clearClick = new i0.EventEmitter();
486
- this.applyClick = new i0.EventEmitter();
462
+ this.clearClick = new core.EventEmitter();
463
+ this.applyClick = new core.EventEmitter();
487
464
  }
488
465
  PepFilterActionsComponent.prototype.clear = function () {
489
466
  this.clearClick.emit();
@@ -494,16 +471,16 @@
494
471
  return PepFilterActionsComponent;
495
472
  }());
496
473
  PepFilterActionsComponent.decorators = [
497
- { type: i0.Component, args: [{
474
+ { type: core.Component, args: [{
498
475
  selector: 'pep-filter-actions',
499
476
  template: "<div [formGroup]=\"form\" class=\"filter-actions pep-spacing-element-negative\">\n <button mat-button class=\"pep-spacing-element pep-button sm weak\" (click)=\"clear()\">\n {{ 'ACTIONS.CLEAR' | translate }}\n </button>\n <button mat-button class=\"pep-spacing-element pep-button sm strong\" (click)=\"apply()\" [disabled]=\"form.invalid\">\n {{ 'ACTIONS.APPLY' | translate }}\n </button>\n</div>",
500
477
  styles: [".filter-actions{margin:1rem 0 calc(1rem / 2);margin:var(--pep-spacing-lg,1rem) 0 calc(var(--pep-spacing-lg, 1rem) / 2);display:flex;justify-content:flex-end}"]
501
478
  },] }
502
479
  ];
503
480
  PepFilterActionsComponent.propDecorators = {
504
- form: [{ type: i0.Input }],
505
- clearClick: [{ type: i0.Output }],
506
- applyClick: [{ type: i0.Output }]
481
+ form: [{ type: core.Input }],
482
+ clearClick: [{ type: core.Output }],
483
+ applyClick: [{ type: core.Output }]
507
484
  };
508
485
 
509
486
  var IPepSmartFilterOperator = /** @class */ (function () {
@@ -511,7 +488,7 @@
511
488
  }
512
489
  return IPepSmartFilterOperator;
513
490
  }());
514
- var Equals$1 = {
491
+ var Equals = {
515
492
  id: 'eq',
516
493
  name: 'EQUAL',
517
494
  short: '=',
@@ -525,7 +502,7 @@
525
502
  // 'select',
526
503
  ],
527
504
  };
528
- var NotEqual$1 = {
505
+ var NotEqual = {
529
506
  id: 'neq',
530
507
  name: 'NOT_EQUAL',
531
508
  short: '<>',
@@ -538,7 +515,7 @@
538
515
  // 'select',
539
516
  ],
540
517
  };
541
- var LessThan$1 = {
518
+ var LessThan = {
542
519
  id: 'lt',
543
520
  name: 'LESS_THEN',
544
521
  short: '<',
@@ -550,7 +527,7 @@
550
527
  // short: '<=',
551
528
  // type: ['number'],
552
529
  // };
553
- var GreaterThan$1 = {
530
+ var GreaterThan = {
554
531
  id: 'gt',
555
532
  name: 'GREATER_THEN',
556
533
  short: '>',
@@ -562,18 +539,18 @@
562
539
  // short: '>=',
563
540
  // type: ['number'],
564
541
  // };
565
- var NumberRange$1 = {
542
+ var NumberRange = {
566
543
  id: 'numberRange',
567
544
  name: 'NUMBER_RANGE',
568
545
  short: 'Range',
569
546
  componentType: ['number'],
570
547
  };
571
- var Contains$1 = {
572
- id: 'contains',
573
- name: 'CONTAINS',
574
- short: 'Contains',
575
- componentType: ['text'],
576
- };
548
+ // const Contains: Operator = {
549
+ // id: 'contains',
550
+ // name: 'Contains',
551
+ // short: 'Contains',
552
+ // type: ['text'],
553
+ // };
577
554
  // const BeginsWith: Operator = {
578
555
  // id: 'beginsWith',
579
556
  // name: 'Begins With',
@@ -598,189 +575,138 @@
598
575
  // short: 'Before',
599
576
  // type: ['date'],
600
577
  // };
601
- var InTheLast$1 = {
578
+ var InTheLast = {
602
579
  id: 'inTheLast',
603
580
  name: 'IN_THE_LAST',
604
581
  short: 'In the last',
605
582
  componentType: ['date'],
606
583
  };
607
- var Today$1 = {
584
+ var Today = {
608
585
  id: 'today',
609
586
  name: 'TODAY',
610
587
  short: 'Today',
611
588
  componentType: ['date'],
612
589
  };
613
- var ThisWeek$1 = {
590
+ var ThisWeek = {
614
591
  id: 'thisWeek',
615
592
  name: 'THIS_WEEK',
616
593
  short: 'This week',
617
594
  componentType: ['date'],
618
595
  };
619
- var ThisMonth$1 = {
596
+ var ThisMonth = {
620
597
  id: 'thisMonth',
621
598
  name: 'THIS_MONTH',
622
599
  short: 'This month',
623
600
  componentType: ['date'],
624
601
  };
625
- var DateRange$1 = {
602
+ var DateRange = {
626
603
  id: 'dateRange',
627
604
  name: 'DATE_RANGE',
628
605
  short: 'Range',
629
606
  componentType: ['date'],
630
607
  };
631
- var DueIn$1 = {
608
+ var DueIn = {
632
609
  id: 'dueIn',
633
610
  name: 'DUE_IN',
634
611
  short: 'Due in',
635
612
  componentType: ['date'],
636
613
  };
637
- var On$1 = {
614
+ var On = {
638
615
  id: 'on',
639
616
  name: 'ON',
640
617
  short: 'On',
641
618
  componentType: ['date'],
642
619
  };
643
- var NotInTheLast$1 = {
620
+ var NotInTheLast = {
644
621
  id: 'notInTheLast',
645
622
  name: 'NOT_IN_THE_LAST',
646
623
  short: 'Not in the last',
647
624
  componentType: ['date'],
648
625
  };
649
- var NotDueIn$1 = {
626
+ var NotDueIn = {
650
627
  id: 'notDueIn',
651
628
  name: 'NOT_DUE_IN',
652
629
  short: 'Not due in',
653
630
  componentType: ['date'],
654
631
  };
655
- var IsEmpty$1 = {
632
+ var IsEmpty = {
656
633
  id: 'isEmpty',
657
634
  name: 'IS_EMPTY',
658
635
  short: 'Is empty',
659
636
  componentType: ['date'],
660
637
  };
661
- var IsNotEmpty$1 = {
638
+ var IsNotEmpty = {
662
639
  id: 'isNotEmpty',
663
640
  name: 'IS_NOT_EMPTY',
664
641
  short: 'Is not empty',
665
642
  componentType: ['date'],
666
643
  };
667
- var In$1 = {
644
+ var In = {
668
645
  id: 'in',
669
646
  name: 'IN',
670
647
  short: 'In',
671
648
  componentType: ['multi-select'],
672
649
  };
673
650
  var PepSmartFilterOperators = {
674
- Equals: Equals$1,
675
- NotEqual: NotEqual$1,
676
- LessThan: LessThan$1,
651
+ Equals: Equals,
652
+ NotEqual: NotEqual,
653
+ LessThan: LessThan,
677
654
  // LessThanOrEquals: LessThanOrEquals,
678
- GreaterThan: GreaterThan$1,
655
+ GreaterThan: GreaterThan,
679
656
  // GreaterThanOrEquals: GreaterThanOrEquals,
680
- NumberRange: NumberRange$1,
681
- Contains: Contains$1,
657
+ NumberRange: NumberRange,
658
+ // Contains: Contains,
682
659
  // BeginsWith: BeginsWith,
683
660
  // EndsWith: EndsWith,
684
661
  // After: After,
685
662
  // Before: Before,
686
- InTheLast: InTheLast$1,
687
- Today: Today$1,
688
- ThisWeek: ThisWeek$1,
689
- ThisMonth: ThisMonth$1,
690
- DateRange: DateRange$1,
691
- DueIn: DueIn$1,
692
- On: On$1,
693
- NotInTheLast: NotInTheLast$1,
694
- NotDueIn: NotDueIn$1,
695
- IsEmpty: IsEmpty$1,
696
- IsNotEmpty: IsNotEmpty$1,
697
- In: In$1,
663
+ InTheLast: InTheLast,
664
+ Today: Today,
665
+ ThisWeek: ThisWeek,
666
+ ThisMonth: ThisMonth,
667
+ DateRange: DateRange,
668
+ DueIn: DueIn,
669
+ On: On,
670
+ NotInTheLast: NotInTheLast,
671
+ NotDueIn: NotDueIn,
672
+ IsEmpty: IsEmpty,
673
+ IsNotEmpty: IsNotEmpty,
674
+ In: In,
698
675
  };
699
676
  var IPepSmartFilterOperatorUnit = /** @class */ (function () {
700
677
  function IPepSmartFilterOperatorUnit() {
701
678
  }
702
679
  return IPepSmartFilterOperatorUnit;
703
680
  }());
704
- var Days$1 = {
681
+ var Days = {
705
682
  id: 'days',
706
683
  name: 'DAYS',
707
684
  componentType: ['date'],
708
685
  };
709
- var Weeks$1 = {
686
+ var Weeks = {
710
687
  id: 'weeks',
711
688
  name: 'WEEKS',
712
689
  componentType: ['date'],
713
690
  };
714
- var Months$1 = {
691
+ var Months = {
715
692
  id: 'months',
716
693
  name: 'MONTHS',
717
694
  componentType: ['date'],
718
695
  };
719
- var Years$1 = {
696
+ var Years = {
720
697
  id: 'years',
721
698
  name: 'YEARS',
722
699
  componentType: ['date'],
723
700
  };
724
701
  var PepSmartFilterOperatorUnits = {
725
- Days: Days$1,
726
- Weeks: Weeks$1,
727
- Months: Months$1,
728
- Years: Years$1,
702
+ Days: Days,
703
+ Weeks: Weeks,
704
+ Months: Months,
705
+ Years: Years,
729
706
  };
730
707
 
731
- var PepTypeConvertorService = /** @class */ (function () {
732
- function PepTypeConvertorService() {
733
- this._operators = [];
734
- this._booleans = [];
735
- this.initOperators();
736
- this.initBooleans();
737
- }
738
- Object.defineProperty(PepTypeConvertorService.prototype, "operators", {
739
- get: function () {
740
- return this._operators;
741
- },
742
- enumerable: false,
743
- configurable: true
744
- });
745
- Object.defineProperty(PepTypeConvertorService.prototype, "booleans", {
746
- get: function () {
747
- return this._booleans;
748
- },
749
- enumerable: false,
750
- configurable: true
751
- });
752
- PepTypeConvertorService.prototype.initOperators = function () {
753
- this._operators.push({
754
- key: 'AND',
755
- value: 'And'
756
- });
757
- this._operators.push({
758
- key: 'OR',
759
- value: 'Or'
760
- });
761
- };
762
- PepTypeConvertorService.prototype.initBooleans = function () {
763
- this._booleans.push({
764
- key: 'True',
765
- value: 'True'
766
- });
767
- this._booleans.push({
768
- key: 'False',
769
- value: 'False'
770
- });
771
- };
772
- return PepTypeConvertorService;
773
- }());
774
- PepTypeConvertorService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function PepTypeConvertorService_Factory() { return new PepTypeConvertorService(); }, token: PepTypeConvertorService, providedIn: "root" });
775
- PepTypeConvertorService.decorators = [
776
- { type: i0.Injectable, args: [{
777
- providedIn: 'root',
778
- },] }
779
- ];
780
- PepTypeConvertorService.ctorParameters = function () { return []; };
781
-
782
708
  var BaseFilterComponent = /** @class */ (function () {
783
- function BaseFilterComponent(viewContainerRef, injector, resolver, builder, translate, validator, renderer, typeConvertorService) {
709
+ function BaseFilterComponent(viewContainerRef, injector, resolver, builder, translate, validator, renderer) {
784
710
  this.viewContainerRef = viewContainerRef;
785
711
  this.injector = injector;
786
712
  this.resolver = resolver;
@@ -788,14 +714,9 @@
788
714
  this.translate = translate;
789
715
  this.validator = validator;
790
716
  this.renderer = renderer;
791
- this.typeConvertorService = typeConvertorService;
792
717
  this._fieldIdWithNoDots = '';
793
- this.emitOnChange = false;
794
- this.inline = false;
795
- this.showActionButtons = true;
796
- this.renderTitle = true;
797
- this.filterClear = new i0.EventEmitter();
798
- this.filterChange = new i0.EventEmitter();
718
+ this.filterClear = new core.EventEmitter();
719
+ this.filterChange = new core.EventEmitter();
799
720
  this.OPERATORS_TRANSLATION_PREFIX = 'SMART_FILTERS.OPERATORS';
800
721
  this.OPERATOR_UNITS_TRANSLATION_PREFIX = 'SMART_FILTERS.OPERATOR_UNITS';
801
722
  this._destroyed = new rxjs.Subject();
@@ -823,14 +744,6 @@
823
744
  enumerable: false,
824
745
  configurable: true
825
746
  });
826
- Object.defineProperty(BaseFilterComponent.prototype, "parentForm", {
827
- set: function (form) {
828
- this._parentForm = form;
829
- this.updateParentForm();
830
- },
831
- enumerable: false,
832
- configurable: true
833
- });
834
747
  Object.defineProperty(BaseFilterComponent.prototype, "operator", {
835
748
  get: function () {
836
749
  return this._operator;
@@ -859,7 +772,10 @@
859
772
  },
860
773
  set: function (operatorUnit) {
861
774
  // Validate operator unit
862
- if (operatorUnit) {
775
+ if (operatorUnit === undefined) {
776
+ this._operatorUnit = undefined;
777
+ }
778
+ else {
863
779
  var index = this.operatorUnits.findIndex(function (ou) { return ou.id === operatorUnit.id; });
864
780
  if (index >= 0) {
865
781
  this._operatorUnit = this.operatorUnits[index];
@@ -868,9 +784,6 @@
868
784
  this._operatorUnit = this.operatorUnits[0];
869
785
  }
870
786
  }
871
- else {
872
- this._operatorUnit = undefined;
873
- }
874
787
  },
875
788
  enumerable: false,
876
789
  configurable: true
@@ -916,14 +829,12 @@
916
829
  var formValue = {};
917
830
  formValue[this.firstControlKey] = [];
918
831
  formValue[this.secondControlKey] = [];
919
- // this.form.patchValue(formValue);
832
+ // this.form.patchValue(formValue);
920
833
  this.form = this.builder.group(formValue);
921
834
  // this.form[this.firstControlKey] = [];
922
835
  // this.form[this.secondControlKey] = [];
923
836
  this.setupOperators();
924
- if (this.showActionButtons) {
925
- this.createActionsComponent();
926
- }
837
+ this.createActionsComponent();
927
838
  };
928
839
  BaseFilterComponent.prototype.setupOperators = function () {
929
840
  var _this = this;
@@ -968,16 +879,6 @@
968
879
  this.clearFilter(false);
969
880
  }
970
881
  };
971
- BaseFilterComponent.prototype.updateParentForm = function () {
972
- this._parentForm.setControl('fieldId', this.builder.control(this.field.id));
973
- this._parentForm.setControl('fieldType', this.builder.control(this.field.type));
974
- this._parentForm.setControl('operator', this.builder.control(this.operator));
975
- this._parentForm.setControl('operatorUnit', this.builder.control(this.operatorUnit));
976
- this._parentForm.setControl('values', this.builder.group({
977
- first: this.firstControl,
978
- second: this.secondControl
979
- }));
980
- };
981
882
  BaseFilterComponent.prototype.getDestroyer = function () {
982
883
  return operators.takeUntil(this._destroyed);
983
884
  };
@@ -992,8 +893,8 @@
992
893
  };
993
894
  // Set default validators - some childs override this.
994
895
  BaseFilterComponent.prototype.setFieldsStateAndValidators = function () {
995
- this.firstControl.setValidators(i1.Validators.required);
996
- this.secondControl.setValidators(i1.Validators.required);
896
+ this.firstControl.setValidators(forms.Validators.required);
897
+ this.secondControl.setValidators(forms.Validators.required);
997
898
  this.secondControl.disable();
998
899
  };
999
900
  // Return undefined - some childs override this.
@@ -1042,123 +943,34 @@
1042
943
  BaseFilterComponent.prototype.ngOnDestroy = function () {
1043
944
  this._destroyed.next();
1044
945
  this._destroyed.complete();
1045
- if (this.showActionButtons) {
1046
- this.actionsContainerRef.destroy();
1047
- }
946
+ this.actionsContainerRef.destroy();
1048
947
  };
1049
948
  return BaseFilterComponent;
1050
949
  }());
1051
950
  BaseFilterComponent.decorators = [
1052
- { type: i0.Directive, args: [{},] }
951
+ { type: core.Directive, args: [{},] }
1053
952
  ];
1054
953
  BaseFilterComponent.ctorParameters = function () { return [
1055
- { type: i0.ViewContainerRef },
1056
- { type: i0.Injector },
1057
- { type: i0.ComponentFactoryResolver },
1058
- { type: i1.FormBuilder },
1059
- { type: core.TranslateService },
954
+ { type: core.ViewContainerRef },
955
+ { type: core.Injector },
956
+ { type: core.ComponentFactoryResolver },
957
+ { type: forms.FormBuilder },
958
+ { type: core$1.TranslateService },
1060
959
  { type: ngxLib.PepValidatorService },
1061
- { type: i0.Renderer2 },
1062
- { type: PepTypeConvertorService }
960
+ { type: core.Renderer2 }
1063
961
  ]; };
1064
962
  BaseFilterComponent.propDecorators = {
1065
- field: [{ type: i0.Input }],
1066
- filter: [{ type: i0.Input }],
1067
- parentForm: [{ type: i0.Input }],
1068
- emitOnChange: [{ type: i0.Input }],
1069
- inline: [{ type: i0.Input }],
1070
- showActionButtons: [{ type: i0.Input }],
1071
- renderTitle: [{ type: i0.Input }],
1072
- filterClear: [{ type: i0.Output }],
1073
- filterChange: [{ type: i0.Output }]
963
+ field: [{ type: core.Input }],
964
+ filter: [{ type: core.Input }],
965
+ filterClear: [{ type: core.Output }],
966
+ filterChange: [{ type: core.Output }]
1074
967
  };
1075
968
 
1076
- var PepTextFilterComponent = /** @class */ (function (_super) {
1077
- __extends(PepTextFilterComponent, _super);
1078
- function PepTextFilterComponent() {
1079
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
1080
- _this.chooseTypeOptions = [];
1081
- _this.operatorWidth = '38%';
1082
- _this.firstControlWidth = '62%';
1083
- return _this;
1084
- }
1085
- PepTextFilterComponent.prototype.ngOnInit = function () {
1086
- var _this = this;
1087
- this.firstControl.valueChanges
1088
- .pipe(this.getDestroyer(), operators.distinctUntilChanged())
1089
- .subscribe(function () {
1090
- _this.setFieldsStateAndValidators();
1091
- });
1092
- };
1093
- // Override
1094
- PepTextFilterComponent.prototype.getDefaultOperator = function () {
1095
- return PepSmartFilterOperators.Equals;
1096
- };
1097
- // Override
1098
- PepTextFilterComponent.prototype.getFilterValue = function () {
1099
- var filterValue = {
1100
- first: this.firstControl.value,
1101
- };
1102
- if (this.operator === PepSmartFilterOperators.NumberRange) {
1103
- filterValue['second'] = this.secondControl.value;
1104
- }
1105
- return filterValue;
1106
- };
1107
- // Override
1108
- PepTextFilterComponent.prototype.loadOperatorsOptions = function () {
1109
- var _this = this;
1110
- this.chooseTypeOptions = this.operators.map(function (operator) {
1111
- return {
1112
- key: operator.id,
1113
- value: _this.translate.instant(_this.OPERATORS_TRANSLATION_PREFIX + "." + operator.name),
1114
- };
1115
- });
1116
- };
1117
- // Override
1118
- PepTextFilterComponent.prototype.setFieldsStateAndValidators = function () {
1119
- if (this.operator === PepSmartFilterOperators.NumberRange) {
1120
- var firstValidators = [i1.Validators.required];
1121
- if (this.secondControl.value) {
1122
- firstValidators.push(this.validator.isLessThan(this.secondControl));
1123
- }
1124
- this.firstControl.setValidators(firstValidators);
1125
- }
1126
- else {
1127
- _super.prototype.setFieldsStateAndValidators.call(this);
1128
- }
1129
- };
1130
- PepTextFilterComponent.prototype.onOperatorChanged = function (value) {
1131
- var operator = Object.values(PepSmartFilterOperators).find(function (operator) { return operator.id === value; });
1132
- this.operator = operator;
1133
- if (this._parentForm) {
1134
- this.updateParentForm();
1135
- }
1136
- if (this.emitOnChange) {
1137
- this.applyFilter();
1138
- }
1139
- };
1140
- PepTextFilterComponent.prototype.onValueChanged = function () {
1141
- if (this.emitOnChange) {
1142
- this.applyFilter();
1143
- }
1144
- };
1145
- return PepTextFilterComponent;
1146
- }(BaseFilterComponent));
1147
- PepTextFilterComponent.decorators = [
1148
- { type: i0.Component, args: [{
1149
- selector: 'pep-text-filter',
1150
- template: "<div [formGroup]=\"form\" [fxLayout]=\"inline ? 'row' : 'column'\" [fxLayoutGap]=\"inline ? '.5rem' : '0rem'\">\n <pep-select [fxFlex]=\"inline ? operatorWidth : null\" [key]=\"'typeOperator'\" [value]=\"operator.id\"\n [label]=\"'SMART_FILTERS.TYPE' | translate\" [renderTitle]=\"renderTitle\" [emptyOption]=\"false\"\n [options]=\"chooseTypeOptions\" (valueChange)=\"onOperatorChanged($event)\">\n </pep-select>\n <pep-textbox [fxFlex]=\"inline ? firstControlWidth : null\" [form]=\"form\" [key]=\"firstControlKey\"\n [label]=\"'SMART_FILTERS.AMOUNT' | translate\" [renderError]=\"false\" [renderTitle]=\"renderTitle\"\n [type]=\"field.type\" [formattedValue]=\"firstControl?.value || ''\" [value]=\"firstControl?.value || ''\"\n (valueChange)=\"onValueChanged()\">\n </pep-textbox>\n</div>",
1151
- styles: [""]
1152
- },] }
1153
- ];
1154
-
1155
969
  var PepBooleanFilterComponent = /** @class */ (function (_super) {
1156
970
  __extends(PepBooleanFilterComponent, _super);
1157
971
  function PepBooleanFilterComponent() {
1158
972
  return _super !== null && _super.apply(this, arguments) || this;
1159
973
  }
1160
- PepBooleanFilterComponent.prototype.ngOnInit = function () {
1161
- };
1162
974
  // Override
1163
975
  PepBooleanFilterComponent.prototype.getDefaultOperator = function () {
1164
976
  return PepSmartFilterOperators.Equals;
@@ -1168,20 +980,12 @@
1168
980
  var filterValue = { first: this.firstControl.value || false };
1169
981
  return filterValue;
1170
982
  };
1171
- PepBooleanFilterComponent.prototype.onRadioChanged = function () {
1172
- };
1173
- PepBooleanFilterComponent.prototype.onValueChanged = function (value) {
1174
- this.firstControl.setValue(value);
1175
- if (this.emitOnChange) {
1176
- this.applyFilter();
1177
- }
1178
- };
1179
983
  return PepBooleanFilterComponent;
1180
984
  }(BaseFilterComponent));
1181
985
  PepBooleanFilterComponent.decorators = [
1182
- { type: i0.Component, args: [{
986
+ { type: core.Component, args: [{
1183
987
  selector: 'pep-boolean-filter',
1184
- template: "<ng-container *ngIf=\"inline\">\n <pep-select [value]=\"firstControl?.value || ''\" xAlignment=\"left\" [options]=\"typeConvertorService.booleans\"\n [renderTitle]=\"renderTitle\" [emptyOption]=\"true\" (valueChange)=\"onValueChanged($event)\">\n </pep-select>\n\n</ng-container>\n\n<div *ngIf=\"!inline\" [formGroup]=\"form\">\n <mat-radio-group class=\"radio-group\" [formControlName]=\"firstControlKey\" (change)=\"onRadioChanged()\">\n <mat-radio-button class=\"pep-radio-button md pep-input no-default-background\" value=\"true\">\n {{ 'CHECKBOX.TRUE' | translate }}\n </mat-radio-button>\n <mat-radio-button class=\"pep-radio-button md pep-input no-default-background\" value=\"false\">\n {{ 'CHECKBOX.FALSE' | translate }}\n </mat-radio-button>\n </mat-radio-group>\n</div>",
988
+ template: "<div [formGroup]=\"form\">\n <mat-radio-group class=\"radio-group\" [formControlName]=\"firstControlKey\">\n <mat-radio-button class=\"pep-radio-button md pep-input no-default-background\" value=\"true\">\n {{ 'CHECKBOX.TRUE' | translate }}\n </mat-radio-button>\n <mat-radio-button class=\"pep-radio-button md pep-input no-default-background\" value=\"false\">\n {{ 'CHECKBOX.FALSE' | translate }}\n </mat-radio-button>\n </mat-radio-group>\n</div>",
1185
989
  styles: [".radio-group{display:flex;flex-direction:column}.radio-group .pep-radio-button.pep-input{height:2.25rem;display:flex}"]
1186
990
  },] }
1187
991
  ];
@@ -1195,11 +999,6 @@
1195
999
  _this.chooseTimeUnitOptions = [];
1196
1000
  return _this;
1197
1001
  }
1198
- PepDateFilterComponent.prototype.ngOnInit = function () {
1199
- if (this.inline) {
1200
- this.setControlsWidth();
1201
- }
1202
- };
1203
1002
  // Override
1204
1003
  PepDateFilterComponent.prototype.getDefaultOperator = function () {
1205
1004
  return PepSmartFilterOperators.InTheLast;
@@ -1246,16 +1045,16 @@
1246
1045
  PepDateFilterComponent.prototype.setFieldsStateAndValidators = function () {
1247
1046
  this.firstControl.enable();
1248
1047
  if (this.operator === PepSmartFilterOperators.DateRange) {
1249
- this.firstControl.setValidators(i1.Validators.required);
1048
+ this.firstControl.setValidators(forms.Validators.required);
1250
1049
  this.secondControl.enable();
1251
- this.secondControl.setValidators(i1.Validators.required);
1050
+ this.secondControl.setValidators(forms.Validators.required);
1252
1051
  }
1253
1052
  else if (this.operator === PepSmartFilterOperators.InTheLast ||
1254
1053
  this.operator === PepSmartFilterOperators.NotInTheLast ||
1255
1054
  this.operator === PepSmartFilterOperators.DueIn ||
1256
1055
  this.operator === PepSmartFilterOperators.NotDueIn) {
1257
1056
  this.firstControl.setValidators([
1258
- i1.Validators.required,
1057
+ forms.Validators.required,
1259
1058
  this.validator.numberValidator(),
1260
1059
  ]);
1261
1060
  this.secondControl.disable();
@@ -1273,59 +1072,21 @@
1273
1072
  _super.prototype.setFieldsStateAndValidators.call(this);
1274
1073
  }
1275
1074
  };
1276
- PepDateFilterComponent.prototype.setControlsWidth = function () {
1277
- if (this.operator === PepSmartFilterOperators.Today ||
1278
- this.operator === PepSmartFilterOperators.ThisWeek ||
1279
- this.operator === PepSmartFilterOperators.ThisMonth ||
1280
- this.operator === PepSmartFilterOperators.IsEmpty ||
1281
- this.operator === PepSmartFilterOperators.IsNotEmpty) {
1282
- this.operatorWidth = 'auto';
1283
- this.fieldsWidth = '0%';
1284
- }
1285
- else if (this.operator === PepSmartFilterOperators.On) {
1286
- this.operatorWidth = '38%';
1287
- this.fieldsWidth = '62%';
1288
- }
1289
- else {
1290
- this.operatorWidth = '30%';
1291
- this.fieldsWidth = '70%';
1292
- }
1293
- };
1294
1075
  PepDateFilterComponent.prototype.onOperatorChanged = function (value) {
1295
1076
  var operator = Object.values(PepSmartFilterOperators).find(function (operator) { return operator.id === value; });
1296
1077
  this.operator = operator;
1297
1078
  this.operatorUnit = this.getDefaultOperatorUnit();
1298
- if (this.inline) {
1299
- this.setControlsWidth();
1300
- }
1301
- if (this._parentForm) {
1302
- this.updateParentForm();
1303
- }
1304
- if (this.emitOnChange) {
1305
- this.applyFilter();
1306
- }
1307
1079
  };
1308
1080
  PepDateFilterComponent.prototype.onTimeUnitChanged = function (value) {
1309
1081
  var operatorUnit = Object.values(PepSmartFilterOperatorUnits).find(function (operatorUnit) { return operatorUnit.id === value; });
1310
1082
  this.operatorUnit = operatorUnit;
1311
- if (this._parentForm) {
1312
- this.updateParentForm();
1313
- }
1314
- if (this.emitOnChange) {
1315
- this.applyFilter();
1316
- }
1317
- };
1318
- PepDateFilterComponent.prototype.onDateValueChanged = function () {
1319
- if (this.emitOnChange) {
1320
- this.applyFilter();
1321
- }
1322
1083
  };
1323
1084
  return PepDateFilterComponent;
1324
1085
  }(BaseFilterComponent));
1325
1086
  PepDateFilterComponent.decorators = [
1326
- { type: i0.Component, args: [{
1087
+ { type: core.Component, args: [{
1327
1088
  selector: 'pep-date-filter',
1328
- template: "<div [formGroup]=\"form\" [fxLayout]=\"inline ? 'row' : 'column'\" [fxLayoutGap]=\"inline ? '.5rem' : '0rem'\">\n <ng-container>\n <pep-select [key]=\"'timeOperator'\" [value]=\"operator.id\" [label]=\"'SMART_FILTERS.CHOOSE_TIME' | translate\"\n [renderTitle]=\"renderTitle\" [emptyOption]=\"false\" [options]=\"chooseTimeOptions\"\n [fxFlex]=\"inline ? operatorWidth : null\" (valueChange)=\"onOperatorChanged($event)\">\n </pep-select>\n </ng-container>\n <div *ngIf=\"operator === PepSmartFilterOperators.InTheLast ||\n operator === PepSmartFilterOperators.NotInTheLast ||\n operator === PepSmartFilterOperators.DueIn ||\n operator === PepSmartFilterOperators.NotDueIn\" fxLayout=\"row\" fxLayout.xs=\"column\"\n [fxLayoutGap]=\"inline ? '.5rem' : '1rem'\" [fxFlex]=\"inline ? fieldsWidth : null\">\n <!-- Amount -->\n <pep-textbox [form]=\"form\" [key]=\"firstControlKey\" [label]=\"'SMART_FILTERS.AMOUNT' | translate\"\n [renderError]=\"false\" [renderTitle]=\"renderTitle\" fxFlex=\"50%\" [type]=\"'int'\"\n [formattedValue]=\"firstControl?.value || ''\" [value]=\"firstControl?.value || ''\"\n (valueChange)=\"onDateValueChanged()\">\n </pep-textbox>\n <!-- Time unit -->\n <pep-select [form]=\"form\" [key]=\"'timeUnit'\" [value]=\"operatorUnit?.id\"\n [label]=\"'SMART_FILTERS.TIME_UNIT' | translate\" [renderTitle]=\"renderTitle\" fxFlex=\"50%\"\n [emptyOption]=\"false\" [options]=\"chooseTimeUnitOptions\" (valueChange)=\"onTimeUnitChanged($event)\">\n </pep-select>\n </div>\n <div pepRtlDirection *ngIf=\"operator === PepSmartFilterOperators.DateRange\" fxLayout=\"row\" fxLayout.xs=\"column\"\n [fxLayoutGap]=\"inline ? '.5rem' : '1rem'\" [fxFlex]=\"inline ? fieldsWidth : null\">\n <!-- Start date -->\n <pep-date [form]=\"form\" [key]=\"firstControlKey\" [label]=\"'SMART_FILTERS.START_DATE' | translate\"\n [renderError]=\"false\" [renderTitle]=\"renderTitle\" fxFlex=\"50%\"\n [type]=\"field.type === 'date' ? 'date' : 'datetime'\" [value]=\"firstControl?.value || ''\"\n [maxDateValue]=\"secondControl?.value\" (valueChange)=\"onDateValueChanged()\">\n </pep-date>\n <!-- End date -->\n <pep-date [form]=\"form\" [key]=\"secondControlKey\" [label]=\"'SMART_FILTERS.END_DATE' | translate\"\n [renderError]=\"false\" [renderTitle]=\"renderTitle\" fxFlex=\"50%\"\n [type]=\"field.type === 'date' ? 'date' : 'datetime'\" [value]=\"secondControl?.value || ''\"\n [minDateValue]=\"firstControl?.value\" (valueChange)=\"onDateValueChanged()\">\n </pep-date>\n </div>\n <ng-container *ngIf=\"operator === PepSmartFilterOperators.On\">\n <!-- Choose a date -->\n <pep-date [form]=\"form\" [key]=\"firstControlKey\" [label]=\"'SMART_FILTERS.CHOOSE_DATE' | translate\"\n [renderError]=\"false\" [renderTitle]=\"renderTitle\" [type]=\"field.type === 'date' ? 'date' : 'datetime'\"\n [fxFlex]=\"inline ? fieldsWidth : null\" [value]=\"firstControl?.value || ''\"\n (valueChange)=\"onDateValueChanged()\">\n </pep-date>\n </ng-container>\n</div>",
1089
+ template: "<div [formGroup]=\"form\">\n <ng-container>\n <pep-select [key]=\"'timeOperator'\" [value]=\"operator.id\" [label]=\"'SMART_FILTERS.CHOOSE_TIME' | translate\"\n [emptyOption]=\"false\" [options]=\"chooseTimeOptions\" (valueChange)=\"onOperatorChanged($event)\">\n </pep-select>\n </ng-container>\n\n <div *ngIf=\"operator === PepSmartFilterOperators.InTheLast ||\n operator === PepSmartFilterOperators.NotInTheLast ||\n operator === PepSmartFilterOperators.DueIn ||\n operator === PepSmartFilterOperators.NotDueIn\" fxLayout=\"row\" fxLayout.xs=\"column\" fxLayoutGap=\"1rem\">\n <!-- Amount -->\n <pep-textbox [form]=\"form\" [key]=\"firstControlKey\" [label]=\"'SMART_FILTERS.AMOUNT' | translate\"\n [renderError]=\"false\" fxFlex=\"50%\" [type]=\"'int'\" [formattedValue]=\"firstControl.value\"\n [value]=\"firstControl.value\">\n </pep-textbox>\n <!-- Time unit -->\n <pep-select [form]=\"form\" [key]=\"'timeUnit'\" [value]=\"operatorUnit?.id\"\n [label]=\"'SMART_FILTERS.TIME_UNIT' | translate\" fxFlex=\"50%\" [emptyOption]=\"false\"\n [options]=\"chooseTimeUnitOptions\" (valueChange)=\"onTimeUnitChanged($event)\">\n </pep-select>\n </div>\n <div pepRtlDirection *ngIf=\"operator === PepSmartFilterOperators.DateRange\" fxLayout=\"row\" fxLayout.xs=\"column\"\n fxLayoutGap=\"1rem\">\n <!-- Start date -->\n <pep-date [form]=\"form\" [key]=\"firstControlKey\" [label]=\"'SMART_FILTERS.START_DATE' | translate\"\n [renderError]=\"false\" fxFlex=\"50%\" [type]=\"field.type === 'date' ? 'date' : 'datetime'\"\n [value]=\"firstControl.value\" [maxDateValue]=\"secondControl.value\">\n </pep-date>\n <!-- End date -->\n <pep-date [form]=\"form\" [key]=\"secondControlKey\" [label]=\"'SMART_FILTERS.END_DATE' | translate\"\n [renderError]=\"false\" fxFlex=\"50%\" [type]=\"field.type === 'date' ? 'date' : 'datetime'\"\n [value]=\"secondControl.value\" [minDateValue]=\"firstControl.value\">\n </pep-date>\n </div>\n <ng-container *ngIf=\"operator === PepSmartFilterOperators.On\">\n <!-- Choose a date -->\n <pep-date [form]=\"form\" [key]=\"firstControlKey\" [label]=\"'SMART_FILTERS.CHOOSE_DATE' | translate\"\n [renderError]=\"false\" [type]=\"field.type === 'date' ? 'date' : 'datetime'\" [value]=\"firstControl.value\">\n </pep-date>\n </ng-container>\n</div>",
1329
1090
  styles: [""]
1330
1091
  },] }
1331
1092
  ];
@@ -1341,39 +1102,15 @@
1341
1102
  function PepMultiSelectFilterComponent() {
1342
1103
  var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
1343
1104
  _this.options = [];
1344
- _this.searchControl = new i1.FormControl();
1345
- //inline props
1346
- _this.selected = '';
1347
- _this.inlineOptions = [];
1105
+ _this.searchControl = new forms.FormControl();
1348
1106
  _this.MAX_OPTIONS_TO_SHOW = 6.35;
1349
1107
  _this.numberOptionsToShowSearch = 10;
1350
1108
  return _this;
1351
1109
  }
1352
1110
  PepMultiSelectFilterComponent.prototype.ngOnInit = function () {
1353
- _super.prototype.ngOnInit;
1354
- if (this.inline) {
1355
- this.inlineControlInit();
1356
- }
1357
- else {
1358
- this.noneInlineControlInit();
1359
- }
1360
- };
1361
- PepMultiSelectFilterComponent.prototype.ngAfterViewInit = function () {
1362
- // Calc for the first time.
1363
- this.calcOptionsHeight(this.options.length);
1364
- };
1365
- PepMultiSelectFilterComponent.prototype.inlineControlInit = function () {
1366
- var _a, _b, _c, _d;
1367
- //load options from field
1368
- this.inlineOptions = ((_b = (_a = this.field) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.length) > 0 ? this.field.options : [];
1369
- // Init the selected values from first value.
1370
- if (((_d = (_c = this.firstControl) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.length) > 0) {
1371
- this.selected = this.firstControl.value.join(';');
1372
- }
1373
- };
1374
- PepMultiSelectFilterComponent.prototype.noneInlineControlInit = function () {
1375
1111
  var _this = this;
1376
1112
  var _a;
1113
+ _super.prototype.ngOnInit;
1377
1114
  if (((_a = this.field.options) === null || _a === void 0 ? void 0 : _a.length) > 0) {
1378
1115
  this.options = this.field.options.map(function (opt) {
1379
1116
  return { value: opt.value, count: opt.count, selected: false };
@@ -1404,6 +1141,10 @@
1404
1141
  }, 125);
1405
1142
  });
1406
1143
  };
1144
+ PepMultiSelectFilterComponent.prototype.ngAfterViewInit = function () {
1145
+ // Calc for the first time.
1146
+ this.calcOptionsHeight(this.options.length);
1147
+ };
1407
1148
  PepMultiSelectFilterComponent.prototype.initOptionsSelectedValues = function (selectedValues) {
1408
1149
  this.options.forEach(function (opt) {
1409
1150
  var isValueSelected = selectedValues && selectedValues.includes(opt.value);
@@ -1431,20 +1172,13 @@
1431
1172
  };
1432
1173
  // Override
1433
1174
  PepMultiSelectFilterComponent.prototype.getFilterValue = function () {
1434
- if (this.inline) {
1435
- return {
1436
- first: this.firstControl.value
1437
- };
1438
- }
1439
- else {
1440
- var selectedValues = this.options
1441
- .filter(function (opt) { return opt.selected; })
1442
- .map(function (opt) { return opt.value; });
1443
- var filterValue = {
1444
- first: selectedValues,
1445
- };
1446
- return selectedValues.length > 0 ? filterValue : null;
1447
- }
1175
+ var selectedValues = this.options
1176
+ .filter(function (opt) { return opt.selected; })
1177
+ .map(function (opt) { return opt.value; });
1178
+ var filterValue = {
1179
+ first: selectedValues,
1180
+ };
1181
+ return selectedValues.length > 0 ? filterValue : null;
1448
1182
  };
1449
1183
  // Override
1450
1184
  PepMultiSelectFilterComponent.prototype.initFilter = function () {
@@ -1455,30 +1189,18 @@
1455
1189
  option.selected = event.checked;
1456
1190
  this.firstControl.setValue(this.options.filter(function (opt) { return opt.selected; }).map(function (opt) { return opt.value; }), { emitEvent: false });
1457
1191
  };
1458
- PepMultiSelectFilterComponent.prototype.onMultiSelectChanged = function (value) {
1459
- if (value) {
1460
- var selected = value.split(';');
1461
- this.firstControl.setValue(selected);
1462
- }
1463
- else {
1464
- this.firstControl.setValue(null);
1465
- }
1466
- if (this.emitOnChange) {
1467
- this.applyFilter();
1468
- }
1469
- };
1470
1192
  return PepMultiSelectFilterComponent;
1471
1193
  }(BaseFilterComponent));
1472
1194
  PepMultiSelectFilterComponent.decorators = [
1473
- { type: i0.Component, args: [{
1195
+ { type: core.Component, args: [{
1474
1196
  selector: 'pep-multi-select-filter',
1475
- template: "<ng-container *ngIf=\"inline\">\n <pep-select [key]=\"'multi1'\" [label]=\"'Pepperi Multi Select'\" [type]=\"'multi'\" [value]=\"selected\"\n [xAlignment]=\"'left'\" [renderTitle]=\"renderTitle\" [options]='inlineOptions'\n (valueChange)=\"onMultiSelectChanged($event)\">\n </pep-select>\n</ng-container>\n<div *ngIf=\"!inline\" [formGroup]=\"form\">\n <pep-search *ngIf=\"options?.length > numberOptionsToShowSearch\" [searchControl]=\"searchControl\"\n [triggerOn]=\"'keydown'\" [shrinkInSmallScreen]=\"false\"></pep-search>\n <div pepRtlClass class=\"multi-select-options pep-border-top pep-border-bottom\"\n [ngClass]=\"{'with-no-search': options?.length <= numberOptionsToShowSearch}\">\n <div #optionsContainer class=\"flip-scroll\" pepRtlClass>\n <virtual-scroller #scroll [items]=\"filteredOptions$ | async\" [parentScroll]=\"optionsContainer\">\n <mat-checkbox *ngFor=\"let opt of scroll.viewPortItems\"\n class=\"pep-checkbox-container pep-input no-default-background md\" [title]=\"opt.value\"\n [checked]=\"opt.selected\" (change)=\"onOptionChange(opt, $event)\">\n <div class=\"title\">\n <span class=\"body-sm ellipsis\">{{ opt.value }}</span>\n <span *ngIf=\"opt.count\" class=\"color-dimmed body-xs ellipsis\">({{opt.count}})</span>\n </div>\n </mat-checkbox>\n <ng-container *ngIf=\"scroll.viewPortItems?.length === 0\">\n <span class=\"no-options body-sm ellipsis\" [title]=\"field.name\">\n {{ ( options.length > 0 ? \"SMART_FILTERS.NO_SEARCH_RESULTS\" : \"SMART_FILTERS.NO_OPTIONS\") |\n translate }}\n </span>\n </ng-container>\n </virtual-scroller>\n </div>\n </div>\n</div>",
1197
+ template: "<div [formGroup]=\"form\">\n <pep-search *ngIf=\"options?.length > numberOptionsToShowSearch\" [searchControl]=\"searchControl\"\n [triggerOn]=\"'keydown'\" [shrinkInSmallScreen]=\"false\"></pep-search>\n <div pepRtlClass class=\"multi-select-options pep-border-top pep-border-bottom\"\n [ngClass]=\"{'with-no-search': options?.length <= numberOptionsToShowSearch}\">\n <div #optionsContainer class=\"flip-scroll\" pepRtlClass>\n <virtual-scroller #scroll [items]=\"filteredOptions$ | async\" [parentScroll]=\"optionsContainer\">\n <mat-checkbox *ngFor=\"let opt of scroll.viewPortItems\"\n class=\"pep-checkbox-container pep-input no-default-background md\" [title]=\"opt.value\"\n [checked]=\"opt.selected\" (change)=\"onOptionChange(opt, $event)\">\n <div class=\"title\">\n <span class=\"body-sm ellipsis\">{{ opt.value }}</span>\n <span *ngIf=\"opt.count\" class=\"color-dimmed body-xs ellipsis\">({{opt.count}})</span>\n </div>\n </mat-checkbox>\n <ng-container *ngIf=\"scroll.viewPortItems?.length === 0\">\n <span class=\"no-options body-sm ellipsis\" [title]=\"field.name\">\n {{ ( options.length > 0 ? \"SMART_FILTERS.NO_SEARCH_RESULTS\" : \"SMART_FILTERS.NO_OPTIONS\") |\n translate }}\n </span>\n </ng-container>\n </virtual-scroller>\n </div>\n </div>\n</div>",
1476
1198
  styles: [".multi-select-options{margin:.5rem calc(.25rem * -1) 0;margin:var(--pep-spacing-sm,.5rem) calc(var(--pep-spacing-xs, .25rem) * -1) 0}.multi-select-options.with-no-search{margin:calc(.5rem * -1) calc(.25rem * -1) 0;margin:calc(var(--pep-spacing-sm, .5rem) * -1) calc(var(--pep-spacing-xs, .25rem) * -1) 0}.multi-select-options .no-options{display:flex;padding:.5rem .75rem;padding:var(--pep-spacing-sm,.5rem) var(--pep-spacing-md,.75rem)}.multi-select-options .flip-scroll{padding:.5rem .25rem;padding:var(--pep-spacing-sm,.5rem) var(--pep-spacing-xs,.25rem);min-height:3.25rem;max-height:34.75rem;direction:rtl}.multi-select-options .flip-scroll.rtl,.multi-select-options .flip-scroll virtual-scroller{direction:ltr}.multi-select-options .flip-scroll.rtl virtual-scroller{direction:rtl}.multi-select-options .pep-checkbox-container{height:2.25rem;-webkit-padding-end:0;padding-inline-end:0}.multi-select-options .pep-checkbox-container ::ng-deep.mat-checkbox-layout{width:100%;height:100%;grid-template-columns:auto 1fr}.multi-select-options .pep-checkbox-container ::ng-deep.mat-checkbox-layout .mat-checkbox-label{align-self:center}.multi-select-options .pep-checkbox-container .title{display:flex;justify-content:space-between;align-items:center;margin:0 .25rem;margin:0 var(--pep-spacing-xs,.25rem)}"]
1477
1199
  },] }
1478
1200
  ];
1479
1201
  PepMultiSelectFilterComponent.propDecorators = {
1480
- optionsContainer: [{ type: i0.ViewChild, args: ['optionsContainer',] }],
1481
- virtualScroller: [{ type: i0.ViewChild, args: [ngxVirtualScroller.VirtualScrollerComponent,] }]
1202
+ optionsContainer: [{ type: core.ViewChild, args: ['optionsContainer',] }],
1203
+ virtualScroller: [{ type: core.ViewChild, args: [ngxVirtualScroller.VirtualScrollerComponent,] }]
1482
1204
  };
1483
1205
 
1484
1206
  var PepNumberFilterComponent = /** @class */ (function (_super) {
@@ -1487,8 +1209,6 @@
1487
1209
  var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
1488
1210
  _this.PepSmartFilterOperators = PepSmartFilterOperators;
1489
1211
  _this.chooseTypeOptions = [];
1490
- _this.operatorWidth = '38%';
1491
- _this.firstControlWidth = '62%';
1492
1212
  return _this;
1493
1213
  }
1494
1214
  PepNumberFilterComponent.prototype.ngOnInit = function () {
@@ -1503,7 +1223,6 @@
1503
1223
  .subscribe(function () {
1504
1224
  _this.setFieldsStateAndValidators();
1505
1225
  });
1506
- this.setControlsWidth();
1507
1226
  };
1508
1227
  // Override
1509
1228
  PepNumberFilterComponent.prototype.getDefaultOperator = function () {
@@ -1532,13 +1251,13 @@
1532
1251
  // Override
1533
1252
  PepNumberFilterComponent.prototype.setFieldsStateAndValidators = function () {
1534
1253
  if (this.operator === PepSmartFilterOperators.NumberRange) {
1535
- var firstValidators = [i1.Validators.required];
1254
+ var firstValidators = [forms.Validators.required];
1536
1255
  if (this.secondControl.value) {
1537
1256
  firstValidators.push(this.validator.isLessThan(this.secondControl));
1538
1257
  }
1539
1258
  this.firstControl.setValidators(firstValidators);
1540
1259
  this.secondControl.enable();
1541
- var secondValidators = [i1.Validators.required];
1260
+ var secondValidators = [forms.Validators.required];
1542
1261
  if (this.firstControl.value) {
1543
1262
  secondValidators.push(this.validator.isGreaterThan(this.firstControl));
1544
1263
  }
@@ -1548,40 +1267,72 @@
1548
1267
  _super.prototype.setFieldsStateAndValidators.call(this);
1549
1268
  }
1550
1269
  };
1551
- PepNumberFilterComponent.prototype.setControlsWidth = function () {
1552
- if (this.operator === PepSmartFilterOperators.NumberRange) {
1553
- this.operatorWidth = '30%';
1554
- }
1555
- else {
1556
- this.operatorWidth = '38%';
1557
- }
1558
- };
1559
1270
  PepNumberFilterComponent.prototype.onOperatorChanged = function (value) {
1560
1271
  var operator = Object.values(PepSmartFilterOperators).find(function (operator) { return operator.id === value; });
1561
1272
  this.operator = operator;
1562
- if (this._parentForm) {
1563
- this.updateParentForm();
1564
- }
1565
- if (this.emitOnChange) {
1566
- this.applyFilter();
1567
- }
1568
- this.setControlsWidth();
1569
- };
1570
- PepNumberFilterComponent.prototype.onValueChanged = function () {
1571
- if (this.emitOnChange) {
1572
- this.applyFilter();
1573
- }
1574
1273
  };
1575
1274
  return PepNumberFilterComponent;
1576
1275
  }(BaseFilterComponent));
1577
1276
  PepNumberFilterComponent.decorators = [
1578
- { type: i0.Component, args: [{
1277
+ { type: core.Component, args: [{
1579
1278
  selector: 'pep-number-filter',
1580
- template: "<div [formGroup]=\"form\" [fxLayout]=\"inline ? 'row' : 'column'\" [fxLayoutGap]=\"inline ? '.5rem' : '0rem'\">\n <ng-container>\n <pep-select [fxFlex]=\"inline ? operatorWidth : null\" [key]=\"'typeOperator'\" [value]=\"operator.id\"\n [label]=\"'SMART_FILTERS.TYPE' | translate\" [renderTitle]=\"renderTitle\" [emptyOption]=\"false\"\n [options]=\"chooseTypeOptions\" (valueChange)=\"onOperatorChanged($event)\">\n </pep-select>\n </ng-container>\n <div *ngIf=\"operator !== PepSmartFilterOperators.NumberRange\" [fxFlex]=\"inline ? firstControlWidth : null\">\n <!-- Amount -->\n <pep-textbox [form]=\"form\" [key]=\"firstControlKey\" [label]=\"'SMART_FILTERS.AMOUNT' | translate\"\n [renderError]=\"false\" [renderTitle]=\"renderTitle\" [type]=\"field.type\"\n [formattedValue]=\"firstControl?.value || ''\" [value]=\"firstControl?.value || ''\"\n (valueChange)=\"onValueChanged()\">\n </pep-textbox>\n </div>\n <div *ngIf=\"operator === PepSmartFilterOperators.NumberRange\" fxLayout=\"row\" fxLayout.xs=\"column\"\n [fxLayoutGap]=\"inline ? '.5rem' : '1rem'\">\n <!-- Min number -->\n <pep-textbox [form]=\"form\" [key]=\"firstControlKey\" [label]=\"'SMART_FILTERS.MIN' | translate\"\n [renderError]=\"false\" [renderTitle]=\"renderTitle\" [type]=\"field.type\" fxFlex=\"50%\"\n [formattedValue]=\"firstControl?.value || ''\" [value]=\"firstControl?.value || ''\"\n [maxValue]=\"secondControl?.value || ''\" (valueChange)=\"onValueChanged()\">\n </pep-textbox>\n <!-- Max number -->\n <pep-textbox [form]=\"form\" [key]=\"secondControlKey\" [label]=\"'SMART_FILTERS.MAX' | translate\"\n [renderError]=\"false\" [renderTitle]=\"renderTitle\" [type]=\"field.type\" fxFlex=\"50%\"\n [formattedValue]=\"secondControl?.value || ''\" [value]=\"secondControl?.value || ''\"\n [minValue]=\"firstControl?.value || ''\" (valueChange)=\"onValueChanged()\">\n </pep-textbox>\n </div>\n</div>",
1279
+ template: "<div [formGroup]=\"form\">\n <ng-container>\n <pep-select [key]=\"'typeOperator'\" [value]=\"operator.id\" [label]=\"'SMART_FILTERS.TYPE' | translate\"\n [emptyOption]=\"false\" [options]=\"chooseTypeOptions\" (valueChange)=\"onOperatorChanged($event)\">\n </pep-select>\n </ng-container>\n <div *ngIf=\"operator !== PepSmartFilterOperators.NumberRange\">\n <!-- Amount -->\n <pep-textbox [form]=\"form\" [key]=\"firstControlKey\" [label]=\"'SMART_FILTERS.AMOUNT' | translate\"\n [renderError]=\"false\" [type]=\"field.type\" [formattedValue]=\"firstControl.value\"\n [value]=\"firstControl.value\">\n </pep-textbox>\n </div>\n <div *ngIf=\"operator === PepSmartFilterOperators.NumberRange\" fxLayout=\"row\" fxLayout.xs=\"column\"\n fxLayoutGap=\"1rem\">\n <!-- Min number -->\n <pep-textbox [form]=\"form\" [key]=\"firstControlKey\" [label]=\"'SMART_FILTERS.MIN' | translate\"\n [renderError]=\"false\" fxFlex=\"50%\" [type]=\"field.type\" [formattedValue]=\"firstControl.value\"\n [value]=\"firstControl.value\" [maxValue]=\"secondControl.value\">\n </pep-textbox>\n <!-- Max number -->\n <pep-textbox [form]=\"form\" [key]=\"secondControlKey\" [label]=\"'SMART_FILTERS.MAX' | translate\"\n [renderError]=\"false\" fxFlex=\"50%\" [type]=\"field.type\" [formattedValue]=\"secondControl.value\"\n [value]=\"secondControl.value\" [minValue]=\"firstControl.value\">\n </pep-textbox>\n </div>\n</div>",
1581
1280
  styles: [""]
1582
1281
  },] }
1583
1282
  ];
1584
1283
 
1284
+ var PepSmartFiltersModule = /** @class */ (function () {
1285
+ function PepSmartFiltersModule(pepIconRegistry) {
1286
+ this.pepIconRegistry = pepIconRegistry;
1287
+ this.pepIconRegistry.registerIcons([
1288
+ icon.pepIconNumberMinus,
1289
+ icon.pepIconNumberPlus,
1290
+ ]);
1291
+ }
1292
+ return PepSmartFiltersModule;
1293
+ }());
1294
+ PepSmartFiltersModule.decorators = [
1295
+ { type: core.NgModule, args: [{
1296
+ imports: [
1297
+ common.CommonModule,
1298
+ forms.ReactiveFormsModule,
1299
+ flexLayout.FlexLayoutModule,
1300
+ // Material modules
1301
+ core$2.MatCommonModule,
1302
+ checkbox.MatCheckboxModule,
1303
+ chips.MatChipsModule,
1304
+ expansion.MatExpansionModule,
1305
+ icon$1.MatIconModule,
1306
+ formField.MatFormFieldModule,
1307
+ input.MatInputModule,
1308
+ radio.MatRadioModule,
1309
+ // External modules
1310
+ ngxVirtualScroller.VirtualScrollerModule,
1311
+ // ngx-lib modules
1312
+ ngxLib.PepNgxLibModule,
1313
+ checkbox$1.PepCheckboxModule,
1314
+ date.PepDateModule,
1315
+ select.PepSelectModule,
1316
+ textbox.PepTextboxModule,
1317
+ search.PepSearchModule,
1318
+ icon.PepIconModule,
1319
+ ],
1320
+ exports: [PepSmartFiltersComponent],
1321
+ declarations: [
1322
+ // BaseFilterComponent,
1323
+ PepSmartFiltersComponent,
1324
+ PepFilterActionsComponent,
1325
+ PepBooleanFilterComponent,
1326
+ PepDateFilterComponent,
1327
+ PepMultiSelectFilterComponent,
1328
+ PepNumberFilterComponent,
1329
+ ],
1330
+ },] }
1331
+ ];
1332
+ PepSmartFiltersModule.ctorParameters = function () { return [
1333
+ { type: icon.PepIconRegistry }
1334
+ ]; };
1335
+
1585
1336
  // Base field
1586
1337
  // ------------------------------
1587
1338
  var PepSmartFilterBaseField = /** @class */ (function () {
@@ -1610,20 +1361,6 @@
1610
1361
  });
1611
1362
  return PepSmartFilterBaseField;
1612
1363
  }());
1613
- // Text field
1614
- // ------------------------------
1615
- var PepSmartFilterTextField = /** @class */ (function (_super) {
1616
- __extends(PepSmartFilterTextField, _super);
1617
- function PepSmartFilterTextField(field) {
1618
- var _this = _super.call(this, field) || this;
1619
- _this._componentType = 'text';
1620
- return _this;
1621
- }
1622
- PepSmartFilterTextField.prototype.getType = function () {
1623
- return 'text';
1624
- };
1625
- return PepSmartFilterTextField;
1626
- }(PepSmartFilterBaseField));
1627
1364
  // Boolean field
1628
1365
  // ------------------------------
1629
1366
  var PepSmartFilterBooleanField = /** @class */ (function (_super) {
@@ -1735,9 +1472,6 @@
1735
1472
  return PepSmartFilterPercentageField;
1736
1473
  }(PepSmartFilterNumberBaseField));
1737
1474
 
1738
- function createTextSmartFilterField(data) {
1739
- return new PepSmartFilterTextField(data);
1740
- }
1741
1475
  function createBooleanSmartFilterField(data) {
1742
1476
  return new PepSmartFilterBooleanField(data);
1743
1477
  }
@@ -1765,9 +1499,6 @@
1765
1499
  function createSmartFilterField(data, type) {
1766
1500
  var field;
1767
1501
  switch (type) {
1768
- case 'text':
1769
- field = createTextSmartFilterField(data);
1770
- break;
1771
1502
  case 'boolean':
1772
1503
  field = createBooleanSmartFilterField(data);
1773
1504
  break;
@@ -1810,987 +1541,6 @@
1810
1541
  };
1811
1542
  }
1812
1543
 
1813
- var Equals = {
1814
- legacy: 'IsEqual',
1815
- smartFilter: PepSmartFilterOperators.Equals,
1816
- type: ['boolean', 'int', 'text']
1817
- };
1818
- var NotEqual = {
1819
- legacy: 'IsNotEqual',
1820
- smartFilter: PepSmartFilterOperators.NotEqual,
1821
- type: null
1822
- };
1823
- var LessThan = {
1824
- legacy: '<',
1825
- smartFilter: PepSmartFilterOperators.LessThan,
1826
- type: null
1827
- };
1828
- var GreaterThan = {
1829
- legacy: '>',
1830
- smartFilter: PepSmartFilterOperators.GreaterThan,
1831
- type: null
1832
- };
1833
- /*
1834
- const GreaterThanOrEquals: IPepFilterBuilderOperator = {
1835
- legacy: {
1836
- operator: '>=',
1837
- type: 'Integer'
1838
- },
1839
- smartFilter: {
1840
- item: PepSmartFilterOperators.GreaterThanOrEquals,
1841
- type: 'int'
1842
- }
1843
- };
1844
-
1845
- const LessThanOrEquals: IPepFilterBuilderOperator = {
1846
- legacy: {
1847
- operator: '<=',
1848
- type: 'Integer'
1849
- },
1850
- smartFilter: {
1851
- item: PepSmartFilterOperators.LessThanOrEquals,
1852
- type: 'int',
1853
- type: 'Integer'
1854
- }
1855
- }; */
1856
- var NumberRange = {
1857
- legacy: 'Between',
1858
- smartFilter: PepSmartFilterOperators.NumberRange,
1859
- type: ['int']
1860
- };
1861
- var Contains = {
1862
- legacy: 'Contains',
1863
- smartFilter: PepSmartFilterOperators.Contains,
1864
- type: null
1865
- };
1866
- /*
1867
- const BeginsWith: IPepFilterBuilderOperator = {
1868
- legacy: {
1869
- operator: 'BeginsWith',
1870
- type: 'String'
1871
- },
1872
- smartFilter: {
1873
- item: PepSmartFilterOperators.BeginsWith,
1874
- type: 'text'
1875
- }
1876
- };
1877
-
1878
- const EndsWith: IPepFilterBuilderOperator = {
1879
- legacy: {
1880
- operator: 'EndsWith',
1881
- type: 'String'
1882
- },
1883
- smartFilter: {
1884
- item: PepSmartFilterOperators.EndsWith,
1885
- type: 'text'
1886
- }
1887
- };
1888
-
1889
- const Before: IPepFilterBuilderOperator = {
1890
- legacy: {
1891
- operator: 'Before',
1892
- type: 'Date'
1893
- },
1894
- smartFilter: {
1895
- item: PepSmartFilterOperators.Before,
1896
- type: 'date'
1897
- }
1898
- };
1899
-
1900
- const After: IPepFilterBuilderOperator = {
1901
- legacy: {
1902
- operator: 'After',
1903
- type: 'Date'
1904
- },
1905
- smartFilter: {
1906
- item: PepSmartFilterOperators.After,
1907
- type: 'date'
1908
- }
1909
- }; */
1910
- var InTheLast = {
1911
- legacy: 'InTheLast',
1912
- smartFilter: PepSmartFilterOperators.InTheLast,
1913
- type: null
1914
- };
1915
- var NotInTheLast = {
1916
- legacy: 'NotInTheLast',
1917
- smartFilter: PepSmartFilterOperators.NotInTheLast,
1918
- type: null
1919
- };
1920
- var Today = {
1921
- legacy: 'Today',
1922
- smartFilter: PepSmartFilterOperators.Today,
1923
- type: null
1924
- };
1925
- var ThisWeek = {
1926
- legacy: 'ThisWeek',
1927
- smartFilter: PepSmartFilterOperators.ThisWeek,
1928
- type: null
1929
- };
1930
- var ThisMonth = {
1931
- legacy: 'ThisMonth',
1932
- smartFilter: PepSmartFilterOperators.ThisMonth,
1933
- type: null
1934
- };
1935
- var DateRange = {
1936
- legacy: 'Between',
1937
- smartFilter: PepSmartFilterOperators.DateRange,
1938
- type: ['date-time']
1939
- };
1940
- var DueIn = {
1941
- legacy: 'DueIn',
1942
- smartFilter: PepSmartFilterOperators.DueIn,
1943
- type: null
1944
- };
1945
- var NotDueIn = {
1946
- legacy: 'NotDueIn',
1947
- smartFilter: PepSmartFilterOperators.NotDueIn,
1948
- type: null
1949
- };
1950
- var On = {
1951
- legacy: 'On',
1952
- smartFilter: PepSmartFilterOperators.On,
1953
- type: null
1954
- };
1955
- var IsEmpty = {
1956
- legacy: 'IsEmpty',
1957
- smartFilter: PepSmartFilterOperators.IsEmpty,
1958
- type: null
1959
- };
1960
- var IsNotEmpty = {
1961
- legacy: 'IsNotEmpty',
1962
- smartFilter: PepSmartFilterOperators.IsNotEmpty,
1963
- type: null
1964
- };
1965
- var In = {
1966
- legacy: 'IsEqual',
1967
- smartFilter: PepSmartFilterOperators.In,
1968
- type: ['multi-select']
1969
- };
1970
- var PepFilterBuilderOperators = [
1971
- Equals,
1972
- NotEqual,
1973
- LessThan,
1974
- // LessThanOrEquals,
1975
- GreaterThan,
1976
- // GreaterThanOrEquals,
1977
- NumberRange,
1978
- Contains,
1979
- // BeginsWith,
1980
- // EndsWith,
1981
- // After,
1982
- // Before,
1983
- InTheLast,
1984
- NotInTheLast,
1985
- Today,
1986
- ThisWeek,
1987
- ThisMonth,
1988
- DateRange,
1989
- DueIn,
1990
- NotDueIn,
1991
- On,
1992
- IsEmpty,
1993
- IsNotEmpty,
1994
- In
1995
- ];
1996
- /**
1997
- * gets a smart filter operator item
1998
- * @param operator legacy operator
1999
- * @param type smart filter's type
2000
- * @returns smart filter operator item
2001
- */
2002
- function getSmartBuilderOperator(operator, type) {
2003
- var smartFilterOperator = PepFilterBuilderOperators.find(function (item) { return item.legacy === operator &&
2004
- (item.type === null || item.type.includes(type)); });
2005
- return smartFilterOperator ? smartFilterOperator.smartFilter : null;
2006
- }
2007
- /**
2008
- * gets a legacy operator value
2009
- * @param operator smart filter operator item
2010
- * @param type smart filter's type
2011
- * @returns legacy operator value
2012
- */
2013
- function getLegacyOperator(operator, type) {
2014
- var legacyOperator = PepFilterBuilderOperators.find(function (item) { return item.smartFilter === operator &&
2015
- (item.type === null || item.type.includes(type)); });
2016
- return legacyOperator ? legacyOperator.legacy : null;
2017
- }
2018
-
2019
- var PepOperatorTypes;
2020
- (function (PepOperatorTypes) {
2021
- PepOperatorTypes["And"] = "AND";
2022
- PepOperatorTypes["Or"] = "OR";
2023
- })(PepOperatorTypes || (PepOperatorTypes = {}));
2024
-
2025
- var FilterBuilderSectionComponent = /** @class */ (function () {
2026
- function FilterBuilderSectionComponent(filterBuilderService, typeConvertorService) {
2027
- this.filterBuilderService = filterBuilderService;
2028
- this.typeConvertorService = typeConvertorService;
2029
- this.remove = new i0.EventEmitter();
2030
- this.operatorChange = new i0.EventEmitter();
2031
- }
2032
- FilterBuilderSectionComponent.prototype.ngOnInit = function () {
2033
- };
2034
- Object.defineProperty(FilterBuilderSectionComponent.prototype, "f", {
2035
- get: function () {
2036
- return this.form.controls;
2037
- },
2038
- enumerable: false,
2039
- configurable: true
2040
- });
2041
- FilterBuilderSectionComponent.prototype.onOperatorChanged = function (value) {
2042
- this.f.operator.setValue(value);
2043
- this.operatorChange.emit();
2044
- };
2045
- FilterBuilderSectionComponent.prototype.onAddRuleClicked = function () {
2046
- this.filterBuilderService.createItem(null, this.sectionContainer, this.form);
2047
- };
2048
- FilterBuilderSectionComponent.prototype.onAddRuleSetClicked = function () {
2049
- var result = this.filterBuilderService.createSection(PepOperatorTypes.And, this.sectionContainer, this.form, this.depth + 1);
2050
- this.filterBuilderService.createItem(null, result.containerRef, result.parentForm);
2051
- };
2052
- FilterBuilderSectionComponent.prototype.onDeleteSectionClicked = function () {
2053
- this.remove.emit();
2054
- };
2055
- return FilterBuilderSectionComponent;
2056
- }());
2057
- FilterBuilderSectionComponent.decorators = [
2058
- { type: i0.Component, args: [{
2059
- selector: 'pep-filter-builder-section',
2060
- template: "<div fxLayout=\"row\" fxLayoutGap=\".5rem\">\n <div class=\"filter-section-container\" fxLayout=\"row\" fxLayoutAlign=\"flex-start start\" fxLayoutGap=\".5rem\">\n <pep-select fxFlex=\"11\" [value]=\"f.operator.value\" xAlignment=\"left\" [options]=\"typeConvertorService.operators\"\n [renderTitle]=\"false\" [emptyOption]=false (valueChange)=\"onOperatorChanged($event)\">\n </pep-select>\n <div fxFlex=\"89\" class=\"filter-section-wrapper\" fxLayout=\"column\" fxLayoutGap=\".5rem\">\n <ng-container #sectionContainer></ng-container>\n <div fxLayout=\"row\" fxLayoutGap=\".5rem\">\n <pep-button value=\"Add Filter\" styleType=\"weak\" styleStateType=\"system\" sizeType=\"sm\" classNames=\"\"\n [disabled]=\"false\" iconName=\"number_plus\" iconPosition=\"end\" [visible]=\"true\"\n (buttonClick)=\"onAddRuleClicked()\"></pep-button>\n <ng-container *ngIf=\"depth < filterBuilderService.maxDepth-1\">\n <pep-button value=\"Add Filter Group\" styleType=\"weak\" styleStateType=\"system\" sizeType=\"sm\"\n classNames=\"\" [disabled]=\"false\" iconName=\"number_plus\" iconPosition=\"end\" [visible]=\"true\"\n (buttonClick)=\"onAddRuleSetClicked()\"></pep-button>\n </ng-container>\n </div>\n </div>\n </div>\n <pep-button *ngIf=\"depth > 0\" styleType=\"weak\" styleStateType=\"system_bin\" sizeType=\"md\" classNames=\"\"\n [disabled]=\"false\" iconName=\"system_bin\" iconPosition=\"end\" [visible]=\"true\"\n (buttonClick)=\"onDeleteSectionClicked()\">\n </pep-button>\n</div>",
2061
- styles: [".filter-section-wrapper{width:100%}.filter-section-container{border-radius:.25rem;border-radius:var(--pep-border-radius-md,.25rem);padding:.5rem;width:100%}"]
2062
- },] }
2063
- ];
2064
- FilterBuilderSectionComponent.ctorParameters = function () { return [
2065
- { type: FilterBuilderService },
2066
- { type: PepTypeConvertorService }
2067
- ]; };
2068
- FilterBuilderSectionComponent.propDecorators = {
2069
- form: [{ type: i0.Input }],
2070
- depth: [{ type: i0.Input }],
2071
- remove: [{ type: i0.Output }],
2072
- operatorChange: [{ type: i0.Output }],
2073
- sectionContainer: [{ type: i0.ViewChild, args: ['sectionContainer', { read: i0.ViewContainerRef, static: true },] }]
2074
- };
2075
-
2076
- var FilterBuilderItemComponent = /** @class */ (function () {
2077
- function FilterBuilderItemComponent(_fb) {
2078
- this._fb = _fb;
2079
- this._fields = [];
2080
- this._options = [];
2081
- this._selectedField = null;
2082
- this.filterChange = new i0.EventEmitter();
2083
- this.remove = new i0.EventEmitter();
2084
- this.test = {};
2085
- this.fieldWidth = 26;
2086
- this.filterWidth = 67.5;
2087
- this.binWidth = 6.5;
2088
- this.setupForm();
2089
- }
2090
- Object.defineProperty(FilterBuilderItemComponent.prototype, "fields", {
2091
- set: function (list) {
2092
- if ((list === null || list === void 0 ? void 0 : list.length) > 0) {
2093
- this._fields = list;
2094
- this._options = list.map(function (field) {
2095
- return {
2096
- key: field.id,
2097
- value: field.name
2098
- };
2099
- });
2100
- }
2101
- },
2102
- enumerable: false,
2103
- configurable: true
2104
- });
2105
- ;
2106
- Object.defineProperty(FilterBuilderItemComponent.prototype, "selected", {
2107
- set: function (value) {
2108
- if (value) {
2109
- this._selectedField = value;
2110
- }
2111
- },
2112
- enumerable: false,
2113
- configurable: true
2114
- });
2115
- Object.defineProperty(FilterBuilderItemComponent.prototype, "filter", {
2116
- set: function (value) {
2117
- if (value) {
2118
- this._filter = value;
2119
- }
2120
- },
2121
- enumerable: false,
2122
- configurable: true
2123
- });
2124
- ;
2125
- Object.defineProperty(FilterBuilderItemComponent.prototype, "parentForm", {
2126
- set: function (value) {
2127
- if (value) {
2128
- this._parentForm = value;
2129
- this.addToParentForm();
2130
- }
2131
- },
2132
- enumerable: false,
2133
- configurable: true
2134
- });
2135
- ;
2136
- FilterBuilderItemComponent.prototype.ngOnInit = function () {
2137
- };
2138
- FilterBuilderItemComponent.prototype.setupForm = function () {
2139
- this._form = this._fb.group({
2140
- fieldId: this._fb.control(null),
2141
- fieldType: this._fb.control(null),
2142
- operator: this._fb.control(null),
2143
- operatorUnit: this._fb.control(null),
2144
- values: this._fb.group({
2145
- first: this._fb.control(null),
2146
- second: this._fb.control(null)
2147
- }),
2148
- });
2149
- };
2150
- FilterBuilderItemComponent.prototype.addToParentForm = function () {
2151
- this._parentForm.setControl(this.formKey, this._form);
2152
- };
2153
- FilterBuilderItemComponent.prototype.onFieldChanged = function (key) {
2154
- var _this = this;
2155
- var item = this._fields.find(function (field) { return field.id === key; });
2156
- this.setupForm();
2157
- this.addToParentForm();
2158
- /**
2159
- * hack due to angular's change detection bug -
2160
- * ERROR Error: There is no FormControl instance attached to form control element with name: [formControlName]
2161
- */
2162
- this._selectedField = null;
2163
- setTimeout(function () {
2164
- _this._selectedField = item ? item : null;
2165
- }, 0);
2166
- this._filter = null;
2167
- };
2168
- FilterBuilderItemComponent.prototype.onFilterChanged = function () {
2169
- if (this._form.valid) {
2170
- this.filterChange.emit();
2171
- }
2172
- };
2173
- FilterBuilderItemComponent.prototype.onDeleteItemClicked = function () {
2174
- this.remove.emit();
2175
- };
2176
- return FilterBuilderItemComponent;
2177
- }());
2178
- FilterBuilderItemComponent.decorators = [
2179
- { type: i0.Component, args: [{
2180
- selector: 'pep-filter-builder-item',
2181
- template: "<div class=\"filter-item-container\" fxLayout=\"column\" fxLayoutGap=\".5rem\">\n <div fxLayout=\"row\" fxLayoutGap=\".5rem\">\n <pep-select fxFlex=\"25%\" [value]=\"_selectedField?.id\" xAlignment=\"left\" [options]=\"_options\"\n [renderTitle]=\"false\" (valueChange)=\"onFieldChanged($event)\"></pep-select>\n <ng-container *ngIf=\"_selectedField?.componentType\">\n <ng-container [ngSwitch]=\"_selectedField.componentType\">\n <ng-container *ngSwitchCase=\"'text'\">\n <pep-text-filter fxFlex=\"auto\" [showActionButtons]=\"false\" [field]=\"_selectedField\"\n [filter]=\"_filter\" [parentForm]=\"_form\" [emitOnChange]=\"true\" [inline]=\"true\"\n [renderTitle]=\"false\" (filterChange)=\"onFilterChanged()\">\n </pep-text-filter>\n </ng-container>\n <ng-container *ngSwitchCase=\"'boolean'\">\n <pep-boolean-filter fxFlex=\"auto\" [showActionButtons]=\"false\" [field]=\"_selectedField\"\n [filter]=\"_filter\" [parentForm]=\"_form\" [emitOnChange]=\"true\" [inline]=\"true\"\n [renderTitle]=\"false\" (filterChange)=\"onFilterChanged()\">\n </pep-boolean-filter>\n </ng-container>\n <ng-container *ngSwitchCase=\"'date'\">\n <pep-date-filter fxFlex=\"auto\" [showActionButtons]=\"false\" [field]=\"_selectedField\"\n [filter]=\"_filter\" [parentForm]=\"_form\" [emitOnChange]=\"true\" [inline]=\"true\"\n [renderTitle]=\"false\" (filterChange)=\"onFilterChanged()\">\n </pep-date-filter>\n </ng-container>\n <ng-container *ngSwitchCase=\"'multi-select'\">\n <pep-multi-select-filter fxFlex=\"auto\" [showActionButtons]=\"false\" [field]=\"_selectedField\"\n [filter]=\"_filter\" [parentForm]=\"_form\" [emitOnChange]=\"true\" [inline]=\"true\"\n [renderTitle]=\"false\" (filterChange)=\"onFilterChanged()\">\n </pep-multi-select-filter>\n </ng-container>\n <ng-container *ngSwitchCase=\"'number'\">\n <pep-number-filter fxFlex=\"auto\" [showActionButtons]=\"false\" [field]=\"_selectedField\"\n [filter]=\"_filter\" [parentForm]=\"_form\" [emitOnChange]=\"true\" [inline]=\"true\"\n [renderTitle]=\"false\" (filterChange)=\"onFilterChanged()\">\n </pep-number-filter>\n </ng-container>\n </ng-container>\n </ng-container>\n <!-- <ng-container *ngIf=\"(_parentForm | filterItemCounter) > 1\"> -->\n <pep-button styleType=\"weak\" styleStateType=\"system_bin\" sizeType=\"md\" classNames=\"\" [disabled]=\"false\"\n iconName=\"system_bin\" iconPosition=\"end\" [visible]=\"true\" (buttonClick)=\"onDeleteItemClicked()\">\n </pep-button>\n <!-- </ng-container> -->\n </div>\n</div>",
2182
- styles: [""]
2183
- },] }
2184
- ];
2185
- FilterBuilderItemComponent.ctorParameters = function () { return [
2186
- { type: i1.FormBuilder }
2187
- ]; };
2188
- FilterBuilderItemComponent.propDecorators = {
2189
- formKey: [{ type: i0.Input }],
2190
- fields: [{ type: i0.Input }],
2191
- selected: [{ type: i0.Input }],
2192
- filter: [{ type: i0.Input }],
2193
- parentForm: [{ type: i0.Input }],
2194
- filterChange: [{ type: i0.Output }],
2195
- remove: [{ type: i0.Output }]
2196
- };
2197
-
2198
- var PepFilterBuilderTypeMap = /** @class */ (function () {
2199
- function PepFilterBuilderTypeMap() {
2200
- this.loadTypes();
2201
- }
2202
- PepFilterBuilderTypeMap.prototype.loadTypes = function () {
2203
- this.map = new Map();
2204
- this.map.set('Bool', 'boolean');
2205
- this.map.set('JsonBool', 'boolean');
2206
- this.map.set('Integer', 'int');
2207
- this.map.set('Double', 'int');
2208
- this.map.set('String', 'text');
2209
- this.map.set('Guid', 'text');
2210
- this.map.set('Date', 'date');
2211
- this.map.set('DateTime', 'date-time');
2212
- this.map.set('MultipleStringValues', 'multi-select');
2213
- };
2214
- /**
2215
- * Converts legacy field type to smart builder type
2216
- * @param type legacy type
2217
- * @returns smart builder field type
2218
- */
2219
- PepFilterBuilderTypeMap.prototype.getSmartBuilderType = function (key) {
2220
- var item = this.map.get(key);
2221
- return item ? item : null;
2222
- };
2223
- return PepFilterBuilderTypeMap;
2224
- }());
2225
-
2226
- var Days = {
2227
- legacy: 'Days',
2228
- smartFilter: PepSmartFilterOperatorUnits.Days
2229
- };
2230
- var Weeks = {
2231
- legacy: 'Weeks',
2232
- smartFilter: PepSmartFilterOperatorUnits.Weeks
2233
- };
2234
- var Months = {
2235
- legacy: 'Months',
2236
- smartFilter: PepSmartFilterOperatorUnits.Months
2237
- };
2238
- var Years = {
2239
- legacy: 'Years',
2240
- smartFilter: PepSmartFilterOperatorUnits.Years
2241
- };
2242
- var PepFilterBuilderOperationUnit = [
2243
- Days,
2244
- Weeks,
2245
- Months,
2246
- Years,
2247
- ];
2248
- /**
2249
- * gets a smart filter operation unit item
2250
- * @param operationUnit legacy operation unit
2251
- * @returns smart filter operation unit item
2252
- */
2253
- function getSmartBuilderOperationUnit(operationUnit) {
2254
- var smartFilterOperationUnit = PepFilterBuilderOperationUnit.find(function (unit) { return unit.legacy === operationUnit; });
2255
- return smartFilterOperationUnit ? smartFilterOperationUnit.smartFilter : null;
2256
- }
2257
- /**
2258
- * gets a legacy operation unit value
2259
- * @param operationUnit smart filter operation unit item
2260
- * @returns legacy operation unit value
2261
- */
2262
- function getLegacyOperationUnit(operationUnit) {
2263
- var legacyOperationUnit = PepFilterBuilderOperationUnit.find(function (unit) { return unit.smartFilter === operationUnit; });
2264
- return legacyOperationUnit ? legacyOperationUnit.legacy : null;
2265
- }
2266
-
2267
- var PepOutputFilterService = /** @class */ (function () {
2268
- function PepOutputFilterService() {
2269
- }
2270
- /**
2271
- * generates a legacy JSON
2272
- * @param json UI smart filters structure
2273
- * @param fields smart filter field
2274
- * @returns legacy JSON
2275
- */
2276
- PepOutputFilterService.prototype.generateJson = function (json, fields) {
2277
- this.initProperties();
2278
- this._fields = fields;
2279
- this.treeWalk(json);
2280
- return this._json ? this._json : this._firstItem ? this._firstItem : null;
2281
- };
2282
- /**
2283
- * reset properties
2284
- */
2285
- PepOutputFilterService.prototype.initProperties = function () {
2286
- this._json = undefined;
2287
- this._firstItem = undefined;
2288
- this._complexIdCounter = 1;
2289
- this._expressionIdCounter = 1;
2290
- };
2291
- /**
2292
- * a recursive function dynamically builds legacy JSON structure
2293
- * @param current UI object represents either a section or filter component
2294
- */
2295
- PepOutputFilterService.prototype.treeWalk = function (current) {
2296
- var _this = this;
2297
- Object.keys(current).forEach(function (key) {
2298
- if (key.includes('item')) {
2299
- _this.createItem({
2300
- ExpressionId: (_this._expressionIdCounter++).toString(),
2301
- ApiName: current[key].fieldId,
2302
- Operation: getLegacyOperator(current[key].operator, current[key].fieldType),
2303
- Values: _this.getItemValues(current[key])
2304
- }, current.operator);
2305
- }
2306
- else if (key.includes('section')) {
2307
- _this.treeWalk(current[key]);
2308
- }
2309
- });
2310
- };
2311
- /**
2312
- * adds a filter to json and wrap it with complex operator
2313
- * @param item expression item
2314
- * @param operator complex operator
2315
- */
2316
- PepOutputFilterService.prototype.createItem = function (item, operator) {
2317
- if (this._json) {
2318
- this._json = this.createSection(this._json, item, operator);
2319
- }
2320
- else if (this._firstItem) {
2321
- this._json = this.createSection(this._firstItem, item, operator);
2322
- }
2323
- else {
2324
- this._firstItem = item;
2325
- }
2326
- };
2327
- /**
2328
- * creates a legacy complex object
2329
- * @param left LeftNode object
2330
- * @param right RightNode object
2331
- * @param operator AND/OR operator
2332
- * @returns complex object
2333
- */
2334
- PepOutputFilterService.prototype.createSection = function (left, right, operator) {
2335
- return {
2336
- ComplexId: (this._complexIdCounter++).toString(),
2337
- LeftNode: left,
2338
- RightNode: right,
2339
- Operation: operator
2340
- };
2341
- };
2342
- /**
2343
- * gets legacy filter values object
2344
- * @param current UI filter object's values
2345
- * @returns an array represents legacy values
2346
- */
2347
- PepOutputFilterService.prototype.getItemValues = function (current) {
2348
- var _a;
2349
- var values = [];
2350
- if ((_a = current === null || current === void 0 ? void 0 : current.values) === null || _a === void 0 ? void 0 : _a.first) {
2351
- if (current.operator === PepSmartFilterOperators.In) { //multi select
2352
- values = current.values.first;
2353
- }
2354
- else if (current.operator === PepSmartFilterOperators.InTheLast ||
2355
- current.operator === PepSmartFilterOperators.NotInTheLast ||
2356
- current.operator === PepSmartFilterOperators.DueIn ||
2357
- current.operator === PepSmartFilterOperators.NotDueIn) { //operation unit
2358
- values.push(current.values.first);
2359
- if (current.operatorUnit) {
2360
- values.push(getLegacyOperationUnit(current.operatorUnit));
2361
- }
2362
- }
2363
- else {
2364
- values.push(current.values.first);
2365
- if (current.values.second) {
2366
- values.push(current.values.second);
2367
- }
2368
- }
2369
- }
2370
- return values;
2371
- };
2372
- /**
2373
- * generates an array of keys of multi-select control
2374
- * @param values an array of the selected values
2375
- * @param id filter's selected field
2376
- * @returns an array of keys
2377
- */
2378
- PepOutputFilterService.prototype.getFieldKeys = function (values, id) {
2379
- var keys = [];
2380
- var field = this._fields.find(function (item) { return item.id === id; });
2381
- if (field) {
2382
- keys = field === null || field === void 0 ? void 0 : field.options.filter(function (item) { return values.includes(item.value); }).map(function (option) { return option.key; });
2383
- }
2384
- return keys;
2385
- };
2386
- return PepOutputFilterService;
2387
- }());
2388
- PepOutputFilterService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function PepOutputFilterService_Factory() { return new PepOutputFilterService(); }, token: PepOutputFilterService, providedIn: "root" });
2389
- PepOutputFilterService.decorators = [
2390
- { type: i0.Injectable, args: [{
2391
- providedIn: 'root',
2392
- },] }
2393
- ];
2394
- PepOutputFilterService.ctorParameters = function () { return []; };
2395
-
2396
- var FilterBuilderService = /** @class */ (function () {
2397
- function FilterBuilderService(_fb, _resolver, _outputJsonService) {
2398
- this._fb = _fb;
2399
- this._resolver = _resolver;
2400
- this._outputJsonService = _outputJsonService;
2401
- this.MAX_STRUCTURE_DEPTH = 3;
2402
- this._outputJsonSubject = new rxjs.BehaviorSubject(null);
2403
- this.triggerOutputJson = this._outputJsonSubject.asObservable();
2404
- }
2405
- Object.defineProperty(FilterBuilderService.prototype, "maxDepth", {
2406
- get: function () {
2407
- return this.MAX_STRUCTURE_DEPTH;
2408
- },
2409
- enumerable: false,
2410
- configurable: true
2411
- });
2412
- /**
2413
- * creates a dynamic filter structure
2414
- * might has a different structure than the input's due to merge of parent-child elements
2415
- * @param json legacy JSON
2416
- * @param fields an array of legacy fields
2417
- * @param containerRef reference to root element
2418
- */
2419
- FilterBuilderService.prototype.createFilterTree = function (json, fields, form, containerRef) {
2420
- this._form = form;
2421
- this._smartFilterFields = this.convertToSmartFilterFields(fields);
2422
- var result = this.createSection((json === null || json === void 0 ? void 0 : json.Operation) ? json.Operation : PepOperatorTypes.And, containerRef, this._form, 0);
2423
- if (json) {
2424
- this.flatten(json, json.LeftNode, result.containerRef, result.parentForm, 1);
2425
- this.flatten(json, json.RightNode, result.containerRef, result.parentForm, 1);
2426
- }
2427
- };
2428
- /**
2429
- * checks if the object contains property
2430
- * @param obj object
2431
- * @param prop property name
2432
- * @returns true if contains, false otherwise
2433
- */
2434
- FilterBuilderService.prototype.hasProperty = function (obj, prop) {
2435
- return Object.prototype.hasOwnProperty.call(obj, prop);
2436
- };
2437
- /**
2438
- * a recursive function dynamically builds filters structure
2439
- * @param parent legacy complex object
2440
- * @param current child legacy object (either another complex or expression type)
2441
- * @param containerRef parent element
2442
- * @param parentForm parent form
2443
- */
2444
- FilterBuilderService.prototype.flatten = function (parent, current, containerRef, parentForm, depth) {
2445
- if (this.hasProperty(current, 'ComplexId')) {
2446
- var section = current;
2447
- if (parent.Operation === current.Operation) {
2448
- this.flatten(parent, section.LeftNode, containerRef, parentForm, depth);
2449
- this.flatten(parent, section.RightNode, containerRef, parentForm, depth);
2450
- }
2451
- else {
2452
- var result = this.createSection(section.Operation, containerRef, parentForm, depth);
2453
- this.flatten(section, section.LeftNode, result.containerRef, result.parentForm, depth + 1);
2454
- this.flatten(section, section.RightNode, result.containerRef, result.parentForm, depth + 1);
2455
- }
2456
- }
2457
- else if (this.hasProperty(current, 'ExpressionId')) {
2458
- this.createItem(current, containerRef, parentForm);
2459
- }
2460
- };
2461
- /**
2462
- * creates a container object of two or more child filter items
2463
- * @param operator AND/OR operator
2464
- * @param containerRef parent element
2465
- * @param parentForm parent form
2466
- * @param depth
2467
- * @returns an object containing the current element and current form
2468
- */
2469
- FilterBuilderService.prototype.createSection = function (operator, containerRef, parentForm, depth) {
2470
- var _this = this;
2471
- var factory = this._resolver.resolveComponentFactory(FilterBuilderSectionComponent);
2472
- var componentRef = containerRef.createComponent(factory);
2473
- var sectionGroup = this._fb.group({
2474
- operator: this._fb.control(operator)
2475
- });
2476
- var counter = 1;
2477
- Object.keys(parentForm.controls).forEach(function (item) {
2478
- if (item.includes('section')) {
2479
- counter++;
2480
- }
2481
- });
2482
- var formKey = "section" + counter;
2483
- parentForm.addControl(formKey, sectionGroup);
2484
- componentRef.instance.depth = depth;
2485
- componentRef.instance.form = sectionGroup;
2486
- componentRef.instance.remove.subscribe(function () {
2487
- parentForm.removeControl(formKey);
2488
- componentRef.destroy();
2489
- _this.createOutputJson();
2490
- });
2491
- componentRef.instance.operatorChange.subscribe(function () {
2492
- _this.createOutputJson();
2493
- });
2494
- return {
2495
- containerRef: componentRef.instance.sectionContainer,
2496
- parentForm: sectionGroup
2497
- };
2498
- };
2499
- /**
2500
- * creates a component represents filter item (leaf element - has no childs)
2501
- * @param current filter legacy element
2502
- * @param containerRef parent element
2503
- * @param parentForm parent form
2504
- */
2505
- FilterBuilderService.prototype.createItem = function (current, containerRef, parentForm) {
2506
- var _this = this;
2507
- var factory = this._resolver.resolveComponentFactory(FilterBuilderItemComponent);
2508
- var componentRef = containerRef.createComponent(factory);
2509
- var counter = 1;
2510
- Object.keys(parentForm.controls).forEach(function (item) {
2511
- if (item.includes('item')) {
2512
- counter++;
2513
- }
2514
- });
2515
- var formKey = "item" + counter;
2516
- componentRef.instance.formKey = formKey;
2517
- componentRef.instance.fields = this._smartFilterFields;
2518
- var selectedField = this.getSelectedField(current);
2519
- if (selectedField) {
2520
- componentRef.instance.selected = selectedField;
2521
- if (current) {
2522
- componentRef.instance.filter = this.getFilter(current, selectedField);
2523
- }
2524
- }
2525
- componentRef.instance.parentForm = parentForm;
2526
- componentRef.instance.filterChange.subscribe(function () {
2527
- _this.createOutputJson();
2528
- });
2529
- componentRef.instance.remove.subscribe(function () {
2530
- parentForm.removeControl(formKey);
2531
- componentRef.destroy();
2532
- _this.createOutputJson();
2533
- });
2534
- };
2535
- /**
2536
- * creates a smart filter object
2537
- * @param current filter legacy element
2538
- * @param field filter's selected field
2539
- * @returns smart filter object
2540
- */
2541
- FilterBuilderService.prototype.getFilter = function (current, field) {
2542
- var operator = getSmartBuilderOperator(current.Operation, field.type);
2543
- if (operator) {
2544
- var filterValues = this.getFilterValues(current, operator, field);
2545
- return createSmartFilter(current.ApiName, operator, filterValues.first, filterValues.second, filterValues.operationUnit);
2546
- }
2547
- else {
2548
- return null;
2549
- }
2550
- };
2551
- /**
2552
- * get smart filter field
2553
- * @param current filter legacy element
2554
- * @returns smart filter field, if not found returns the first fields
2555
- */
2556
- FilterBuilderService.prototype.getSelectedField = function (current) {
2557
- var _a, _b;
2558
- if (current) {
2559
- var item = this._smartFilterFields.find(function (field) { return field.id === current.ApiName; });
2560
- return item ? item : ((_a = this._smartFilterFields) === null || _a === void 0 ? void 0 : _a.length) > 0 ? this._smartFilterFields[0] : null;
2561
- }
2562
- else {
2563
- return ((_b = this._smartFilterFields) === null || _b === void 0 ? void 0 : _b.length) > 0 ? this._smartFilterFields[0] : null;
2564
- }
2565
- };
2566
- /**
2567
- * gets smart filter's values data
2568
- * @param current filter legacy element
2569
- * @param operator smart filter operator
2570
- * @param field filter's selected field
2571
- * @returns object contains the filter values data
2572
- */
2573
- FilterBuilderService.prototype.getFilterValues = function (current, operator, field) {
2574
- var _a, _b, _c, _d, _e;
2575
- var data = {
2576
- first: null,
2577
- second: null,
2578
- operationUnit: null
2579
- };
2580
- if (operator === PepSmartFilterOperators.In) { //multi select
2581
- //filter keys don't exist on field options
2582
- 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) {
2583
- return field.options.find(function (option) { return option.key === item; });
2584
- }) : null;
2585
- }
2586
- else if (operator === PepSmartFilterOperators.InTheLast ||
2587
- operator === PepSmartFilterOperators.NotInTheLast ||
2588
- operator === PepSmartFilterOperators.DueIn ||
2589
- operator === PepSmartFilterOperators.NotDueIn) { //operation unit
2590
- 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;
2591
- if (((_c = current === null || current === void 0 ? void 0 : current.Values) === null || _c === void 0 ? void 0 : _c.length) === 2) {
2592
- data.operationUnit = getSmartBuilderOperationUnit(current.Values[1]);
2593
- }
2594
- }
2595
- else {
2596
- 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;
2597
- 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;
2598
- }
2599
- return data;
2600
- };
2601
- /**
2602
- * converts legacy fields to smart filter fields
2603
- * @param fields legacy fields array
2604
- * @returns smart filter fields array
2605
- */
2606
- FilterBuilderService.prototype.convertToSmartFilterFields = function (fields) {
2607
- if ((fields === null || fields === void 0 ? void 0 : fields.length) > 0) {
2608
- var typeMapper_1 = new PepFilterBuilderTypeMap();
2609
- return fields.map(function (field) {
2610
- var _a;
2611
- return createSmartFilterField({
2612
- id: field.FieldID,
2613
- name: field.Title,
2614
- options: (_a = field.OptionalValues) === null || _a === void 0 ? void 0 : _a.map(function (option) {
2615
- return {
2616
- key: option.Key,
2617
- value: option.Value
2618
- };
2619
- })
2620
- }, typeMapper_1.getSmartBuilderType(field.FieldType));
2621
- });
2622
- }
2623
- else {
2624
- return [];
2625
- }
2626
- };
2627
- /**
2628
- * creates a legacy output JSON
2629
- */
2630
- FilterBuilderService.prototype.createOutputJson = function () {
2631
- if (this._form.valid) {
2632
- var json = this._outputJsonService.generateJson(this._form.value, this._smartFilterFields);
2633
- this._outputJsonSubject.next(json);
2634
- }
2635
- };
2636
- return FilterBuilderService;
2637
- }());
2638
- FilterBuilderService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function FilterBuilderService_Factory() { return new FilterBuilderService(i0__namespace.ɵɵinject(i1__namespace.FormBuilder), i0__namespace.ɵɵinject(i0__namespace.ComponentFactoryResolver), i0__namespace.ɵɵinject(PepOutputFilterService)); }, token: FilterBuilderService, providedIn: "root" });
2639
- FilterBuilderService.decorators = [
2640
- { type: i0.Injectable, args: [{
2641
- providedIn: 'root'
2642
- },] }
2643
- ];
2644
- FilterBuilderService.ctorParameters = function () { return [
2645
- { type: i1.FormBuilder },
2646
- { type: i0.ComponentFactoryResolver },
2647
- { type: PepOutputFilterService }
2648
- ]; };
2649
-
2650
- var FilterBuilderComponent = /** @class */ (function () {
2651
- function FilterBuilderComponent(_fb, _filterBuilderService) {
2652
- var _this = this;
2653
- this._fb = _fb;
2654
- this._filterBuilderService = _filterBuilderService;
2655
- this.json = null;
2656
- this.fields = new Array();
2657
- this.filters = new i0.EventEmitter();
2658
- this.formValidationChange = new i0.EventEmitter();
2659
- this._isFormValid = true;
2660
- this.setupForm();
2661
- this._formSubscription$ = this.form.valueChanges.subscribe(function (val) {
2662
- if (_this.form.valid !== _this._isFormValid) {
2663
- _this._isFormValid = _this.form.valid;
2664
- _this.formValidationChange.emit(_this._isFormValid);
2665
- }
2666
- });
2667
- this._outputJsonSubscription$ = this._filterBuilderService.triggerOutputJson.subscribe(function (outputJson) {
2668
- _this.filters.emit(outputJson);
2669
- });
2670
- }
2671
- FilterBuilderComponent.prototype.setupForm = function () {
2672
- this.form = this._fb.group({});
2673
- };
2674
- FilterBuilderComponent.prototype.ngOnInit = function () {
2675
- this._filterBuilderService.createFilterTree(this.json, this.fields, this.form, this.filterRoot);
2676
- };
2677
- /*
2678
- ngAfterViewInit() {
2679
- //this._filterBuilderService.createFilterTree(this.json, this.fields, this.form, this.filterRoot);
2680
- }
2681
-
2682
- ngAfterViewChecked() {
2683
- //this._changeDetectionRef.detectChanges();
2684
- } */
2685
- FilterBuilderComponent.prototype.ngOnDestroy = function () {
2686
- if (this._formSubscription$) {
2687
- this._formSubscription$.unsubscribe();
2688
- }
2689
- if (this._outputJsonSubscription$) {
2690
- this._outputJsonSubscription$.unsubscribe();
2691
- }
2692
- };
2693
- return FilterBuilderComponent;
2694
- }());
2695
- FilterBuilderComponent.decorators = [
2696
- { type: i0.Component, args: [{
2697
- selector: 'pep-filter-builder',
2698
- template: "<!-- <div class=\"filter-builder-container\"> -->\n<ng-container #filterRoot></ng-container>\n<!-- </div> -->",
2699
- styles: [""]
2700
- },] }
2701
- ];
2702
- FilterBuilderComponent.ctorParameters = function () { return [
2703
- { type: i1.FormBuilder },
2704
- { type: FilterBuilderService }
2705
- ]; };
2706
- FilterBuilderComponent.propDecorators = {
2707
- json: [{ type: i0.Input }],
2708
- fields: [{ type: i0.Input }],
2709
- filters: [{ type: i0.Output }],
2710
- formValidationChange: [{ type: i0.Output }],
2711
- filterRoot: [{ type: i0.ViewChild, args: ['filterRoot', { read: i0.ViewContainerRef, static: true },] }]
2712
- };
2713
-
2714
- var FilterItemCounterPipe = /** @class */ (function () {
2715
- function FilterItemCounterPipe() {
2716
- }
2717
- FilterItemCounterPipe.prototype.transform = function (container) {
2718
- console.log('init filter', container);
2719
- var counter = 0;
2720
- Object.keys(container.controls).forEach(function (item) {
2721
- if (item.includes('item') || item.includes('section')) {
2722
- counter++;
2723
- }
2724
- });
2725
- console.log('filter counter', counter);
2726
- return counter;
2727
- };
2728
- return FilterItemCounterPipe;
2729
- }());
2730
- FilterItemCounterPipe.decorators = [
2731
- { type: i0.Pipe, args: [{
2732
- name: 'filterItemCounter'
2733
- },] }
2734
- ];
2735
-
2736
- var PepSmartFiltersModule = /** @class */ (function () {
2737
- function PepSmartFiltersModule(pepIconRegistry) {
2738
- this.pepIconRegistry = pepIconRegistry;
2739
- this.pepIconRegistry.registerIcons([
2740
- icon.pepIconNumberMinus,
2741
- icon.pepIconNumberPlus,
2742
- ]);
2743
- }
2744
- return PepSmartFiltersModule;
2745
- }());
2746
- PepSmartFiltersModule.decorators = [
2747
- { type: i0.NgModule, args: [{
2748
- imports: [
2749
- common.CommonModule,
2750
- i1.ReactiveFormsModule,
2751
- flexLayout.FlexLayoutModule,
2752
- // Material modules
2753
- core$1.MatCommonModule,
2754
- checkbox.MatCheckboxModule,
2755
- chips.MatChipsModule,
2756
- expansion.MatExpansionModule,
2757
- icon$1.MatIconModule,
2758
- formField.MatFormFieldModule,
2759
- input.MatInputModule,
2760
- radio.MatRadioModule,
2761
- // External modules
2762
- ngxVirtualScroller.VirtualScrollerModule,
2763
- // ngx-lib modules
2764
- ngxLib.PepNgxLibModule,
2765
- checkbox$1.PepCheckboxModule,
2766
- date.PepDateModule,
2767
- select.PepSelectModule,
2768
- textbox.PepTextboxModule,
2769
- search.PepSearchModule,
2770
- icon.PepIconModule,
2771
- button.PepButtonModule,
2772
- ],
2773
- exports: [PepSmartFiltersComponent, FilterBuilderComponent],
2774
- declarations: [
2775
- // BaseFilterComponent,
2776
- PepSmartFiltersComponent,
2777
- PepFilterActionsComponent,
2778
- PepTextFilterComponent,
2779
- PepBooleanFilterComponent,
2780
- PepDateFilterComponent,
2781
- PepMultiSelectFilterComponent,
2782
- PepNumberFilterComponent,
2783
- FilterBuilderComponent,
2784
- FilterBuilderSectionComponent,
2785
- FilterBuilderItemComponent,
2786
- FilterItemCounterPipe
2787
- ],
2788
- },] }
2789
- ];
2790
- PepSmartFiltersModule.ctorParameters = function () { return [
2791
- { type: icon.PepIconRegistry }
2792
- ]; };
2793
-
2794
1544
  /*
2795
1545
  * Public API Surface of ngx-lib/smart-filters
2796
1546
  */
@@ -2800,7 +1550,6 @@
2800
1550
  */
2801
1551
 
2802
1552
  exports.BaseFilterComponent = BaseFilterComponent;
2803
- exports.FilterBuilderComponent = FilterBuilderComponent;
2804
1553
  exports.IPepSmartFilterOperator = IPepSmartFilterOperator;
2805
1554
  exports.IPepSmartFilterOperatorUnit = IPepSmartFilterOperatorUnit;
2806
1555
  exports.PepBooleanFilterComponent = PepBooleanFilterComponent;
@@ -2821,18 +1570,10 @@
2821
1570
  exports.PepSmartFilterOperators = PepSmartFilterOperators;
2822
1571
  exports.PepSmartFilterPercentageField = PepSmartFilterPercentageField;
2823
1572
  exports.PepSmartFilterRealField = PepSmartFilterRealField;
2824
- exports.PepSmartFilterTextField = PepSmartFilterTextField;
2825
1573
  exports.PepSmartFiltersComponent = PepSmartFiltersComponent;
2826
1574
  exports.PepSmartFiltersModule = PepSmartFiltersModule;
2827
1575
  exports.createSmartFilter = createSmartFilter;
2828
1576
  exports.createSmartFilterField = createSmartFilterField;
2829
- exports.ɵa = FilterBuilderService;
2830
- exports.ɵb = PepOutputFilterService;
2831
- exports.ɵc = PepTextFilterComponent;
2832
- exports.ɵd = PepTypeConvertorService;
2833
- exports.ɵe = FilterBuilderSectionComponent;
2834
- exports.ɵf = FilterBuilderItemComponent;
2835
- exports.ɵg = FilterItemCounterPipe;
2836
1577
 
2837
1578
  Object.defineProperty(exports, '__esModule', { value: true });
2838
1579