@pepperi-addons/ngx-lib 0.2.55 → 0.2.58-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/attachment/attachment.component.d.ts +1 -0
- package/attachment/pepperi-addons-ngx-lib-attachment.metadata.json +1 -1
- package/bundles/pepperi-addons-ngx-lib-attachment.umd.js +6 -1
- package/bundles/pepperi-addons-ngx-lib-attachment.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib-checkbox.umd.js +3 -0
- package/bundles/pepperi-addons-ngx-lib-checkbox.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib-color.umd.js +6 -1
- package/bundles/pepperi-addons-ngx-lib-color.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib-date.umd.js +4 -1
- package/bundles/pepperi-addons-ngx-lib-date.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib-form.umd.js +20 -15
- package/bundles/pepperi-addons-ngx-lib-form.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib-image.umd.js +6 -1
- package/bundles/pepperi-addons-ngx-lib-image.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib-images-filmstrip.umd.js +6 -1
- package/bundles/pepperi-addons-ngx-lib-images-filmstrip.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib-list.umd.js +4 -2
- package/bundles/pepperi-addons-ngx-lib-list.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib-quantity-selector.umd.js +6 -1
- package/bundles/pepperi-addons-ngx-lib-quantity-selector.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib-rich-html-textarea.umd.js +6 -1
- package/bundles/pepperi-addons-ngx-lib-rich-html-textarea.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib-select.umd.js +6 -1
- package/bundles/pepperi-addons-ngx-lib-select.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib-separator.umd.js +8 -0
- package/bundles/pepperi-addons-ngx-lib-separator.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib-signature.umd.js +6 -1
- package/bundles/pepperi-addons-ngx-lib-signature.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib-slider.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib-smart-filters.umd.js +1432 -173
- package/bundles/pepperi-addons-ngx-lib-smart-filters.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib-textarea.umd.js +6 -1
- package/bundles/pepperi-addons-ngx-lib-textarea.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib-textbox.umd.js +4 -2
- package/bundles/pepperi-addons-ngx-lib-textbox.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib-top-bar.umd.js +1 -1
- package/bundles/pepperi-addons-ngx-lib.umd.js +4 -2
- package/bundles/pepperi-addons-ngx-lib.umd.js.map +1 -1
- package/color/color.component.d.ts +1 -0
- package/color/pepperi-addons-ngx-lib-color.metadata.json +1 -1
- package/core/customization/customization.service.d.ts +1 -0
- package/esm2015/attachment/attachment.component.js +7 -2
- package/esm2015/checkbox/checkbox.component.js +4 -1
- package/esm2015/color/color.component.js +7 -2
- package/esm2015/core/common/services/translate.service.js +1 -1
- package/esm2015/core/customization/customization.service.js +4 -2
- package/esm2015/date/date.component.js +4 -1
- package/esm2015/form/form.component.js +2 -1
- package/esm2015/form/internal-button.component.js +20 -17
- package/esm2015/form/internal-carusel.component.js +2 -1
- package/esm2015/image/image.component.js +7 -2
- package/esm2015/image/image.service.js +1 -1
- package/esm2015/images-filmstrip/images-filmstrip.component.js +7 -2
- package/esm2015/list/list-total.component.js +5 -3
- package/esm2015/quantity-selector/quantity-selector.component.js +7 -2
- package/esm2015/rich-html-textarea/rich-html-textarea.component.js +7 -2
- package/esm2015/select/select.component.js +7 -2
- package/esm2015/separator/separator.component.js +9 -1
- package/esm2015/signature/signature.component.js +7 -2
- package/esm2015/slider/slider.component.js +1 -1
- package/esm2015/smart-filters/boolean-filter/boolean-filter.component.js +12 -2
- package/esm2015/smart-filters/common/model/base-filter-component.js +40 -10
- package/esm2015/smart-filters/common/model/creator.js +8 -2
- package/esm2015/smart-filters/common/model/field.js +12 -1
- package/esm2015/smart-filters/common/model/operator.js +8 -8
- package/esm2015/smart-filters/common/model/type.js +1 -1
- package/esm2015/smart-filters/date-filter/date-filter.component.js +45 -2
- package/esm2015/smart-filters/filter-builder/common/model/filter.js +2 -0
- package/esm2015/smart-filters/filter-builder/common/model/legacy.js +2 -0
- package/esm2015/smart-filters/filter-builder/common/model/operator-unit.js +42 -0
- package/esm2015/smart-filters/filter-builder/common/model/operator.js +207 -0
- package/esm2015/smart-filters/filter-builder/common/model/type-map.js +27 -0
- package/esm2015/smart-filters/filter-builder/common/model/type.js +6 -0
- package/esm2015/smart-filters/filter-builder/common/pipes/filter-item-counter.pipe.js +18 -0
- package/esm2015/smart-filters/filter-builder/common/services/output-filter.service.js +132 -0
- package/esm2015/smart-filters/filter-builder/common/services/type-convertor.service.js +44 -0
- package/esm2015/smart-filters/filter-builder/filter-builder-item/filter-builder-item.component.js +106 -0
- package/esm2015/smart-filters/filter-builder/filter-builder-section/filter-builder-section.component.js +50 -0
- package/esm2015/smart-filters/filter-builder/filter-builder.component.js +65 -0
- package/esm2015/smart-filters/filter-builder/filter-builder.service.js +261 -0
- package/esm2015/smart-filters/index.js +5 -0
- package/esm2015/smart-filters/multi-select-filter/multi-select-filter.component.js +53 -14
- package/esm2015/smart-filters/number-filter/number-filter.component.js +25 -2
- package/esm2015/smart-filters/pepperi-addons-ngx-lib-smart-filters.js +8 -1
- package/esm2015/smart-filters/public-api.js +2 -1
- package/esm2015/smart-filters/smart-filters.module.js +14 -2
- package/esm2015/smart-filters/text-filter/text-filter.component.js +79 -0
- package/esm2015/textarea/textarea.component.js +7 -2
- package/esm2015/textbox/textbox.component.js +5 -3
- package/esm2015/top-bar/top-bar.component.js +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-attachment.js +6 -1
- package/fesm2015/pepperi-addons-ngx-lib-attachment.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-checkbox.js +3 -0
- package/fesm2015/pepperi-addons-ngx-lib-checkbox.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-color.js +6 -1
- package/fesm2015/pepperi-addons-ngx-lib-color.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-date.js +3 -0
- package/fesm2015/pepperi-addons-ngx-lib-date.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-form.js +20 -15
- package/fesm2015/pepperi-addons-ngx-lib-form.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-image.js +6 -1
- package/fesm2015/pepperi-addons-ngx-lib-image.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-images-filmstrip.js +6 -1
- package/fesm2015/pepperi-addons-ngx-lib-images-filmstrip.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-list.js +4 -2
- package/fesm2015/pepperi-addons-ngx-lib-list.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-quantity-selector.js +6 -1
- package/fesm2015/pepperi-addons-ngx-lib-quantity-selector.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-rich-html-textarea.js +6 -1
- package/fesm2015/pepperi-addons-ngx-lib-rich-html-textarea.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-select.js +6 -1
- package/fesm2015/pepperi-addons-ngx-lib-select.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-separator.js +8 -0
- package/fesm2015/pepperi-addons-ngx-lib-separator.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-signature.js +6 -1
- package/fesm2015/pepperi-addons-ngx-lib-signature.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-slider.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-smart-filters.js +1293 -128
- package/fesm2015/pepperi-addons-ngx-lib-smart-filters.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-textarea.js +6 -1
- package/fesm2015/pepperi-addons-ngx-lib-textarea.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-textbox.js +4 -2
- package/fesm2015/pepperi-addons-ngx-lib-textbox.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-top-bar.js +1 -1
- package/fesm2015/pepperi-addons-ngx-lib.js +3 -1
- package/fesm2015/pepperi-addons-ngx-lib.js.map +1 -1
- package/form/internal-button.component.d.ts +0 -1
- package/image/image.component.d.ts +1 -0
- package/image/pepperi-addons-ngx-lib-image.metadata.json +1 -1
- package/images-filmstrip/images-filmstrip.component.d.ts +1 -0
- package/images-filmstrip/pepperi-addons-ngx-lib-images-filmstrip.metadata.json +1 -1
- package/list/list-total.component.d.ts +2 -0
- package/list/pepperi-addons-ngx-lib-list.metadata.json +1 -1
- package/package.json +4 -4
- package/pepperi-addons-ngx-lib.metadata.json +1 -1
- package/quantity-selector/pepperi-addons-ngx-lib-quantity-selector.metadata.json +1 -1
- package/quantity-selector/quantity-selector.component.d.ts +1 -0
- package/rich-html-textarea/pepperi-addons-ngx-lib-rich-html-textarea.metadata.json +1 -1
- package/rich-html-textarea/rich-html-textarea.component.d.ts +1 -0
- package/select/pepperi-addons-ngx-lib-select.metadata.json +1 -1
- package/select/select.component.d.ts +1 -0
- package/separator/pepperi-addons-ngx-lib-separator.metadata.json +1 -1
- package/signature/pepperi-addons-ngx-lib-signature.metadata.json +1 -1
- package/signature/signature.component.d.ts +1 -0
- package/smart-filters/boolean-filter/boolean-filter.component.d.ts +5 -1
- package/smart-filters/common/model/base-filter-component.d.ts +10 -1
- package/smart-filters/common/model/field.d.ts +4 -0
- package/smart-filters/common/model/operator.d.ts +1 -0
- package/smart-filters/common/model/type.d.ts +2 -2
- package/smart-filters/date-filter/date-filter.component.d.ts +8 -1
- package/smart-filters/filter-builder/common/model/filter.d.ts +6 -0
- package/smart-filters/filter-builder/common/model/legacy.d.ts +23 -0
- package/smart-filters/filter-builder/common/model/operator-unit.d.ts +13 -0
- package/smart-filters/filter-builder/common/model/operator.d.ts +21 -0
- package/smart-filters/filter-builder/common/model/type-map.d.ts +12 -0
- package/smart-filters/filter-builder/common/model/type.d.ts +4 -0
- package/smart-filters/filter-builder/common/pipes/filter-item-counter.pipe.d.ts +5 -0
- package/smart-filters/filter-builder/common/services/output-filter.service.d.ts +52 -0
- package/smart-filters/filter-builder/common/services/type-convertor.service.d.ts +10 -0
- package/smart-filters/filter-builder/filter-builder-item/filter-builder-item.component.d.ts +32 -0
- package/smart-filters/filter-builder/filter-builder-section/filter-builder-section.component.d.ts +22 -0
- package/smart-filters/filter-builder/filter-builder-section/filter-builder-section.component.theme.scss +6 -0
- package/smart-filters/filter-builder/filter-builder.component.d.ts +22 -0
- package/smart-filters/filter-builder/filter-builder.service.d.ts +90 -0
- package/smart-filters/index.d.ts +1 -0
- package/smart-filters/multi-select-filter/multi-select-filter.component.d.ts +6 -0
- package/smart-filters/number-filter/number-filter.component.d.ts +5 -0
- package/smart-filters/pepperi-addons-ngx-lib-smart-filters.d.ts +7 -0
- package/smart-filters/pepperi-addons-ngx-lib-smart-filters.metadata.json +1 -1
- package/smart-filters/public-api.d.ts +1 -0
- package/smart-filters/text-filter/text-filter.component.d.ts +17 -0
- package/src/assets/i18n/en.ngx-lib.json +2 -1
- package/src/core/style/components/general.scss +4 -2
- package/textarea/pepperi-addons-ngx-lib-textarea.metadata.json +1 -1
- package/textarea/textarea.component.d.ts +1 -0
- package/theming.scss +4 -0
- package/top-bar/pepperi-addons-ngx-lib-top-bar.metadata.json +1 -1
|
@@ -1,8 +1,31 @@
|
|
|
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/
|
|
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/
|
|
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'].
|
|
5
|
-
}(this, (function (exports,
|
|
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);
|
|
6
29
|
|
|
7
30
|
/*! *****************************************************************************
|
|
8
31
|
Copyright (c) Microsoft Corporation.
|
|
@@ -327,8 +350,8 @@
|
|
|
327
350
|
this._useAsWebComponent = false;
|
|
328
351
|
// @Output()
|
|
329
352
|
// filtersClear: EventEmitter<void> = new EventEmitter<void>();
|
|
330
|
-
this.filtersChange = new
|
|
331
|
-
this.fieldToggleChange = new
|
|
353
|
+
this.filtersChange = new i0.EventEmitter();
|
|
354
|
+
this.fieldToggleChange = new i0.EventEmitter();
|
|
332
355
|
this.expansionPanelHeaderHeight = '*';
|
|
333
356
|
}
|
|
334
357
|
Object.defineProperty(PepSmartFiltersComponent.prototype, "filters", {
|
|
@@ -437,30 +460,30 @@
|
|
|
437
460
|
return PepSmartFiltersComponent;
|
|
438
461
|
}());
|
|
439
462
|
PepSmartFiltersComponent.decorators = [
|
|
440
|
-
{ type:
|
|
463
|
+
{ type: i0.Component, args: [{
|
|
441
464
|
selector: 'pep-smart-filters',
|
|
442
465
|
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>",
|
|
443
|
-
changeDetection:
|
|
466
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
444
467
|
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}"]
|
|
445
468
|
},] }
|
|
446
469
|
];
|
|
447
470
|
PepSmartFiltersComponent.ctorParameters = function () { return [
|
|
448
|
-
{ type:
|
|
471
|
+
{ type: i0.ElementRef },
|
|
449
472
|
{ type: ngxLib.PepLayoutService }
|
|
450
473
|
]; };
|
|
451
474
|
PepSmartFiltersComponent.propDecorators = {
|
|
452
|
-
title: [{ type:
|
|
453
|
-
filters: [{ type:
|
|
454
|
-
fields: [{ type:
|
|
455
|
-
useAsWebComponent: [{ type:
|
|
456
|
-
filtersChange: [{ type:
|
|
457
|
-
fieldToggleChange: [{ type:
|
|
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 }]
|
|
458
481
|
};
|
|
459
482
|
|
|
460
483
|
var PepFilterActionsComponent = /** @class */ (function () {
|
|
461
484
|
function PepFilterActionsComponent() {
|
|
462
|
-
this.clearClick = new
|
|
463
|
-
this.applyClick = new
|
|
485
|
+
this.clearClick = new i0.EventEmitter();
|
|
486
|
+
this.applyClick = new i0.EventEmitter();
|
|
464
487
|
}
|
|
465
488
|
PepFilterActionsComponent.prototype.clear = function () {
|
|
466
489
|
this.clearClick.emit();
|
|
@@ -471,16 +494,16 @@
|
|
|
471
494
|
return PepFilterActionsComponent;
|
|
472
495
|
}());
|
|
473
496
|
PepFilterActionsComponent.decorators = [
|
|
474
|
-
{ type:
|
|
497
|
+
{ type: i0.Component, args: [{
|
|
475
498
|
selector: 'pep-filter-actions',
|
|
476
499
|
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>",
|
|
477
500
|
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}"]
|
|
478
501
|
},] }
|
|
479
502
|
];
|
|
480
503
|
PepFilterActionsComponent.propDecorators = {
|
|
481
|
-
form: [{ type:
|
|
482
|
-
clearClick: [{ type:
|
|
483
|
-
applyClick: [{ type:
|
|
504
|
+
form: [{ type: i0.Input }],
|
|
505
|
+
clearClick: [{ type: i0.Output }],
|
|
506
|
+
applyClick: [{ type: i0.Output }]
|
|
484
507
|
};
|
|
485
508
|
|
|
486
509
|
var IPepSmartFilterOperator = /** @class */ (function () {
|
|
@@ -488,7 +511,7 @@
|
|
|
488
511
|
}
|
|
489
512
|
return IPepSmartFilterOperator;
|
|
490
513
|
}());
|
|
491
|
-
var Equals = {
|
|
514
|
+
var Equals$1 = {
|
|
492
515
|
id: 'eq',
|
|
493
516
|
name: 'EQUAL',
|
|
494
517
|
short: '=',
|
|
@@ -502,7 +525,7 @@
|
|
|
502
525
|
// 'select',
|
|
503
526
|
],
|
|
504
527
|
};
|
|
505
|
-
var NotEqual = {
|
|
528
|
+
var NotEqual$1 = {
|
|
506
529
|
id: 'neq',
|
|
507
530
|
name: 'NOT_EQUAL',
|
|
508
531
|
short: '<>',
|
|
@@ -515,7 +538,7 @@
|
|
|
515
538
|
// 'select',
|
|
516
539
|
],
|
|
517
540
|
};
|
|
518
|
-
var LessThan = {
|
|
541
|
+
var LessThan$1 = {
|
|
519
542
|
id: 'lt',
|
|
520
543
|
name: 'LESS_THEN',
|
|
521
544
|
short: '<',
|
|
@@ -527,7 +550,7 @@
|
|
|
527
550
|
// short: '<=',
|
|
528
551
|
// type: ['number'],
|
|
529
552
|
// };
|
|
530
|
-
var GreaterThan = {
|
|
553
|
+
var GreaterThan$1 = {
|
|
531
554
|
id: 'gt',
|
|
532
555
|
name: 'GREATER_THEN',
|
|
533
556
|
short: '>',
|
|
@@ -539,18 +562,18 @@
|
|
|
539
562
|
// short: '>=',
|
|
540
563
|
// type: ['number'],
|
|
541
564
|
// };
|
|
542
|
-
var NumberRange = {
|
|
565
|
+
var NumberRange$1 = {
|
|
543
566
|
id: 'numberRange',
|
|
544
567
|
name: 'NUMBER_RANGE',
|
|
545
568
|
short: 'Range',
|
|
546
569
|
componentType: ['number'],
|
|
547
570
|
};
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
571
|
+
var Contains$1 = {
|
|
572
|
+
id: 'contains',
|
|
573
|
+
name: 'CONTAINS',
|
|
574
|
+
short: 'Contains',
|
|
575
|
+
componentType: ['text'],
|
|
576
|
+
};
|
|
554
577
|
// const BeginsWith: Operator = {
|
|
555
578
|
// id: 'beginsWith',
|
|
556
579
|
// name: 'Begins With',
|
|
@@ -575,138 +598,189 @@
|
|
|
575
598
|
// short: 'Before',
|
|
576
599
|
// type: ['date'],
|
|
577
600
|
// };
|
|
578
|
-
var InTheLast = {
|
|
601
|
+
var InTheLast$1 = {
|
|
579
602
|
id: 'inTheLast',
|
|
580
603
|
name: 'IN_THE_LAST',
|
|
581
604
|
short: 'In the last',
|
|
582
605
|
componentType: ['date'],
|
|
583
606
|
};
|
|
584
|
-
var Today = {
|
|
607
|
+
var Today$1 = {
|
|
585
608
|
id: 'today',
|
|
586
609
|
name: 'TODAY',
|
|
587
610
|
short: 'Today',
|
|
588
611
|
componentType: ['date'],
|
|
589
612
|
};
|
|
590
|
-
var ThisWeek = {
|
|
613
|
+
var ThisWeek$1 = {
|
|
591
614
|
id: 'thisWeek',
|
|
592
615
|
name: 'THIS_WEEK',
|
|
593
616
|
short: 'This week',
|
|
594
617
|
componentType: ['date'],
|
|
595
618
|
};
|
|
596
|
-
var ThisMonth = {
|
|
619
|
+
var ThisMonth$1 = {
|
|
597
620
|
id: 'thisMonth',
|
|
598
621
|
name: 'THIS_MONTH',
|
|
599
622
|
short: 'This month',
|
|
600
623
|
componentType: ['date'],
|
|
601
624
|
};
|
|
602
|
-
var DateRange = {
|
|
625
|
+
var DateRange$1 = {
|
|
603
626
|
id: 'dateRange',
|
|
604
627
|
name: 'DATE_RANGE',
|
|
605
628
|
short: 'Range',
|
|
606
629
|
componentType: ['date'],
|
|
607
630
|
};
|
|
608
|
-
var DueIn = {
|
|
631
|
+
var DueIn$1 = {
|
|
609
632
|
id: 'dueIn',
|
|
610
633
|
name: 'DUE_IN',
|
|
611
634
|
short: 'Due in',
|
|
612
635
|
componentType: ['date'],
|
|
613
636
|
};
|
|
614
|
-
var On = {
|
|
637
|
+
var On$1 = {
|
|
615
638
|
id: 'on',
|
|
616
639
|
name: 'ON',
|
|
617
640
|
short: 'On',
|
|
618
641
|
componentType: ['date'],
|
|
619
642
|
};
|
|
620
|
-
var NotInTheLast = {
|
|
643
|
+
var NotInTheLast$1 = {
|
|
621
644
|
id: 'notInTheLast',
|
|
622
645
|
name: 'NOT_IN_THE_LAST',
|
|
623
646
|
short: 'Not in the last',
|
|
624
647
|
componentType: ['date'],
|
|
625
648
|
};
|
|
626
|
-
var NotDueIn = {
|
|
649
|
+
var NotDueIn$1 = {
|
|
627
650
|
id: 'notDueIn',
|
|
628
651
|
name: 'NOT_DUE_IN',
|
|
629
652
|
short: 'Not due in',
|
|
630
653
|
componentType: ['date'],
|
|
631
654
|
};
|
|
632
|
-
var IsEmpty = {
|
|
655
|
+
var IsEmpty$1 = {
|
|
633
656
|
id: 'isEmpty',
|
|
634
657
|
name: 'IS_EMPTY',
|
|
635
658
|
short: 'Is empty',
|
|
636
659
|
componentType: ['date'],
|
|
637
660
|
};
|
|
638
|
-
var IsNotEmpty = {
|
|
661
|
+
var IsNotEmpty$1 = {
|
|
639
662
|
id: 'isNotEmpty',
|
|
640
663
|
name: 'IS_NOT_EMPTY',
|
|
641
664
|
short: 'Is not empty',
|
|
642
665
|
componentType: ['date'],
|
|
643
666
|
};
|
|
644
|
-
var In = {
|
|
667
|
+
var In$1 = {
|
|
645
668
|
id: 'in',
|
|
646
669
|
name: 'IN',
|
|
647
670
|
short: 'In',
|
|
648
671
|
componentType: ['multi-select'],
|
|
649
672
|
};
|
|
650
673
|
var PepSmartFilterOperators = {
|
|
651
|
-
Equals: Equals,
|
|
652
|
-
NotEqual: NotEqual,
|
|
653
|
-
LessThan: LessThan,
|
|
674
|
+
Equals: Equals$1,
|
|
675
|
+
NotEqual: NotEqual$1,
|
|
676
|
+
LessThan: LessThan$1,
|
|
654
677
|
// LessThanOrEquals: LessThanOrEquals,
|
|
655
|
-
GreaterThan: GreaterThan,
|
|
678
|
+
GreaterThan: GreaterThan$1,
|
|
656
679
|
// GreaterThanOrEquals: GreaterThanOrEquals,
|
|
657
|
-
NumberRange: NumberRange,
|
|
658
|
-
|
|
680
|
+
NumberRange: NumberRange$1,
|
|
681
|
+
Contains: Contains$1,
|
|
659
682
|
// BeginsWith: BeginsWith,
|
|
660
683
|
// EndsWith: EndsWith,
|
|
661
684
|
// After: After,
|
|
662
685
|
// Before: Before,
|
|
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,
|
|
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,
|
|
675
698
|
};
|
|
676
699
|
var IPepSmartFilterOperatorUnit = /** @class */ (function () {
|
|
677
700
|
function IPepSmartFilterOperatorUnit() {
|
|
678
701
|
}
|
|
679
702
|
return IPepSmartFilterOperatorUnit;
|
|
680
703
|
}());
|
|
681
|
-
var Days = {
|
|
704
|
+
var Days$1 = {
|
|
682
705
|
id: 'days',
|
|
683
706
|
name: 'DAYS',
|
|
684
707
|
componentType: ['date'],
|
|
685
708
|
};
|
|
686
|
-
var Weeks = {
|
|
709
|
+
var Weeks$1 = {
|
|
687
710
|
id: 'weeks',
|
|
688
711
|
name: 'WEEKS',
|
|
689
712
|
componentType: ['date'],
|
|
690
713
|
};
|
|
691
|
-
var Months = {
|
|
714
|
+
var Months$1 = {
|
|
692
715
|
id: 'months',
|
|
693
716
|
name: 'MONTHS',
|
|
694
717
|
componentType: ['date'],
|
|
695
718
|
};
|
|
696
|
-
var Years = {
|
|
719
|
+
var Years$1 = {
|
|
697
720
|
id: 'years',
|
|
698
721
|
name: 'YEARS',
|
|
699
722
|
componentType: ['date'],
|
|
700
723
|
};
|
|
701
724
|
var PepSmartFilterOperatorUnits = {
|
|
702
|
-
Days: Days,
|
|
703
|
-
Weeks: Weeks,
|
|
704
|
-
Months: Months,
|
|
705
|
-
Years: Years,
|
|
725
|
+
Days: Days$1,
|
|
726
|
+
Weeks: Weeks$1,
|
|
727
|
+
Months: Months$1,
|
|
728
|
+
Years: Years$1,
|
|
706
729
|
};
|
|
707
730
|
|
|
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
|
+
|
|
708
782
|
var BaseFilterComponent = /** @class */ (function () {
|
|
709
|
-
function BaseFilterComponent(viewContainerRef, injector, resolver, builder, translate, validator, renderer) {
|
|
783
|
+
function BaseFilterComponent(viewContainerRef, injector, resolver, builder, translate, validator, renderer, typeConvertorService) {
|
|
710
784
|
this.viewContainerRef = viewContainerRef;
|
|
711
785
|
this.injector = injector;
|
|
712
786
|
this.resolver = resolver;
|
|
@@ -714,9 +788,14 @@
|
|
|
714
788
|
this.translate = translate;
|
|
715
789
|
this.validator = validator;
|
|
716
790
|
this.renderer = renderer;
|
|
791
|
+
this.typeConvertorService = typeConvertorService;
|
|
717
792
|
this._fieldIdWithNoDots = '';
|
|
718
|
-
this.
|
|
719
|
-
this.
|
|
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();
|
|
720
799
|
this.OPERATORS_TRANSLATION_PREFIX = 'SMART_FILTERS.OPERATORS';
|
|
721
800
|
this.OPERATOR_UNITS_TRANSLATION_PREFIX = 'SMART_FILTERS.OPERATOR_UNITS';
|
|
722
801
|
this._destroyed = new rxjs.Subject();
|
|
@@ -744,6 +823,14 @@
|
|
|
744
823
|
enumerable: false,
|
|
745
824
|
configurable: true
|
|
746
825
|
});
|
|
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
|
+
});
|
|
747
834
|
Object.defineProperty(BaseFilterComponent.prototype, "operator", {
|
|
748
835
|
get: function () {
|
|
749
836
|
return this._operator;
|
|
@@ -772,10 +859,7 @@
|
|
|
772
859
|
},
|
|
773
860
|
set: function (operatorUnit) {
|
|
774
861
|
// Validate operator unit
|
|
775
|
-
if (operatorUnit
|
|
776
|
-
this._operatorUnit = undefined;
|
|
777
|
-
}
|
|
778
|
-
else {
|
|
862
|
+
if (operatorUnit) {
|
|
779
863
|
var index = this.operatorUnits.findIndex(function (ou) { return ou.id === operatorUnit.id; });
|
|
780
864
|
if (index >= 0) {
|
|
781
865
|
this._operatorUnit = this.operatorUnits[index];
|
|
@@ -784,6 +868,9 @@
|
|
|
784
868
|
this._operatorUnit = this.operatorUnits[0];
|
|
785
869
|
}
|
|
786
870
|
}
|
|
871
|
+
else {
|
|
872
|
+
this._operatorUnit = undefined;
|
|
873
|
+
}
|
|
787
874
|
},
|
|
788
875
|
enumerable: false,
|
|
789
876
|
configurable: true
|
|
@@ -829,12 +916,14 @@
|
|
|
829
916
|
var formValue = {};
|
|
830
917
|
formValue[this.firstControlKey] = [];
|
|
831
918
|
formValue[this.secondControlKey] = [];
|
|
832
|
-
// this.form.patchValue(formValue);
|
|
919
|
+
// this.form.patchValue(formValue);
|
|
833
920
|
this.form = this.builder.group(formValue);
|
|
834
921
|
// this.form[this.firstControlKey] = [];
|
|
835
922
|
// this.form[this.secondControlKey] = [];
|
|
836
923
|
this.setupOperators();
|
|
837
|
-
this.
|
|
924
|
+
if (this.showActionButtons) {
|
|
925
|
+
this.createActionsComponent();
|
|
926
|
+
}
|
|
838
927
|
};
|
|
839
928
|
BaseFilterComponent.prototype.setupOperators = function () {
|
|
840
929
|
var _this = this;
|
|
@@ -879,6 +968,16 @@
|
|
|
879
968
|
this.clearFilter(false);
|
|
880
969
|
}
|
|
881
970
|
};
|
|
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
|
+
};
|
|
882
981
|
BaseFilterComponent.prototype.getDestroyer = function () {
|
|
883
982
|
return operators.takeUntil(this._destroyed);
|
|
884
983
|
};
|
|
@@ -893,8 +992,8 @@
|
|
|
893
992
|
};
|
|
894
993
|
// Set default validators - some childs override this.
|
|
895
994
|
BaseFilterComponent.prototype.setFieldsStateAndValidators = function () {
|
|
896
|
-
this.firstControl.setValidators(
|
|
897
|
-
this.secondControl.setValidators(
|
|
995
|
+
this.firstControl.setValidators(i1.Validators.required);
|
|
996
|
+
this.secondControl.setValidators(i1.Validators.required);
|
|
898
997
|
this.secondControl.disable();
|
|
899
998
|
};
|
|
900
999
|
// Return undefined - some childs override this.
|
|
@@ -943,34 +1042,123 @@
|
|
|
943
1042
|
BaseFilterComponent.prototype.ngOnDestroy = function () {
|
|
944
1043
|
this._destroyed.next();
|
|
945
1044
|
this._destroyed.complete();
|
|
946
|
-
this.
|
|
1045
|
+
if (this.showActionButtons) {
|
|
1046
|
+
this.actionsContainerRef.destroy();
|
|
1047
|
+
}
|
|
947
1048
|
};
|
|
948
1049
|
return BaseFilterComponent;
|
|
949
1050
|
}());
|
|
950
1051
|
BaseFilterComponent.decorators = [
|
|
951
|
-
{ type:
|
|
1052
|
+
{ type: i0.Directive, args: [{},] }
|
|
952
1053
|
];
|
|
953
1054
|
BaseFilterComponent.ctorParameters = function () { return [
|
|
954
|
-
{ type:
|
|
955
|
-
{ type:
|
|
956
|
-
{ type:
|
|
957
|
-
{ type:
|
|
958
|
-
{ type: core
|
|
1055
|
+
{ type: i0.ViewContainerRef },
|
|
1056
|
+
{ type: i0.Injector },
|
|
1057
|
+
{ type: i0.ComponentFactoryResolver },
|
|
1058
|
+
{ type: i1.FormBuilder },
|
|
1059
|
+
{ type: core.TranslateService },
|
|
959
1060
|
{ type: ngxLib.PepValidatorService },
|
|
960
|
-
{ type:
|
|
1061
|
+
{ type: i0.Renderer2 },
|
|
1062
|
+
{ type: PepTypeConvertorService }
|
|
961
1063
|
]; };
|
|
962
1064
|
BaseFilterComponent.propDecorators = {
|
|
963
|
-
field: [{ type:
|
|
964
|
-
filter: [{ type:
|
|
965
|
-
|
|
966
|
-
|
|
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 }]
|
|
967
1074
|
};
|
|
968
1075
|
|
|
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
|
+
|
|
969
1155
|
var PepBooleanFilterComponent = /** @class */ (function (_super) {
|
|
970
1156
|
__extends(PepBooleanFilterComponent, _super);
|
|
971
1157
|
function PepBooleanFilterComponent() {
|
|
972
1158
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
973
1159
|
}
|
|
1160
|
+
PepBooleanFilterComponent.prototype.ngOnInit = function () {
|
|
1161
|
+
};
|
|
974
1162
|
// Override
|
|
975
1163
|
PepBooleanFilterComponent.prototype.getDefaultOperator = function () {
|
|
976
1164
|
return PepSmartFilterOperators.Equals;
|
|
@@ -980,12 +1168,20 @@
|
|
|
980
1168
|
var filterValue = { first: this.firstControl.value || false };
|
|
981
1169
|
return filterValue;
|
|
982
1170
|
};
|
|
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
|
+
};
|
|
983
1179
|
return PepBooleanFilterComponent;
|
|
984
1180
|
}(BaseFilterComponent));
|
|
985
1181
|
PepBooleanFilterComponent.decorators = [
|
|
986
|
-
{ type:
|
|
1182
|
+
{ type: i0.Component, args: [{
|
|
987
1183
|
selector: 'pep-boolean-filter',
|
|
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>",
|
|
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>",
|
|
989
1185
|
styles: [".radio-group{display:flex;flex-direction:column}.radio-group .pep-radio-button.pep-input{height:2.25rem;display:flex}"]
|
|
990
1186
|
},] }
|
|
991
1187
|
];
|
|
@@ -999,6 +1195,11 @@
|
|
|
999
1195
|
_this.chooseTimeUnitOptions = [];
|
|
1000
1196
|
return _this;
|
|
1001
1197
|
}
|
|
1198
|
+
PepDateFilterComponent.prototype.ngOnInit = function () {
|
|
1199
|
+
if (this.inline) {
|
|
1200
|
+
this.setControlsWidth();
|
|
1201
|
+
}
|
|
1202
|
+
};
|
|
1002
1203
|
// Override
|
|
1003
1204
|
PepDateFilterComponent.prototype.getDefaultOperator = function () {
|
|
1004
1205
|
return PepSmartFilterOperators.InTheLast;
|
|
@@ -1045,16 +1246,16 @@
|
|
|
1045
1246
|
PepDateFilterComponent.prototype.setFieldsStateAndValidators = function () {
|
|
1046
1247
|
this.firstControl.enable();
|
|
1047
1248
|
if (this.operator === PepSmartFilterOperators.DateRange) {
|
|
1048
|
-
this.firstControl.setValidators(
|
|
1249
|
+
this.firstControl.setValidators(i1.Validators.required);
|
|
1049
1250
|
this.secondControl.enable();
|
|
1050
|
-
this.secondControl.setValidators(
|
|
1251
|
+
this.secondControl.setValidators(i1.Validators.required);
|
|
1051
1252
|
}
|
|
1052
1253
|
else if (this.operator === PepSmartFilterOperators.InTheLast ||
|
|
1053
1254
|
this.operator === PepSmartFilterOperators.NotInTheLast ||
|
|
1054
1255
|
this.operator === PepSmartFilterOperators.DueIn ||
|
|
1055
1256
|
this.operator === PepSmartFilterOperators.NotDueIn) {
|
|
1056
1257
|
this.firstControl.setValidators([
|
|
1057
|
-
|
|
1258
|
+
i1.Validators.required,
|
|
1058
1259
|
this.validator.numberValidator(),
|
|
1059
1260
|
]);
|
|
1060
1261
|
this.secondControl.disable();
|
|
@@ -1072,21 +1273,59 @@
|
|
|
1072
1273
|
_super.prototype.setFieldsStateAndValidators.call(this);
|
|
1073
1274
|
}
|
|
1074
1275
|
};
|
|
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
|
+
};
|
|
1075
1294
|
PepDateFilterComponent.prototype.onOperatorChanged = function (value) {
|
|
1076
1295
|
var operator = Object.values(PepSmartFilterOperators).find(function (operator) { return operator.id === value; });
|
|
1077
1296
|
this.operator = operator;
|
|
1078
1297
|
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
|
+
}
|
|
1079
1307
|
};
|
|
1080
1308
|
PepDateFilterComponent.prototype.onTimeUnitChanged = function (value) {
|
|
1081
1309
|
var operatorUnit = Object.values(PepSmartFilterOperatorUnits).find(function (operatorUnit) { return operatorUnit.id === value; });
|
|
1082
1310
|
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
|
+
}
|
|
1083
1322
|
};
|
|
1084
1323
|
return PepDateFilterComponent;
|
|
1085
1324
|
}(BaseFilterComponent));
|
|
1086
1325
|
PepDateFilterComponent.decorators = [
|
|
1087
|
-
{ type:
|
|
1326
|
+
{ type: i0.Component, args: [{
|
|
1088
1327
|
selector: 'pep-date-filter',
|
|
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
|
|
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>",
|
|
1090
1329
|
styles: [""]
|
|
1091
1330
|
},] }
|
|
1092
1331
|
];
|
|
@@ -1102,15 +1341,39 @@
|
|
|
1102
1341
|
function PepMultiSelectFilterComponent() {
|
|
1103
1342
|
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
1104
1343
|
_this.options = [];
|
|
1105
|
-
_this.searchControl = new
|
|
1344
|
+
_this.searchControl = new i1.FormControl();
|
|
1345
|
+
//inline props
|
|
1346
|
+
_this.selected = '';
|
|
1347
|
+
_this.inlineOptions = [];
|
|
1106
1348
|
_this.MAX_OPTIONS_TO_SHOW = 6.35;
|
|
1107
1349
|
_this.numberOptionsToShowSearch = 10;
|
|
1108
1350
|
return _this;
|
|
1109
1351
|
}
|
|
1110
1352
|
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 () {
|
|
1111
1375
|
var _this = this;
|
|
1112
1376
|
var _a;
|
|
1113
|
-
_super.prototype.ngOnInit;
|
|
1114
1377
|
if (((_a = this.field.options) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
1115
1378
|
this.options = this.field.options.map(function (opt) {
|
|
1116
1379
|
return { value: opt.value, count: opt.count, selected: false };
|
|
@@ -1141,10 +1404,6 @@
|
|
|
1141
1404
|
}, 125);
|
|
1142
1405
|
});
|
|
1143
1406
|
};
|
|
1144
|
-
PepMultiSelectFilterComponent.prototype.ngAfterViewInit = function () {
|
|
1145
|
-
// Calc for the first time.
|
|
1146
|
-
this.calcOptionsHeight(this.options.length);
|
|
1147
|
-
};
|
|
1148
1407
|
PepMultiSelectFilterComponent.prototype.initOptionsSelectedValues = function (selectedValues) {
|
|
1149
1408
|
this.options.forEach(function (opt) {
|
|
1150
1409
|
var isValueSelected = selectedValues && selectedValues.includes(opt.value);
|
|
@@ -1172,13 +1431,20 @@
|
|
|
1172
1431
|
};
|
|
1173
1432
|
// Override
|
|
1174
1433
|
PepMultiSelectFilterComponent.prototype.getFilterValue = function () {
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
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
|
+
}
|
|
1182
1448
|
};
|
|
1183
1449
|
// Override
|
|
1184
1450
|
PepMultiSelectFilterComponent.prototype.initFilter = function () {
|
|
@@ -1189,18 +1455,30 @@
|
|
|
1189
1455
|
option.selected = event.checked;
|
|
1190
1456
|
this.firstControl.setValue(this.options.filter(function (opt) { return opt.selected; }).map(function (opt) { return opt.value; }), { emitEvent: false });
|
|
1191
1457
|
};
|
|
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
|
+
};
|
|
1192
1470
|
return PepMultiSelectFilterComponent;
|
|
1193
1471
|
}(BaseFilterComponent));
|
|
1194
1472
|
PepMultiSelectFilterComponent.decorators = [
|
|
1195
|
-
{ type:
|
|
1473
|
+
{ type: i0.Component, args: [{
|
|
1196
1474
|
selector: 'pep-multi-select-filter',
|
|
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>",
|
|
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>",
|
|
1198
1476
|
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)}"]
|
|
1199
1477
|
},] }
|
|
1200
1478
|
];
|
|
1201
1479
|
PepMultiSelectFilterComponent.propDecorators = {
|
|
1202
|
-
optionsContainer: [{ type:
|
|
1203
|
-
virtualScroller: [{ type:
|
|
1480
|
+
optionsContainer: [{ type: i0.ViewChild, args: ['optionsContainer',] }],
|
|
1481
|
+
virtualScroller: [{ type: i0.ViewChild, args: [ngxVirtualScroller.VirtualScrollerComponent,] }]
|
|
1204
1482
|
};
|
|
1205
1483
|
|
|
1206
1484
|
var PepNumberFilterComponent = /** @class */ (function (_super) {
|
|
@@ -1209,6 +1487,8 @@
|
|
|
1209
1487
|
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
1210
1488
|
_this.PepSmartFilterOperators = PepSmartFilterOperators;
|
|
1211
1489
|
_this.chooseTypeOptions = [];
|
|
1490
|
+
_this.operatorWidth = '38%';
|
|
1491
|
+
_this.firstControlWidth = '62%';
|
|
1212
1492
|
return _this;
|
|
1213
1493
|
}
|
|
1214
1494
|
PepNumberFilterComponent.prototype.ngOnInit = function () {
|
|
@@ -1223,6 +1503,7 @@
|
|
|
1223
1503
|
.subscribe(function () {
|
|
1224
1504
|
_this.setFieldsStateAndValidators();
|
|
1225
1505
|
});
|
|
1506
|
+
this.setControlsWidth();
|
|
1226
1507
|
};
|
|
1227
1508
|
// Override
|
|
1228
1509
|
PepNumberFilterComponent.prototype.getDefaultOperator = function () {
|
|
@@ -1251,13 +1532,13 @@
|
|
|
1251
1532
|
// Override
|
|
1252
1533
|
PepNumberFilterComponent.prototype.setFieldsStateAndValidators = function () {
|
|
1253
1534
|
if (this.operator === PepSmartFilterOperators.NumberRange) {
|
|
1254
|
-
var firstValidators = [
|
|
1535
|
+
var firstValidators = [i1.Validators.required];
|
|
1255
1536
|
if (this.secondControl.value) {
|
|
1256
1537
|
firstValidators.push(this.validator.isLessThan(this.secondControl));
|
|
1257
1538
|
}
|
|
1258
1539
|
this.firstControl.setValidators(firstValidators);
|
|
1259
1540
|
this.secondControl.enable();
|
|
1260
|
-
var secondValidators = [
|
|
1541
|
+
var secondValidators = [i1.Validators.required];
|
|
1261
1542
|
if (this.firstControl.value) {
|
|
1262
1543
|
secondValidators.push(this.validator.isGreaterThan(this.firstControl));
|
|
1263
1544
|
}
|
|
@@ -1267,72 +1548,40 @@
|
|
|
1267
1548
|
_super.prototype.setFieldsStateAndValidators.call(this);
|
|
1268
1549
|
}
|
|
1269
1550
|
};
|
|
1551
|
+
PepNumberFilterComponent.prototype.setControlsWidth = function () {
|
|
1552
|
+
if (this.operator === PepSmartFilterOperators.NumberRange) {
|
|
1553
|
+
this.operatorWidth = '30%';
|
|
1554
|
+
}
|
|
1555
|
+
else {
|
|
1556
|
+
this.operatorWidth = '38%';
|
|
1557
|
+
}
|
|
1558
|
+
};
|
|
1270
1559
|
PepNumberFilterComponent.prototype.onOperatorChanged = function (value) {
|
|
1271
1560
|
var operator = Object.values(PepSmartFilterOperators).find(function (operator) { return operator.id === value; });
|
|
1272
1561
|
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
|
+
}
|
|
1273
1574
|
};
|
|
1274
1575
|
return PepNumberFilterComponent;
|
|
1275
1576
|
}(BaseFilterComponent));
|
|
1276
1577
|
PepNumberFilterComponent.decorators = [
|
|
1277
|
-
{ type:
|
|
1578
|
+
{ type: i0.Component, args: [{
|
|
1278
1579
|
selector: 'pep-number-filter',
|
|
1279
|
-
template: "<div [formGroup]=\"form\">\n <ng-container>\n <pep-select [key]=\"'typeOperator'\" [value]=\"operator.id\"
|
|
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>",
|
|
1280
1581
|
styles: [""]
|
|
1281
1582
|
},] }
|
|
1282
1583
|
];
|
|
1283
1584
|
|
|
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
|
-
|
|
1336
1585
|
// Base field
|
|
1337
1586
|
// ------------------------------
|
|
1338
1587
|
var PepSmartFilterBaseField = /** @class */ (function () {
|
|
@@ -1361,6 +1610,20 @@
|
|
|
1361
1610
|
});
|
|
1362
1611
|
return PepSmartFilterBaseField;
|
|
1363
1612
|
}());
|
|
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));
|
|
1364
1627
|
// Boolean field
|
|
1365
1628
|
// ------------------------------
|
|
1366
1629
|
var PepSmartFilterBooleanField = /** @class */ (function (_super) {
|
|
@@ -1472,6 +1735,9 @@
|
|
|
1472
1735
|
return PepSmartFilterPercentageField;
|
|
1473
1736
|
}(PepSmartFilterNumberBaseField));
|
|
1474
1737
|
|
|
1738
|
+
function createTextSmartFilterField(data) {
|
|
1739
|
+
return new PepSmartFilterTextField(data);
|
|
1740
|
+
}
|
|
1475
1741
|
function createBooleanSmartFilterField(data) {
|
|
1476
1742
|
return new PepSmartFilterBooleanField(data);
|
|
1477
1743
|
}
|
|
@@ -1499,6 +1765,9 @@
|
|
|
1499
1765
|
function createSmartFilterField(data, type) {
|
|
1500
1766
|
var field;
|
|
1501
1767
|
switch (type) {
|
|
1768
|
+
case 'text':
|
|
1769
|
+
field = createTextSmartFilterField(data);
|
|
1770
|
+
break;
|
|
1502
1771
|
case 'boolean':
|
|
1503
1772
|
field = createBooleanSmartFilterField(data);
|
|
1504
1773
|
break;
|
|
@@ -1541,6 +1810,987 @@
|
|
|
1541
1810
|
};
|
|
1542
1811
|
}
|
|
1543
1812
|
|
|
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
|
+
|
|
1544
2794
|
/*
|
|
1545
2795
|
* Public API Surface of ngx-lib/smart-filters
|
|
1546
2796
|
*/
|
|
@@ -1550,6 +2800,7 @@
|
|
|
1550
2800
|
*/
|
|
1551
2801
|
|
|
1552
2802
|
exports.BaseFilterComponent = BaseFilterComponent;
|
|
2803
|
+
exports.FilterBuilderComponent = FilterBuilderComponent;
|
|
1553
2804
|
exports.IPepSmartFilterOperator = IPepSmartFilterOperator;
|
|
1554
2805
|
exports.IPepSmartFilterOperatorUnit = IPepSmartFilterOperatorUnit;
|
|
1555
2806
|
exports.PepBooleanFilterComponent = PepBooleanFilterComponent;
|
|
@@ -1570,10 +2821,18 @@
|
|
|
1570
2821
|
exports.PepSmartFilterOperators = PepSmartFilterOperators;
|
|
1571
2822
|
exports.PepSmartFilterPercentageField = PepSmartFilterPercentageField;
|
|
1572
2823
|
exports.PepSmartFilterRealField = PepSmartFilterRealField;
|
|
2824
|
+
exports.PepSmartFilterTextField = PepSmartFilterTextField;
|
|
1573
2825
|
exports.PepSmartFiltersComponent = PepSmartFiltersComponent;
|
|
1574
2826
|
exports.PepSmartFiltersModule = PepSmartFiltersModule;
|
|
1575
2827
|
exports.createSmartFilter = createSmartFilter;
|
|
1576
2828
|
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;
|
|
1577
2836
|
|
|
1578
2837
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1579
2838
|
|