@firestitch/filter 12.13.2 → 13.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/app/components/filters-item/autocomplete/autocomplete.component.d.ts +2 -1
  2. package/app/components/filters-item/autocompletechips/autocompletechips.component.d.ts +1 -5
  3. package/app/models/items/autocomplete/base-autocomplete-item.d.ts +1 -1
  4. package/app/models/items/base-item.d.ts +1 -1
  5. package/{esm2015/app/classes/actions-controller.js → esm2020/app/classes/actions-controller.mjs} +4 -4
  6. package/esm2020/app/components/action-button/action-button.component.mjs +24 -0
  7. package/esm2020/app/components/action-kebab-actions/action-kebab-actions.component.mjs +17 -0
  8. package/esm2020/app/components/actions/actions.component.mjs +26 -0
  9. package/esm2020/app/components/filter/filter.component.mjs +572 -0
  10. package/esm2020/app/components/filter-chip/filter-chip.component.mjs +86 -0
  11. package/{esm2015/app/components/filter-chip-content/filter-chip-content.component.js → esm2020/app/components/filter-chip-content/filter-chip-content.component.mjs} +5 -10
  12. package/esm2020/app/components/filter-chips/filter-chips.component.mjs +23 -0
  13. package/esm2020/app/components/filter-drawer/filter-drawer.component.mjs +71 -0
  14. package/esm2020/app/components/filter-drawer-actions/filter-drawer-actions.component.mjs +41 -0
  15. package/esm2020/app/components/filters-item/autocomplete/autocomplete.component.mjs +27 -0
  16. package/esm2020/app/components/filters-item/autocompletechips/autocompletechips.component.mjs +42 -0
  17. package/{esm2015/app/components/filters-item/base-item/base-item.component.js → esm2020/app/components/filters-item/base-item/base-item.component.mjs} +4 -4
  18. package/esm2020/app/components/filters-item/checkbox/checkbox.component.mjs +21 -0
  19. package/esm2020/app/components/filters-item/chips/chips.component.mjs +28 -0
  20. package/esm2020/app/components/filters-item/date/date.component.mjs +43 -0
  21. package/esm2020/app/components/filters-item/date-range/date-range.component.mjs +34 -0
  22. package/esm2020/app/components/filters-item/filter-item.component.mjs +80 -0
  23. package/esm2020/app/components/filters-item/range/range.component.mjs +45 -0
  24. package/esm2020/app/components/filters-item/select/backdrop/backdrop.component.mjs +12 -0
  25. package/esm2020/app/components/filters-item/select/groups/groups.component.mjs +30 -0
  26. package/esm2020/app/components/filters-item/select/multiple/multiple.component.mjs +57 -0
  27. package/esm2020/app/components/filters-item/select/select.component.mjs +51 -0
  28. package/esm2020/app/components/filters-item/select/simple/simple.component.mjs +43 -0
  29. package/esm2020/app/components/filters-item/text/text.component.mjs +49 -0
  30. package/esm2020/app/components/filters-item/week/week.component.mjs +25 -0
  31. package/esm2020/app/components/saved-filter-edit/saved-filter-edit.component.mjs +55 -0
  32. package/esm2020/app/components/saved-filters-menu/saved-filters-menu.component.mjs +51 -0
  33. package/{esm2015/app/directives/focus-to-item/focus-to-item.directive.js → esm2020/app/directives/focus-to-item/focus-to-item.directive.mjs} +4 -4
  34. package/{esm2015/app/directives/status-bar/status-bar.directive.js → esm2020/app/directives/status-bar/status-bar.directive.mjs} +4 -4
  35. package/{esm2015/app/fs-filter.module.js → esm2020/app/fs-filter.module.mjs} +10 -7
  36. package/esm2020/app/models/action.model.mjs +108 -0
  37. package/esm2020/app/models/filter-config.mjs +66 -0
  38. package/esm2020/app/models/items/autocomplete/base-autocomplete-item.mjs +14 -0
  39. package/esm2020/app/models/items/autocomplete-chips-item.mjs +61 -0
  40. package/{esm2015/app/models/items/autocomplete-item.js → esm2020/app/models/items/autocomplete-item.mjs} +2 -2
  41. package/{esm2015/app/models/items/base-item.js → esm2020/app/models/items/base-item.mjs} +6 -8
  42. package/{esm2015/app/models/items/checkbox-item.js → esm2020/app/models/items/checkbox-item.mjs} +2 -2
  43. package/{esm2015/app/models/items/chips-item.js → esm2020/app/models/items/chips-item.mjs} +2 -2
  44. package/{esm2015/app/models/items/date-item.js → esm2020/app/models/items/date-item.mjs} +2 -2
  45. package/esm2020/app/models/items/date-range/base-date-range-item.mjs +135 -0
  46. package/esm2020/app/models/items/date-time-item.mjs +10 -0
  47. package/esm2020/app/models/items/range-item.mjs +83 -0
  48. package/esm2020/app/models/items/select/base-select-item.mjs +37 -0
  49. package/esm2020/app/models/items/select/multiple-select-item.mjs +88 -0
  50. package/esm2020/app/models/items/select/simple-select-item.mjs +66 -0
  51. package/{esm2015/app/models/items/text-item.js → esm2020/app/models/items/text-item.mjs} +2 -2
  52. package/esm2020/app/models/items/week-item.mjs +94 -0
  53. package/{esm2015/app/pipes/remove-isolate-value.pipe.js → esm2020/app/pipes/remove-isolate-value.pipe.mjs} +4 -4
  54. package/esm2020/app/services/external-params/persistance-params-controller.service.mjs +58 -0
  55. package/{esm2015/app/services/external-params/query-params-controller.service.js → esm2020/app/services/external-params/query-params-controller.service.mjs} +4 -4
  56. package/esm2020/app/services/external-params/saved-filters-controller.service.mjs +164 -0
  57. package/esm2020/app/services/external-params-controller.service.mjs +162 -0
  58. package/{esm2015/app/services/filter-overlay.service.js → esm2020/app/services/filter-overlay.service.mjs} +4 -4
  59. package/{esm2015/app/services/focus-controller.service.js → esm2020/app/services/focus-controller.service.mjs} +4 -4
  60. package/esm2020/app/services/items-store.service.mjs +337 -0
  61. package/fesm2015/{firestitch-filter.js → firestitch-filter.mjs} +965 -1082
  62. package/fesm2015/firestitch-filter.mjs.map +1 -0
  63. package/fesm2020/firestitch-filter.mjs +4444 -0
  64. package/fesm2020/firestitch-filter.mjs.map +1 -0
  65. package/package.json +20 -7
  66. package/bundles/firestitch-filter.umd.js +0 -5753
  67. package/bundles/firestitch-filter.umd.js.map +0 -1
  68. package/esm2015/app/components/action-button/action-button.component.js +0 -28
  69. package/esm2015/app/components/action-kebab-actions/action-kebab-actions.component.js +0 -22
  70. package/esm2015/app/components/actions/actions.component.js +0 -31
  71. package/esm2015/app/components/filter/filter.component.js +0 -577
  72. package/esm2015/app/components/filter-chip/filter-chip.component.js +0 -91
  73. package/esm2015/app/components/filter-chips/filter-chips.component.js +0 -27
  74. package/esm2015/app/components/filter-drawer/filter-drawer.component.js +0 -76
  75. package/esm2015/app/components/filter-drawer-actions/filter-drawer-actions.component.js +0 -44
  76. package/esm2015/app/components/filters-item/autocomplete/autocomplete.component.js +0 -30
  77. package/esm2015/app/components/filters-item/autocompletechips/autocompletechips.component.js +0 -52
  78. package/esm2015/app/components/filters-item/checkbox/checkbox.component.js +0 -25
  79. package/esm2015/app/components/filters-item/chips/chips.component.js +0 -32
  80. package/esm2015/app/components/filters-item/date/date.component.js +0 -46
  81. package/esm2015/app/components/filters-item/date-range/date-range.component.js +0 -37
  82. package/esm2015/app/components/filters-item/filter-item.component.js +0 -84
  83. package/esm2015/app/components/filters-item/range/range.component.js +0 -48
  84. package/esm2015/app/components/filters-item/select/backdrop/backdrop.component.js +0 -17
  85. package/esm2015/app/components/filters-item/select/groups/groups.component.js +0 -33
  86. package/esm2015/app/components/filters-item/select/multiple/multiple.component.js +0 -61
  87. package/esm2015/app/components/filters-item/select/select.component.js +0 -55
  88. package/esm2015/app/components/filters-item/select/simple/simple.component.js +0 -47
  89. package/esm2015/app/components/filters-item/text/text.component.js +0 -54
  90. package/esm2015/app/components/filters-item/week/week.component.js +0 -28
  91. package/esm2015/app/components/saved-filter-edit/saved-filter-edit.component.js +0 -55
  92. package/esm2015/app/components/saved-filters-menu/saved-filters-menu.component.js +0 -58
  93. package/esm2015/app/models/action.model.js +0 -109
  94. package/esm2015/app/models/filter-config.js +0 -67
  95. package/esm2015/app/models/items/autocomplete/base-autocomplete-item.js +0 -15
  96. package/esm2015/app/models/items/autocomplete-chips-item.js +0 -62
  97. package/esm2015/app/models/items/date-range/base-date-range-item.js +0 -137
  98. package/esm2015/app/models/items/date-time-item.js +0 -10
  99. package/esm2015/app/models/items/range-item.js +0 -84
  100. package/esm2015/app/models/items/select/base-select-item.js +0 -34
  101. package/esm2015/app/models/items/select/multiple-select-item.js +0 -89
  102. package/esm2015/app/models/items/select/simple-select-item.js +0 -66
  103. package/esm2015/app/models/items/week-item.js +0 -94
  104. package/esm2015/app/services/external-params/persistance-params-controller.service.js +0 -58
  105. package/esm2015/app/services/external-params/saved-filters-controller.service.js +0 -165
  106. package/esm2015/app/services/external-params-controller.service.js +0 -163
  107. package/esm2015/app/services/items-store.service.js +0 -341
  108. package/fesm2015/firestitch-filter.js.map +0 -1
  109. /package/{esm2015/app/consts/query-param-delimiter.js → esm2020/app/consts/query-param-delimiter.mjs} +0 -0
  110. /package/{esm2015/app/enums/action-mode.enum.js → esm2020/app/enums/action-mode.enum.mjs} +0 -0
  111. /package/{esm2015/app/enums/action-type.enum.js → esm2020/app/enums/action-type.enum.mjs} +0 -0
  112. /package/{esm2015/app/enums/button-style.js → esm2020/app/enums/button-style.mjs} +0 -0
  113. /package/{esm2015/app/enums/index.js → esm2020/app/enums/index.mjs} +0 -0
  114. /package/{esm2015/app/enums/item-date-mode.enum.js → esm2020/app/enums/item-date-mode.enum.mjs} +0 -0
  115. /package/{esm2015/app/enums/item-type.enum.js → esm2020/app/enums/item-type.enum.mjs} +0 -0
  116. /package/{esm2015/app/enums/picker-view-type.enum.js → esm2020/app/enums/picker-view-type.enum.mjs} +0 -0
  117. /package/{esm2015/app/helpers/build-query-params.js → esm2020/app/helpers/build-query-params.mjs} +0 -0
  118. /package/{esm2015/app/helpers/compare.js → esm2020/app/helpers/compare.mjs} +0 -0
  119. /package/{esm2015/app/helpers/create-filter-item.js → esm2020/app/helpers/create-filter-item.mjs} +0 -0
  120. /package/{esm2015/app/helpers/find-value.js → esm2020/app/helpers/find-value.mjs} +0 -0
  121. /package/{esm2015/app/helpers/get-range-name.js → esm2020/app/helpers/get-range-name.mjs} +0 -0
  122. /package/{esm2015/app/helpers/parse-date.js → esm2020/app/helpers/parse-date.mjs} +0 -0
  123. /package/{esm2015/app/helpers/parse-item-value-from-stored.js → esm2020/app/helpers/parse-item-value-from-stored.mjs} +0 -0
  124. /package/{esm2015/app/helpers/query-param-transformers.js → esm2020/app/helpers/query-param-transformers.mjs} +0 -0
  125. /package/{esm2015/app/helpers/restore-items.js → esm2020/app/helpers/restore-items.mjs} +0 -0
  126. /package/{esm2015/app/helpers/try-convert-to-number.js → esm2020/app/helpers/try-convert-to-number.mjs} +0 -0
  127. /package/{esm2015/app/injectors/filter-config.js → esm2020/app/injectors/filter-config.mjs} +0 -0
  128. /package/{esm2015/app/injectors/filter-drawer-data.js → esm2020/app/injectors/filter-drawer-data.mjs} +0 -0
  129. /package/{esm2015/app/injectors/filter-drawer-overlay.js → esm2020/app/injectors/filter-drawer-overlay.mjs} +0 -0
  130. /package/{esm2015/app/interfaces/action.interface.js → esm2020/app/interfaces/action.interface.mjs} +0 -0
  131. /package/{esm2015/app/interfaces/config.interface.js → esm2020/app/interfaces/config.interface.mjs} +0 -0
  132. /package/{esm2015/app/interfaces/external-params.interface.js → esm2020/app/interfaces/external-params.interface.mjs} +0 -0
  133. /package/{esm2015/app/interfaces/filter.interface.js → esm2020/app/interfaces/filter.interface.mjs} +0 -0
  134. /package/{esm2015/app/interfaces/items/autocomplete-chips.interface.js → esm2020/app/interfaces/items/autocomplete-chips.interface.mjs} +0 -0
  135. /package/{esm2015/app/interfaces/items/autocomplete.interface.js → esm2020/app/interfaces/items/autocomplete.interface.mjs} +0 -0
  136. /package/{esm2015/app/interfaces/items/base.interface.js → esm2020/app/interfaces/items/base.interface.mjs} +0 -0
  137. /package/{esm2015/app/interfaces/items/checkbox.interface.js → esm2020/app/interfaces/items/checkbox.interface.mjs} +0 -0
  138. /package/{esm2015/app/interfaces/items/chips.interface.js → esm2020/app/interfaces/items/chips.interface.mjs} +0 -0
  139. /package/{esm2015/app/interfaces/items/date-range.interface.js → esm2020/app/interfaces/items/date-range.interface.mjs} +0 -0
  140. /package/{esm2015/app/interfaces/items/date.interface.js → esm2020/app/interfaces/items/date.interface.mjs} +0 -0
  141. /package/{esm2015/app/interfaces/items/range.interface.js → esm2020/app/interfaces/items/range.interface.mjs} +0 -0
  142. /package/{esm2015/app/interfaces/items/select.interface.js → esm2020/app/interfaces/items/select.interface.mjs} +0 -0
  143. /package/{esm2015/app/interfaces/items/text.interface.js → esm2020/app/interfaces/items/text.interface.mjs} +0 -0
  144. /package/{esm2015/app/interfaces/items/week.interface.js → esm2020/app/interfaces/items/week.interface.mjs} +0 -0
  145. /package/{esm2015/app/interfaces/saved-filters.interface.js → esm2020/app/interfaces/saved-filters.interface.mjs} +0 -0
  146. /package/{esm2015/app/interfaces/update-filter-item.interface.js → esm2020/app/interfaces/update-filter-item.interface.mjs} +0 -0
  147. /package/{esm2015/app/models/action-menu-item.model.js → esm2020/app/models/action-menu-item.model.mjs} +0 -0
  148. /package/{esm2015/app/models/items/date/base-date-item.js → esm2020/app/models/items/date/base-date-item.mjs} +0 -0
  149. /package/{esm2015/app/models/items/date-range-item.js → esm2020/app/models/items/date-range-item.mjs} +0 -0
  150. /package/{esm2015/app/models/items/date-time-range-item.js → esm2020/app/models/items/date-time-range-item.mjs} +0 -0
  151. /package/{esm2015/app/models/items/select-item.js → esm2020/app/models/items/select-item.mjs} +0 -0
  152. /package/{esm2015/app/providers/filter-meta.js → esm2020/app/providers/filter-meta.mjs} +0 -0
  153. /package/{esm2015/firestitch-filter.js → esm2020/firestitch-filter.mjs} +0 -0
  154. /package/{esm2015/public_api.js → esm2020/public_api.mjs} +0 -0
@@ -0,0 +1,4444 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, Optional, Component, ChangeDetectionStrategy, Inject, Input, EventEmitter, Output, InjectionToken, Directive, Self, Pipe, ViewChild, HostListener, ViewEncapsulation, ContentChild, HostBinding, NgModule } from '@angular/core';
3
+ import { BehaviorSubject, Subject, isObservable, forkJoin, of, timer, combineLatest, fromEvent, merge } from 'rxjs';
4
+ import { tap, finalize, take, takeUntil, debounceTime, filter as filter$1, distinctUntilChanged, switchMap, mapTo, startWith, map, delay, skip } from 'rxjs/operators';
5
+ import { filter, isArrayEqual, list, isEmpty, getNormalizedPath, remove, FsCommonModule } from '@firestitch/common';
6
+ import { isObject, isFunction, clone, isString, toString, pickBy } from 'lodash-es';
7
+ import * as i3 from '@angular/common';
8
+ import { CommonModule } from '@angular/common';
9
+ import * as i1$1 from '@angular/router';
10
+ import { RouterModule } from '@angular/router';
11
+ import * as i1$2 from '@angular/material/dialog';
12
+ import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
13
+ import * as i6 from '@firestitch/drawer';
14
+ import * as i1 from '@firestitch/store';
15
+ import { FsPersistanceStore, FsStoreModule, FsStore } from '@firestitch/store';
16
+ import { simpleFormat, format } from '@firestitch/date';
17
+ import { parseISO, isValid, isDate } from 'date-fns';
18
+ import * as i3$4 from '@firestitch/datepicker';
19
+ import { formatPeriodObject, FsDatePickerModule } from '@firestitch/datepicker';
20
+ import * as i1$3 from '@angular/material/form-field';
21
+ import * as i2 from '@angular/material/select';
22
+ import { MatSelectModule } from '@angular/material/select';
23
+ import * as i3$1 from '@angular/material/core';
24
+ import * as i1$4 from '@angular/material/button';
25
+ import { MatButtonModule } from '@angular/material/button';
26
+ import * as i4 from '@angular/forms';
27
+ import { FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
28
+ import * as i7 from '@firestitch/form';
29
+ import { FsFormModule } from '@firestitch/form';
30
+ import * as i3$2 from '@angular/material/input';
31
+ import { MatInput, MatInputModule } from '@angular/material/input';
32
+ import { ComponentPortal, PortalInjector, PortalModule } from '@angular/cdk/portal';
33
+ import { MatAutocompleteModule } from '@angular/material/autocomplete';
34
+ import * as i4$3 from '@angular/material/checkbox';
35
+ import { MatCheckboxModule } from '@angular/material/checkbox';
36
+ import { MatChipsModule } from '@angular/material/chips';
37
+ import * as i2$1 from '@angular/material/icon';
38
+ import { MatIconModule } from '@angular/material/icon';
39
+ import * as i4$2 from '@firestitch/autocomplete';
40
+ import { FsAutocompleteModule } from '@firestitch/autocomplete';
41
+ import * as i5 from '@firestitch/autocomplete-chips';
42
+ import { FsAutocompleteChipsModule } from '@firestitch/autocomplete-chips';
43
+ import * as i2$2 from '@firestitch/chip';
44
+ import { FsChipModule } from '@firestitch/chip';
45
+ import * as i8 from '@firestitch/clear';
46
+ import { FsClearModule } from '@firestitch/clear';
47
+ import * as i4$1 from '@firestitch/file';
48
+ import { FsFileModule } from '@firestitch/file';
49
+ import * as i1$5 from '@firestitch/label';
50
+ import { FsLabelModule } from '@firestitch/label';
51
+ import * as i3$3 from '@firestitch/menu';
52
+ import { FsMenuModule } from '@firestitch/menu';
53
+ import * as i7$1 from '@firestitch/popover';
54
+ import { FsPopoverModule } from '@firestitch/popover';
55
+ import { FsScrollModule } from '@firestitch/scroll';
56
+ import * as i6$1 from '@firestitch/skeleton';
57
+ import { FsSkeletonModule } from '@firestitch/skeleton';
58
+ import * as i1$6 from '@angular/cdk/overlay';
59
+ import { OverlayConfig } from '@angular/cdk/overlay';
60
+ import * as i1$7 from '@angular/cdk/layout';
61
+
62
+ const QUERY_PARAM_DELIMITER = ':';
63
+
64
+ function filterToQueryParam(value, name) {
65
+ return `${encodeURIComponent(value)}${QUERY_PARAM_DELIMITER}${encodeURIComponent(name)}`;
66
+ }
67
+ function filterFromQueryParam(param) {
68
+ const parts = param.split(QUERY_PARAM_DELIMITER);
69
+ return [decodeURIComponent(parts[0]), decodeURIComponent(parts[1])];
70
+ }
71
+
72
+ function objectsAreEquals(obj1, obj2) {
73
+ const oldKeys = Object.keys(obj1);
74
+ const currKeys = Object.keys(obj2);
75
+ if (oldKeys.length !== currKeys.length) {
76
+ return false;
77
+ }
78
+ for (const key in obj1) {
79
+ if (obj1.hasOwnProperty(key)) {
80
+ const oldItem = obj1[key];
81
+ const currItem = obj2[key];
82
+ const isArrays = Array.isArray(oldItem) && Array.isArray(currItem);
83
+ const isObjects = isObject(oldItem) && isObject(currItem);
84
+ if (isArrays && !arraysAreEquals(oldItem, currItem)) {
85
+ return false;
86
+ }
87
+ else if (isObjects && !objectsAreEquals(oldItem, currItem)) {
88
+ return false;
89
+ }
90
+ else if (!isArrays && !isObjects && oldItem !== currItem) {
91
+ return false;
92
+ }
93
+ }
94
+ }
95
+ return true;
96
+ }
97
+ function arraysAreEquals(arr1, arr2) {
98
+ if (arr1.length !== arr2.length) {
99
+ return false;
100
+ }
101
+ for (const el of arr1) {
102
+ if (arr2.indexOf(el) === -1) {
103
+ return false;
104
+ }
105
+ }
106
+ return true;
107
+ }
108
+
109
+ var ItemType;
110
+ (function (ItemType) {
111
+ ItemType["Text"] = "text";
112
+ ItemType["Select"] = "select";
113
+ ItemType["Range"] = "range";
114
+ ItemType["Date"] = "date";
115
+ ItemType["DateTime"] = "datetime";
116
+ ItemType["DateRange"] = "daterange";
117
+ ItemType["Week"] = "week";
118
+ ItemType["DateTimeRange"] = "datetimerange";
119
+ ItemType["AutoComplete"] = "autocomplete";
120
+ ItemType["AutoCompleteChips"] = "autocompletechips";
121
+ ItemType["Checkbox"] = "checkbox";
122
+ ItemType["Chips"] = "chips";
123
+ ItemType["Keyword"] = "keyword";
124
+ })(ItemType || (ItemType = {}));
125
+
126
+ class BaseItem {
127
+ constructor(itemConfig, _additionalConfig, _filter) {
128
+ this._additionalConfig = _additionalConfig;
129
+ this._filter = _filter;
130
+ this._pendingValues = false;
131
+ this._pendingDefaultValue = false;
132
+ this._loading$ = new BehaviorSubject(false);
133
+ this._value$ = new BehaviorSubject(null);
134
+ this._valueChange$ = new Subject();
135
+ this._values$ = new BehaviorSubject(null);
136
+ this._destroy$ = new Subject();
137
+ this._clear$ = new Subject();
138
+ this._type = itemConfig.type;
139
+ this._parseConfig(itemConfig);
140
+ }
141
+ get filter() {
142
+ return this._filter;
143
+ }
144
+ ///
145
+ get isTypeAutocomplete() {
146
+ return this.type === ItemType.AutoComplete;
147
+ }
148
+ get isTypeAutocompleteChips() {
149
+ return this.type === ItemType.AutoCompleteChips;
150
+ }
151
+ get isTypeChips() {
152
+ return this.type === ItemType.Chips;
153
+ }
154
+ get isTypeCheckbox() {
155
+ return this.type === ItemType.Checkbox;
156
+ }
157
+ get isTypeSelect() {
158
+ return this.type === ItemType.Select;
159
+ }
160
+ get isTypeDate() {
161
+ return this.type === ItemType.Date;
162
+ }
163
+ get isTypeDateRange() {
164
+ return this.type === ItemType.DateRange;
165
+ }
166
+ get isTypeRange() {
167
+ return this.type === ItemType.Range;
168
+ }
169
+ get isTypeDateTimeRange() {
170
+ return this.type === ItemType.DateTimeRange;
171
+ }
172
+ get isTypeDateTime() {
173
+ return this.type === ItemType.DateTime;
174
+ }
175
+ get isTypeKeyword() {
176
+ return this.type === ItemType.Keyword;
177
+ }
178
+ ////
179
+ get isChipVisible() {
180
+ return !!this.model;
181
+ }
182
+ get destroy$() {
183
+ return this._destroy$.asObservable();
184
+ }
185
+ get type() {
186
+ return this._type;
187
+ }
188
+ get hasPendingValues() {
189
+ return this._pendingValues;
190
+ }
191
+ get hasPendingDefaultValue() {
192
+ return this._pendingDefaultValue;
193
+ }
194
+ get model() {
195
+ return this._model;
196
+ }
197
+ set model(value) {
198
+ this._setModel(value);
199
+ this.valueChanged();
200
+ }
201
+ set values(values) {
202
+ this._values$.next(values);
203
+ }
204
+ get values() {
205
+ return this._values$.getValue();
206
+ }
207
+ get values$() {
208
+ return this._values$.asObservable();
209
+ }
210
+ get valueChange$() {
211
+ return this._valueChange$.asObservable();
212
+ }
213
+ get value$() {
214
+ return this._value$.asObservable();
215
+ }
216
+ get clear$() {
217
+ return this._clear$.asObservable();
218
+ }
219
+ get initialized() {
220
+ return this._initialized;
221
+ }
222
+ get loading$() {
223
+ return this._loading$.asObservable();
224
+ }
225
+ get loading() {
226
+ return this._loading$.getValue();
227
+ }
228
+ set loading(value) {
229
+ this._loading$.next(value);
230
+ }
231
+ get _initialized() {
232
+ return !this._pendingDefaultValue && !this._pendingValues;
233
+ }
234
+ valueChanged() {
235
+ this._value$.next(this.value);
236
+ if (this.change) {
237
+ this.change(this, this._filter);
238
+ }
239
+ if (this.initialized) {
240
+ this._valueChange$.next();
241
+ }
242
+ }
243
+ get queryObject() {
244
+ const value = this.value;
245
+ const name = this.name;
246
+ const params = {};
247
+ if (Array.isArray(value)) {
248
+ params[this.name] = value.join(',');
249
+ }
250
+ else {
251
+ params[name] = value;
252
+ }
253
+ return params;
254
+ }
255
+ get persistanceObject() {
256
+ return this.queryObject;
257
+ }
258
+ loadDefaultValue() {
259
+ this._pendingDefaultValue = true;
260
+ return this.defaultValueFn()
261
+ .pipe(tap((value) => {
262
+ this.defaultValue = value;
263
+ this._initDefaultModel();
264
+ }), finalize(() => {
265
+ this._pendingDefaultValue = false;
266
+ }));
267
+ }
268
+ initValues(persistedValue) {
269
+ // this._initialized = false;
270
+ this.persistedValue = persistedValue;
271
+ this._initDefaultModel();
272
+ const isAutocomplete = this.type === ItemType.AutoComplete || this.type === ItemType.AutoCompleteChips;
273
+ if (this._valuesFn && !isAutocomplete) {
274
+ const valuesResult = this._valuesFn(null, this._filter);
275
+ if (isObservable(valuesResult)) {
276
+ this._pendingValues = true;
277
+ }
278
+ else {
279
+ this.values = valuesResult;
280
+ // Move to some other place
281
+ this._init();
282
+ // this._initialized = true;
283
+ }
284
+ }
285
+ else {
286
+ this._init();
287
+ // this._initialized = true;
288
+ }
289
+ }
290
+ loadAsyncValues(reload = true) {
291
+ if (reload || (!this.loading && this.hasPendingValues)) {
292
+ this.loading = true;
293
+ this._valuesFn(null, this._filter)
294
+ .pipe(take(1), takeUntil(this._destroy$))
295
+ .subscribe((values) => {
296
+ this.values = values;
297
+ this._pendingValues = false;
298
+ this.loading = false;
299
+ this._init();
300
+ this._validateModel();
301
+ // this._initialized = true;
302
+ });
303
+ }
304
+ }
305
+ clear(defaultValue = undefined) {
306
+ if (this.isTypeRange || this.isTypeDateRange || this.isTypeDateTimeRange) {
307
+ console.warn(`
308
+ Filter ${this.name} can not be cleared with .clear() method!
309
+ Use special .clearRange() or clearDateRange() instead.
310
+ `);
311
+ }
312
+ this._clear$.next(defaultValue);
313
+ this._clearValue(defaultValue);
314
+ }
315
+ getChipsContent(type) {
316
+ return '';
317
+ }
318
+ destroy() {
319
+ this._destroy$.next();
320
+ this._destroy$.complete();
321
+ }
322
+ _setModel(value) {
323
+ this._model = value;
324
+ }
325
+ _parseConfig(item) {
326
+ this.name = item.name;
327
+ this.label = item.label;
328
+ this.chipLabel = item.chipLabel;
329
+ if (typeof item.default === 'function') {
330
+ this.defaultValueFn = item.default;
331
+ }
332
+ else {
333
+ this.defaultValue = item.default;
334
+ }
335
+ this.change = item.change;
336
+ this.init = item.init || ((_) => {
337
+ //
338
+ });
339
+ this.hide = item.hide;
340
+ this.showClear = item.clear ?? true;
341
+ this.persistanceDisabled = item.disablePersist ?? false;
342
+ this.queryParamsDisabled = item.disableQueryParams ?? false;
343
+ if (isFunction(item.values)) {
344
+ this._valuesFn = item.values;
345
+ }
346
+ else {
347
+ this.values = item.values;
348
+ }
349
+ }
350
+ _initDefaultModel() {
351
+ const model = this.persistedValue ?? this.defaultValue;
352
+ if (model !== undefined) {
353
+ this._setModel(model);
354
+ }
355
+ }
356
+ _clearValue(defaultValue = undefined) {
357
+ this.model = defaultValue ?? undefined;
358
+ }
359
+ }
360
+
361
+ class BaseSelectItem extends BaseItem {
362
+ _parseConfig(item) {
363
+ this.multiple = item.multiple;
364
+ this.children = item.children;
365
+ // TODO nullish
366
+ if (item.isolate) {
367
+ this.isolate = {
368
+ ...item.isolate,
369
+ enabled: false,
370
+ };
371
+ }
372
+ super._parseConfig(item);
373
+ }
374
+ _init() {
375
+ if (!Array.isArray(this.values)) {
376
+ this.values = [];
377
+ }
378
+ // TODO Refactor
379
+ if (this.isolate) {
380
+ this.values = this.values.filter((item) => {
381
+ if (Array.isArray(this.isolate.value)) {
382
+ return this.isolate.value.indexOf(item.value) === -1;
383
+ }
384
+ else {
385
+ return item.value !== this.isolate.value;
386
+ }
387
+ });
388
+ }
389
+ }
390
+ _clearValue(defaultValue = undefined) {
391
+ if (this.isolate) {
392
+ this.isolate.enabled = false;
393
+ }
394
+ }
395
+ }
396
+
397
+ class MultipleSelectItem extends BaseSelectItem {
398
+ constructor(itemConfig, _persistedValues, _filter) {
399
+ super(itemConfig, _persistedValues, _filter);
400
+ }
401
+ get value() {
402
+ let value = clone(this.model);
403
+ if (this.isolateOptionNotSelected) {
404
+ value = this.values?.map((v) => v.value);
405
+ }
406
+ else if (!Array.isArray(value) || value.length === 0 || value.indexOf('__all') > -1) {
407
+ value = undefined;
408
+ }
409
+ return value;
410
+ }
411
+ get isChipVisible() {
412
+ return Array.isArray(this.model) && this.model.length > 0;
413
+ }
414
+ get isolateOptionNotSelected() {
415
+ const modelValue = this.model;
416
+ const isolate = this.isolate;
417
+ return isolate && !isolate.enabled && modelValue?.length === 0;
418
+ }
419
+ getChipsContent(type = null) {
420
+ const options = this.model.reduce((acc, key) => {
421
+ const itemValue = this.values.find((val) => val.value === key);
422
+ let itemLabel;
423
+ if (itemValue) {
424
+ itemLabel = itemValue.name;
425
+ }
426
+ else if (this.isolate && this.isolate.enabled) {
427
+ itemLabel = this.isolate.label;
428
+ }
429
+ if (!acc.includes(itemLabel)) {
430
+ acc.push(itemLabel);
431
+ }
432
+ return acc;
433
+ }, []);
434
+ return options.join(', ');
435
+ }
436
+ _init() {
437
+ super._init();
438
+ const values = this.values.map((itemv) => itemv.value);
439
+ const wrongDefaultValue = !this.model && !Array.isArray(this.defaultValue);
440
+ /**
441
+ * When multiple select is in isolate mode and have no options selected
442
+ * it should send to the server all it's possible values,
443
+ * but should not show them as selected in interfaces as well as in query params & persistance
444
+ *
445
+ * Code below prevents filling model with values from query params if query params contain all possible values
446
+ */
447
+ const isolate = !wrongDefaultValue
448
+ && !this.isolateOptionNotSelected
449
+ && arraysAreEquals(this.model, values);
450
+ if (wrongDefaultValue || isolate) {
451
+ this.model = [];
452
+ }
453
+ }
454
+ _setModel(value) {
455
+ if (Array.isArray(value)) {
456
+ value = value.map((val) => {
457
+ if (isNaN(val)) {
458
+ return val;
459
+ }
460
+ return +val;
461
+ });
462
+ }
463
+ super._setModel(value);
464
+ }
465
+ _validateModel() {
466
+ const possibleValues = filter(this.model || [], (item) => {
467
+ return this.values.find((value) => {
468
+ return value.value === item;
469
+ });
470
+ });
471
+ if (!isArrayEqual(this.model, possibleValues)) {
472
+ this.model = possibleValues;
473
+ }
474
+ }
475
+ _clearValue(defaultValue = undefined) {
476
+ super._clearValue(defaultValue);
477
+ this.model = defaultValue ?? [];
478
+ }
479
+ }
480
+
481
+ function buildQueryParams(flattenedParams, items) {
482
+ items.forEach(filterItem => {
483
+ if (filterItem instanceof MultipleSelectItem && filterItem.isolate) {
484
+ if (filterItem.multiple && filterItem.value) {
485
+ const isolated = list(filterItem.values, 'value').sort();
486
+ const value = filterItem.value.sort();
487
+ if (arraysAreEquals(value, isolated)) {
488
+ flattenedParams[filterItem.name] = null;
489
+ }
490
+ }
491
+ }
492
+ if (filterItem.isTypeAutocomplete) {
493
+ if (isObject(filterItem.model)) {
494
+ flattenedParams[filterItem.name] = filterToQueryParam(filterItem.model.value, filterItem.model.name);
495
+ }
496
+ }
497
+ else if (filterItem.isTypeAutocompleteChips || filterItem.isTypeChips) {
498
+ if (Array.isArray(filterItem.model) && filterItem.model.length) {
499
+ flattenedParams[filterItem.name] = filterItem.model.map((item) => {
500
+ return filterToQueryParam(item.value, item.name);
501
+ }).join(',');
502
+ }
503
+ }
504
+ });
505
+ return flattenedParams;
506
+ }
507
+
508
+ function getRangeName(configCase, name, range) {
509
+ if (configCase === 'snake') {
510
+ return name.concat('_').concat(range);
511
+ }
512
+ if (configCase === 'camel') {
513
+ return name.concat(range.charAt(0).toUpperCase()).concat(range.slice(1));
514
+ }
515
+ }
516
+
517
+ class RangeItem extends BaseItem {
518
+ static create(config, additionalConfig, filter) {
519
+ return new RangeItem(config, additionalConfig, filter);
520
+ }
521
+ get value() {
522
+ let value = clone(this.model);
523
+ if (!isObject(this.model) ||
524
+ (isEmpty(this.model.max, { zero: true }) && isEmpty(this.model.min, { zero: true }))) {
525
+ value = undefined;
526
+ }
527
+ return value;
528
+ }
529
+ get queryObject() {
530
+ const value = this.value;
531
+ const name = this.name;
532
+ const params = {};
533
+ const paramMinName = getRangeName(this.case, name, 'min');
534
+ const paramMaxName = getRangeName(this.case, name, 'max');
535
+ if (isObject(value)) {
536
+ params[paramMinName] = value.min || undefined;
537
+ params[paramMaxName] = value.max || undefined;
538
+ }
539
+ else {
540
+ params[paramMinName] = undefined;
541
+ params[paramMaxName] = undefined;
542
+ }
543
+ return params;
544
+ }
545
+ get isChipVisible() {
546
+ return this.model && (this.model.min !== undefined || this.model.max !== undefined);
547
+ }
548
+ getChipsContent(type) {
549
+ if (type === 'from') {
550
+ const min = this.model.min;
551
+ return `${min}`;
552
+ }
553
+ else if (type === 'to') {
554
+ const max = this.model.max;
555
+ return `${max}`;
556
+ }
557
+ }
558
+ clearRange(type = null, defaultValue = undefined) {
559
+ if (type === 'from') {
560
+ delete this.model.min;
561
+ if (defaultValue?.min) {
562
+ this.model.min = defaultValue.min;
563
+ }
564
+ this.model = { ...this.model };
565
+ }
566
+ else if (type === 'to') {
567
+ delete this.model.max;
568
+ if (defaultValue?.max) {
569
+ this.model.max = defaultValue.max;
570
+ }
571
+ this.model = { ...this.model };
572
+ }
573
+ else {
574
+ this.model = defaultValue ? { ...defaultValue } : {};
575
+ }
576
+ }
577
+ _validateModel() {
578
+ }
579
+ _parseConfig(item) {
580
+ this.options = item.options;
581
+ this.prefix = item.prefix;
582
+ this.suffix = item.suffix;
583
+ this.case = this._additionalConfig?.case ?? 'camel';
584
+ super._parseConfig(item);
585
+ }
586
+ _init() {
587
+ if (!this.label) {
588
+ this.label = ['Min', 'Max'];
589
+ }
590
+ if (!this.model) {
591
+ this.model = this.defaultValue || {};
592
+ }
593
+ }
594
+ }
595
+
596
+ class BaseDateRangeItem extends BaseItem {
597
+ get isTypeDateRange() {
598
+ return this.type === ItemType.DateRange;
599
+ }
600
+ get isTypeDateTimeRange() {
601
+ return this.type === ItemType.DateTimeRange;
602
+ }
603
+ get isChipVisible() {
604
+ return this.model && (this.model.from !== undefined || this.model.to !== undefined);
605
+ }
606
+ get value() {
607
+ let value = clone(this.model);
608
+ if (!isObject(this.model) ||
609
+ (isEmpty(this.model.from, { zero: true }) && isEmpty(this.model.to, { zero: true }))) {
610
+ value = undefined;
611
+ }
612
+ if (isEmpty(value, { zero: true })) {
613
+ return undefined;
614
+ }
615
+ let from = value.from;
616
+ let to = value.to;
617
+ value = {};
618
+ if (from) {
619
+ if (isString(from)) {
620
+ from = parseISO(from);
621
+ }
622
+ if (isValid(from) && isDate(from)) {
623
+ value.from = from;
624
+ }
625
+ }
626
+ if (to) {
627
+ if (isString(to)) {
628
+ to = parseISO(to);
629
+ }
630
+ if (isValid(to) && isDate(to)) {
631
+ value.to = to;
632
+ }
633
+ }
634
+ return value;
635
+ }
636
+ get queryObject() {
637
+ const value = this.value || {};
638
+ const name = this.name;
639
+ const paramFromName = getRangeName(this.case, name, 'from');
640
+ const paramToName = getRangeName(this.case, name, 'to');
641
+ return {
642
+ [paramFromName]: value.from || undefined,
643
+ [paramToName]: value.to || undefined,
644
+ };
645
+ }
646
+ get persistanceObject() {
647
+ const query = this.queryObject;
648
+ return Object.keys(this.queryObject)
649
+ .reduce((acc, key) => {
650
+ if (!!query[key]) {
651
+ acc[key] = simpleFormat(query[key]);
652
+ }
653
+ else {
654
+ acc[key] = query[key];
655
+ }
656
+ return acc;
657
+ }, {});
658
+ }
659
+ getChipsContent(type = null) {
660
+ const formatTo = this.type === ItemType.DateRange ? 'date' : 'date-time';
661
+ if (type === 'from') {
662
+ const from = this.model.from;
663
+ return `${format(from, formatTo)}`;
664
+ }
665
+ else if (type === 'to') {
666
+ const to = this.model.to;
667
+ return `${format(to, formatTo)}`;
668
+ }
669
+ }
670
+ clearDateRange(type = null, defaultValue = undefined) {
671
+ if (type === 'from') {
672
+ delete this.model.from;
673
+ if (defaultValue?.from) {
674
+ this.model.from = defaultValue.from;
675
+ }
676
+ this.model = { ...this.model };
677
+ }
678
+ else if (type === 'to') {
679
+ delete this.model.to;
680
+ if (defaultValue?.to) {
681
+ this.model.to = defaultValue.to;
682
+ }
683
+ this.model = { ...this.model };
684
+ }
685
+ else {
686
+ if (defaultValue) {
687
+ this.model = { ...defaultValue };
688
+ }
689
+ else {
690
+ this.model = {};
691
+ }
692
+ }
693
+ }
694
+ _validateModel() {
695
+ }
696
+ _setModel(value) {
697
+ if (value) {
698
+ if (value.from && (!isDate(value.from) || !isValid(value.from))) {
699
+ value.from = parseISO(value.from);
700
+ }
701
+ if (value.to && (!isDate(value.to) || !isValid(value.to))) {
702
+ value.to = parseISO(value.to);
703
+ }
704
+ }
705
+ super._setModel(value);
706
+ }
707
+ _parseConfig(item) {
708
+ this.case = this._additionalConfig?.case ?? 'camel';
709
+ super._parseConfig(item);
710
+ }
711
+ _init() {
712
+ if (!this.label) {
713
+ this.label = ['Date From', 'Date To'];
714
+ }
715
+ if (!this.model) {
716
+ this.model = this.defaultValue || {};
717
+ }
718
+ }
719
+ _clearValue(defaultValue = undefined) {
720
+ this.model = this.defaultValue ?? {};
721
+ }
722
+ }
723
+
724
+ class DateRangeItem extends BaseDateRangeItem {
725
+ static create(config, filter) {
726
+ return new DateRangeItem(config, null, filter);
727
+ }
728
+ }
729
+
730
+ class DateTimeRangeItem extends BaseDateRangeItem {
731
+ static create(config, filter) {
732
+ return new DateTimeRangeItem(config, null, filter);
733
+ }
734
+ }
735
+
736
+ function tryConvertToNumber(val) {
737
+ return isNaN(val)
738
+ ? val
739
+ : +val;
740
+ }
741
+
742
+ function parseItemValueFromStored(item, params, paramCase) {
743
+ const param = params[item.name];
744
+ switch (item.type) {
745
+ case ItemType.Range: {
746
+ const min = params[getRangeName(paramCase, item.name, 'min')];
747
+ const max = params[getRangeName(paramCase, item.name, 'max')];
748
+ return { min: min, max: max };
749
+ }
750
+ case ItemType.DateRange:
751
+ case ItemType.DateTimeRange: {
752
+ const from = params[getRangeName(item.case, item.name, 'from')];
753
+ const to = params[getRangeName(item.case, item.name, 'to')];
754
+ return { from: from, to: to };
755
+ }
756
+ case ItemType.Week: {
757
+ const from = params[getRangeName('camel', item.name, 'from')];
758
+ const to = params[getRangeName('camel', item.name, 'to')];
759
+ const period = params[`${item.name}Period`];
760
+ return { from, to, period };
761
+ }
762
+ case ItemType.Select: {
763
+ if (item.multiple && !!param) {
764
+ const values = param.split(',');
765
+ if (item.isolate) {
766
+ const isolatedValue = Array.isArray(item.isolate.value)
767
+ ? item.isolate.value
768
+ : [item.isolate.value];
769
+ item.isolate.enabled = arraysHaveSameElements(isolatedValue, values);
770
+ return item.isolate.enabled
771
+ ? isolatedValue
772
+ : values;
773
+ }
774
+ return values;
775
+ }
776
+ else {
777
+ return param;
778
+ }
779
+ }
780
+ case ItemType.Checkbox: {
781
+ if (param === 'true') {
782
+ return true === item.checked;
783
+ }
784
+ else {
785
+ return param === item.checked;
786
+ }
787
+ }
788
+ case ItemType.AutoComplete: {
789
+ const filterParts = filterFromQueryParam(param);
790
+ return {
791
+ name: filterParts[1],
792
+ value: tryConvertToNumber(filterParts[0])
793
+ };
794
+ }
795
+ case ItemType.AutoCompleteChips:
796
+ case ItemType.Chips: {
797
+ const filterParts = param.split(',');
798
+ return filterParts.reduce((arry, value) => {
799
+ const chipParts = filterFromQueryParam(value);
800
+ arry.push({
801
+ name: chipParts[1],
802
+ value: tryConvertToNumber(chipParts[0]),
803
+ });
804
+ return arry;
805
+ }, []);
806
+ }
807
+ default: {
808
+ return param;
809
+ }
810
+ }
811
+ }
812
+ function arraysHaveSameElements(arr1, arr2) {
813
+ arr1 = [...arr1].sort();
814
+ arr2 = [...arr2].sort();
815
+ return arr1.some((item) => {
816
+ return arr2.includes(item);
817
+ });
818
+ }
819
+
820
+ function parseDate(value) {
821
+ if (value && (!isDate(value) || !isValid(value))) {
822
+ return parseISO(value);
823
+ }
824
+ return value;
825
+ }
826
+
827
+ class WeekItem extends BaseItem {
828
+ static create(config, filter) {
829
+ return new WeekItem(config, null, filter);
830
+ }
831
+ get value() {
832
+ let value = clone(this.model);
833
+ if (!isObject(this.model) ||
834
+ (isEmpty(this.model.from, { zero: true }) && isEmpty(this.model.to, { zero: true }))) {
835
+ value = undefined;
836
+ }
837
+ if (isEmpty(value, { zero: true })) {
838
+ return undefined;
839
+ }
840
+ let from = value.from;
841
+ let to = value.to;
842
+ const period = value.period;
843
+ value = {};
844
+ if (from) {
845
+ if (isString(from)) {
846
+ from = parseISO(from);
847
+ }
848
+ if (isValid(from) && isDate(from)) {
849
+ value.from = from;
850
+ }
851
+ }
852
+ if (to) {
853
+ if (isString(to)) {
854
+ to = parseISO(to);
855
+ }
856
+ if (isValid(to) && isDate(to)) {
857
+ value.to = to;
858
+ }
859
+ }
860
+ if (period) {
861
+ value.period = isString(period) ? parseInt(period, 10) : period;
862
+ }
863
+ return value;
864
+ }
865
+ get queryObject() {
866
+ const value = this.value;
867
+ const name = this.name;
868
+ const paramFromName = getRangeName('camel', name, 'from');
869
+ const paramToName = getRangeName('camel', name, 'to');
870
+ const paramPeriodName = `${name}Period`;
871
+ return {
872
+ [paramFromName]: value?.from || undefined,
873
+ [paramToName]: value?.to || undefined,
874
+ [paramPeriodName]: value?.period || undefined,
875
+ };
876
+ }
877
+ get persistanceObject() {
878
+ const query = this.queryObject;
879
+ const name = this.name;
880
+ const paramFromName = getRangeName('camel', name, 'from');
881
+ const paramFromValue = query[paramFromName] && simpleFormat(query[paramFromName]) || query[paramFromName];
882
+ const paramToName = getRangeName('camel', name, 'to');
883
+ const paramToValue = query[paramToName] && simpleFormat(query[paramToName]) || query[paramToName];
884
+ const paramPeriodName = `${name}Period`;
885
+ return {
886
+ [paramFromName]: paramFromValue,
887
+ [paramToName]: paramToValue,
888
+ [paramPeriodName]: query[paramPeriodName],
889
+ };
890
+ }
891
+ getChipsContent(type = null) {
892
+ return formatPeriodObject(this.value);
893
+ }
894
+ _validateModel() { }
895
+ _setModel(value) {
896
+ if (value) {
897
+ value.from = parseDate(value.from);
898
+ value.to = parseDate(value.to);
899
+ value.period = parseInt(value.period, 10) || undefined;
900
+ }
901
+ super._setModel(value);
902
+ }
903
+ _parseConfig(item) {
904
+ super._parseConfig(item);
905
+ this.seedDate = item.seedDate;
906
+ }
907
+ _init() { }
908
+ _clearValue(defaultValue = undefined) {
909
+ this.model = defaultValue ?? undefined;
910
+ }
911
+ }
912
+
913
+ /**
914
+ * We need this function because when we store persisted/query/remote filter values
915
+ * it stores with different format, ex.: Range will be stored as RangeFrom && RangeTo
916
+ * and in this case we don't know how to restroe those values.
917
+ *
918
+ * This function do convertation for those kinds of stored values
919
+ *
920
+ * @param params
921
+ * @param items
922
+ * @param paramsCase
923
+ */
924
+ function restoreItems(params, items, paramsCase) {
925
+ const result = {};
926
+ Object.keys(params)
927
+ .forEach((name) => {
928
+ const item = findItemWidthName(items, name);
929
+ if (item) {
930
+ result[item.name] = parseItemValueFromStored(item, params, paramsCase);
931
+ }
932
+ });
933
+ return result;
934
+ }
935
+ function findItemWidthName(items, name) {
936
+ return items
937
+ .find((filterItem) => {
938
+ if (filterItem instanceof RangeItem) {
939
+ return name === getRangeName(filterItem.case, filterItem.name, 'min') ||
940
+ name === getRangeName(filterItem.case, filterItem.name, 'max') ||
941
+ name === filterItem.name;
942
+ }
943
+ else if (filterItem instanceof DateRangeItem || filterItem instanceof DateTimeRangeItem) {
944
+ return name === getRangeName(filterItem.case, filterItem.name, 'from') ||
945
+ name === getRangeName(filterItem.case, filterItem.name, 'to');
946
+ }
947
+ else if (filterItem instanceof WeekItem) {
948
+ return name === getRangeName('camel', filterItem.name, 'from')
949
+ || name === getRangeName('camel', filterItem.name, 'to')
950
+ || name === `${filterItem.name}Period`;
951
+ }
952
+ return filterItem.name === name;
953
+ });
954
+ }
955
+
956
+ class BaseAutocompleteItem extends BaseItem {
957
+ get valuesFn() {
958
+ return this._valuesFn;
959
+ }
960
+ _validateModel() {
961
+ //
962
+ }
963
+ _parseConfig(item) {
964
+ this.fetchOnFocus = item.fetchOnFocus ?? true;
965
+ super._parseConfig(item);
966
+ }
967
+ }
968
+
969
+ class AutocompleteChipsItem extends BaseAutocompleteItem {
970
+ static create(config, filter) {
971
+ return new AutocompleteChipsItem(config, null, filter);
972
+ }
973
+ get value() {
974
+ if (Array.isArray(this.model) && this.model.length === 0) {
975
+ return undefined;
976
+ }
977
+ return clone(this.model);
978
+ }
979
+ get queryObject() {
980
+ const value = this.value;
981
+ const name = this.name;
982
+ const params = {};
983
+ if (Array.isArray(value)) {
984
+ params[this.name] = value
985
+ .filter((item) => !!item.value)
986
+ .map((item) => item.value)
987
+ .join(',');
988
+ }
989
+ else {
990
+ params[name] = value;
991
+ }
992
+ return params;
993
+ }
994
+ get isChipVisible() {
995
+ return Array.isArray(this.model) && this.model.length > 0;
996
+ }
997
+ getChipsContent() {
998
+ return this.model
999
+ .reduce((acc, i) => {
1000
+ acc.push(i.name);
1001
+ return acc;
1002
+ }, [])
1003
+ .join(', ');
1004
+ }
1005
+ _init() {
1006
+ if (this.model === undefined) {
1007
+ this._model = [];
1008
+ }
1009
+ }
1010
+ _parseConfig(item) {
1011
+ this.chipImage = item.chipImage ?? 'image';
1012
+ this.chipIcon = item.chipIcon;
1013
+ this.chipIconColor = item.chipIconColor;
1014
+ this.chipColor = item.chipColor;
1015
+ this.chipBackground = item.chipBackground;
1016
+ this.chipClass = item.chipClass;
1017
+ super._parseConfig(item);
1018
+ }
1019
+ _clearValue(defaultValue = undefined) {
1020
+ this.model = defaultValue ?? [];
1021
+ this.search = '';
1022
+ }
1023
+ _setModel(value) {
1024
+ super._setModel(value || []);
1025
+ }
1026
+ }
1027
+
1028
+ class AutocompleteItem extends BaseAutocompleteItem {
1029
+ static create(config, filter) {
1030
+ return new AutocompleteItem(config, null, filter);
1031
+ }
1032
+ get value() {
1033
+ let value = clone(this.model);
1034
+ if (!this.model || this.model.value === undefined) {
1035
+ return undefined;
1036
+ }
1037
+ value = this.model.value;
1038
+ return value;
1039
+ }
1040
+ get queryObject() {
1041
+ const value = this.value;
1042
+ const name = this.name;
1043
+ const params = {};
1044
+ params[name] = value;
1045
+ return params;
1046
+ }
1047
+ getChipsContent() {
1048
+ return this.model ? this.model.name : '';
1049
+ }
1050
+ _init() {
1051
+ //
1052
+ }
1053
+ _clearValue(defaultValue = undefined) {
1054
+ this.model = defaultValue ?? undefined;
1055
+ this.search = '';
1056
+ }
1057
+ }
1058
+
1059
+ class CheckboxItem extends BaseItem {
1060
+ static create(config, filter) {
1061
+ return new CheckboxItem(config, null, filter);
1062
+ }
1063
+ get isTypeCheckbox() {
1064
+ return true;
1065
+ }
1066
+ get isChipVisible() {
1067
+ return this.value === this.checked;
1068
+ }
1069
+ get value() {
1070
+ const value = this.model ? this.checked : this.unchecked;
1071
+ if (!value) {
1072
+ return undefined;
1073
+ }
1074
+ return value;
1075
+ }
1076
+ get queryObject() {
1077
+ const value = this.value;
1078
+ const name = this.name;
1079
+ const params = {};
1080
+ params[name] = this.model ? value : undefined;
1081
+ return params;
1082
+ }
1083
+ getChipsContent(type = null) {
1084
+ return this.label;
1085
+ }
1086
+ _validateModel() {
1087
+ //
1088
+ }
1089
+ _parseConfig(item) {
1090
+ this.checked = item.checked;
1091
+ this.unchecked = item.unchecked;
1092
+ this.checked = item.checked ? toString(item.checked) : true;
1093
+ this.unchecked = item.unchecked ? toString(item.unchecked) : false;
1094
+ this.defaultValue = item.default === undefined ? this.unchecked : toString(this.defaultValue);
1095
+ super._parseConfig(item);
1096
+ }
1097
+ _init() {
1098
+ if (this.model === undefined) {
1099
+ this._model = this.checked === this.defaultValue;
1100
+ }
1101
+ }
1102
+ _clearValue(defaultValue = undefined) {
1103
+ this.model = defaultValue ?? false;
1104
+ }
1105
+ }
1106
+
1107
+ class ChipsItem extends BaseItem {
1108
+ static create(config, filter) {
1109
+ return new ChipsItem(config, null, filter);
1110
+ }
1111
+ get isTypeChips() {
1112
+ return true;
1113
+ }
1114
+ get value() {
1115
+ const value = clone(this.model);
1116
+ if (Array.isArray(value) && value.length === 0) {
1117
+ return undefined;
1118
+ }
1119
+ return value;
1120
+ }
1121
+ get isChipVisible() {
1122
+ return !!this.value;
1123
+ }
1124
+ get queryObject() {
1125
+ const value = this.value;
1126
+ const name = this.name;
1127
+ return {
1128
+ [name]: value,
1129
+ };
1130
+ }
1131
+ get persistanceObject() {
1132
+ const value = this.value;
1133
+ const name = this.name;
1134
+ const params = {};
1135
+ if (Array.isArray(value)) {
1136
+ params[name] = value.join(',');
1137
+ }
1138
+ else {
1139
+ params[name] = undefined;
1140
+ }
1141
+ return params;
1142
+ }
1143
+ getChipsContent() {
1144
+ return this.model
1145
+ .reduce((acc, i) => {
1146
+ acc.push(i.name);
1147
+ return acc;
1148
+ }, [])
1149
+ .join(', ');
1150
+ }
1151
+ _validateModel() {
1152
+ //
1153
+ }
1154
+ _setModel(value) {
1155
+ if (Array.isArray(value)) {
1156
+ value = value.map((val) => {
1157
+ if (isNaN(val)) {
1158
+ return val;
1159
+ }
1160
+ return +val;
1161
+ });
1162
+ }
1163
+ this._model = value;
1164
+ }
1165
+ _parseConfig(item) {
1166
+ this.multiple = item.multiple;
1167
+ super._parseConfig(item);
1168
+ }
1169
+ _init() {
1170
+ if (!Array.isArray(this.values)) {
1171
+ this.values = [];
1172
+ }
1173
+ if (this.model && Array.isArray(this.model) && this.values.length) {
1174
+ if (Number.isInteger(this.model[0])) {
1175
+ this._model = this.model.map((id) => {
1176
+ return this.values.find((value) => value.value === id);
1177
+ });
1178
+ }
1179
+ }
1180
+ if (this.model === undefined) {
1181
+ this._model = [];
1182
+ }
1183
+ }
1184
+ _clearValue(defaultValue = undefined) {
1185
+ this.model = defaultValue ?? [];
1186
+ }
1187
+ }
1188
+
1189
+ var ItemDateMode;
1190
+ (function (ItemDateMode) {
1191
+ ItemDateMode["Calendar"] = "calendar";
1192
+ ItemDateMode["ScrollMonthYear"] = "monthyear";
1193
+ ItemDateMode["ScrollMonthDayYear"] = "monthdayyear";
1194
+ })(ItemDateMode || (ItemDateMode = {}));
1195
+
1196
+ class BaseDateItem extends BaseItem {
1197
+ get value() {
1198
+ const value = clone(this.model);
1199
+ if (!value || !isValid(value) || !isDate(value)) {
1200
+ return undefined;
1201
+ }
1202
+ return value;
1203
+ }
1204
+ get queryObject() {
1205
+ const value = this.value;
1206
+ const name = this.name;
1207
+ const params = {};
1208
+ params[name] = value;
1209
+ return params;
1210
+ }
1211
+ get persistanceObject() {
1212
+ const value = this.queryObject[this.name];
1213
+ return {
1214
+ [this.name]: value ? simpleFormat(value) : undefined,
1215
+ };
1216
+ }
1217
+ _validateModel() {
1218
+ }
1219
+ _setModel(value) {
1220
+ if (value) {
1221
+ if (!isDate(value) || !isValid(value)) {
1222
+ value = parseISO(value);
1223
+ }
1224
+ }
1225
+ super._setModel(value);
1226
+ }
1227
+ _parseConfig(item) {
1228
+ this.maxYear = item.maxYear;
1229
+ this.mode = item.mode || ItemDateMode.Calendar;
1230
+ super._parseConfig(item);
1231
+ }
1232
+ _init() {
1233
+ if (!this.label) {
1234
+ this.label = ['Min', 'Max'];
1235
+ }
1236
+ }
1237
+ }
1238
+
1239
+ class DateItem extends BaseDateItem {
1240
+ static create(config, filter) {
1241
+ return new DateItem(config, null, filter);
1242
+ }
1243
+ getChipsContent(type = null) {
1244
+ let dateFormat = 'date';
1245
+ if (this.mode === ItemDateMode.ScrollMonthYear) {
1246
+ dateFormat = 'full-date-dayless';
1247
+ }
1248
+ return format(this.model, dateFormat);
1249
+ }
1250
+ _clearValue(defaultValue = undefined) {
1251
+ this.model = defaultValue ?? undefined;
1252
+ }
1253
+ }
1254
+
1255
+ class DateTimeItem extends BaseDateItem {
1256
+ static create(config, filter) {
1257
+ return new DateTimeItem(config, null, filter);
1258
+ }
1259
+ _clearValue(defaultValue = undefined) {
1260
+ this.model = defaultValue ?? undefined;
1261
+ }
1262
+ }
1263
+
1264
+ function findValue(values, value, children) {
1265
+ for (let i = 0; i < values.length; i++) {
1266
+ const val = values[i];
1267
+ if (val[children]) {
1268
+ return findValue(val[children], value, children);
1269
+ }
1270
+ if (val.value === value) {
1271
+ return val;
1272
+ }
1273
+ }
1274
+ return undefined;
1275
+ }
1276
+
1277
+ class SimpleSelectItem extends BaseSelectItem {
1278
+ constructor(itemConfig, _persistedValues, _filter) {
1279
+ super(itemConfig, _persistedValues, _filter);
1280
+ }
1281
+ get value() {
1282
+ let value = this.model;
1283
+ if (value === '__all' || value === undefined) {
1284
+ value = undefined;
1285
+ }
1286
+ return value;
1287
+ }
1288
+ getChipsContent(type = null) {
1289
+ if (this.children) {
1290
+ const itemValue = findValue(this.values, this.model, this.children);
1291
+ return itemValue && itemValue.name;
1292
+ }
1293
+ const itemValue = this.values.find((val) => val.value === this.model);
1294
+ if (itemValue) {
1295
+ return itemValue.name;
1296
+ }
1297
+ else if (this.isolate) {
1298
+ return this.isolate.label;
1299
+ }
1300
+ }
1301
+ get isChipVisible() {
1302
+ return this.model !== '__all' && this.model !== undefined;
1303
+ }
1304
+ _init() {
1305
+ super._init();
1306
+ if (this.model === undefined && this.defaultValue === undefined) {
1307
+ this._model = '__all';
1308
+ }
1309
+ }
1310
+ get isolateOptionNotSelected() {
1311
+ const modelValue = this.model;
1312
+ const isolate = this.isolate;
1313
+ return isolate && !isolate.enabled && modelValue?.length === 0;
1314
+ }
1315
+ _setModel(value) {
1316
+ if (value) {
1317
+ if (!isNaN(value)) {
1318
+ value = +value;
1319
+ }
1320
+ }
1321
+ super._setModel(value);
1322
+ }
1323
+ _validateModel() {
1324
+ const item = this.values.find((value) => {
1325
+ return value.value == this.model;
1326
+ });
1327
+ const value = item ? item.value : '__all';
1328
+ if (this._model !== value) {
1329
+ this.model = value;
1330
+ }
1331
+ }
1332
+ _clearValue(defaultValue = undefined) {
1333
+ super._clearValue(defaultValue);
1334
+ const value = Array.isArray(this.values) && this.values.some((val) => val.value === '__all')
1335
+ ? '__all'
1336
+ : undefined;
1337
+ this.model = defaultValue ?? value;
1338
+ }
1339
+ }
1340
+
1341
+ class SelectItem {
1342
+ static create(config, filter) {
1343
+ if (config.multiple) {
1344
+ return new MultipleSelectItem(config, null, filter);
1345
+ }
1346
+ return new SimpleSelectItem(config, null, filter);
1347
+ }
1348
+ }
1349
+
1350
+ class TextItem extends BaseItem {
1351
+ static create(config, filter) {
1352
+ return new TextItem(config, null, filter);
1353
+ }
1354
+ get value() {
1355
+ return !!this.model ? this.model : undefined;
1356
+ }
1357
+ get queryObject() {
1358
+ const value = this.value;
1359
+ const name = this.name;
1360
+ const params = {};
1361
+ params[name] = value;
1362
+ return params;
1363
+ }
1364
+ getChipsContent() {
1365
+ return this.model;
1366
+ }
1367
+ _validateModel() {
1368
+ //
1369
+ }
1370
+ _parseConfig(item) {
1371
+ this.prefix = item.prefix;
1372
+ this.suffix = item.suffix;
1373
+ super._parseConfig(item);
1374
+ }
1375
+ _init() {
1376
+ //
1377
+ }
1378
+ _clearValue(defaultValue = undefined) {
1379
+ this.model = defaultValue ?? '';
1380
+ }
1381
+ }
1382
+
1383
+ function createFilterItem(item, config, filter) {
1384
+ switch (item.type) {
1385
+ case ItemType.Select: {
1386
+ return SelectItem.create(item, filter);
1387
+ }
1388
+ case ItemType.Chips: {
1389
+ return ChipsItem.create(item, filter);
1390
+ }
1391
+ case ItemType.Range: {
1392
+ return RangeItem.create(item, config, filter);
1393
+ }
1394
+ case ItemType.DateRange: {
1395
+ return DateRangeItem.create(item, filter);
1396
+ }
1397
+ case ItemType.DateTimeRange: {
1398
+ return DateTimeRangeItem.create(item, filter);
1399
+ }
1400
+ case ItemType.Date: {
1401
+ return DateItem.create(item, filter);
1402
+ }
1403
+ case ItemType.Week: {
1404
+ return WeekItem.create(item, filter);
1405
+ }
1406
+ case ItemType.DateTime: {
1407
+ return DateTimeItem.create(item, filter);
1408
+ }
1409
+ case ItemType.AutoComplete: {
1410
+ return AutocompleteItem.create(item, filter);
1411
+ }
1412
+ case ItemType.AutoCompleteChips: {
1413
+ return AutocompleteChipsItem.create(item, filter);
1414
+ }
1415
+ case ItemType.Checkbox: {
1416
+ return CheckboxItem.create(item, filter);
1417
+ }
1418
+ case ItemType.Keyword:
1419
+ case ItemType.Text: {
1420
+ return TextItem.create(item, filter);
1421
+ }
1422
+ }
1423
+ }
1424
+
1425
+ var ActionMode;
1426
+ (function (ActionMode) {
1427
+ ActionMode["Button"] = "button";
1428
+ ActionMode["Menu"] = "menu";
1429
+ ActionMode["File"] = "file";
1430
+ })(ActionMode || (ActionMode = {}));
1431
+
1432
+ var ActionType;
1433
+ (function (ActionType) {
1434
+ ActionType["Basic"] = "basic";
1435
+ ActionType["Raised"] = "raised";
1436
+ ActionType["Icon"] = "icon";
1437
+ ActionType["Fab"] = "fab";
1438
+ ActionType["MiniFab"] = "mini-fab";
1439
+ ActionType["Flat"] = "flat";
1440
+ ActionType["Stroked"] = "stroked";
1441
+ })(ActionType || (ActionType = {}));
1442
+
1443
+ var ButtonStyle;
1444
+ (function (ButtonStyle) {
1445
+ ButtonStyle["Basic"] = "basic";
1446
+ ButtonStyle["Raised"] = "raised";
1447
+ ButtonStyle["Icon"] = "icon";
1448
+ ButtonStyle["Fab"] = "fab";
1449
+ ButtonStyle["MiniFab"] = "mini-fab";
1450
+ ButtonStyle["Flat"] = "flat";
1451
+ ButtonStyle["Stroked"] = "stroked";
1452
+ })(ButtonStyle || (ButtonStyle = {}));
1453
+
1454
+ var PickerViewType;
1455
+ (function (PickerViewType) {
1456
+ PickerViewType["Date"] = "date";
1457
+ PickerViewType["DateTime"] = "datetime";
1458
+ PickerViewType["Time"] = "time";
1459
+ PickerViewType["Week"] = "week";
1460
+ PickerViewType["MonthRange"] = "monthrange";
1461
+ })(PickerViewType || (PickerViewType = {}));
1462
+
1463
+ const SORT_BY_FIELD = 'sortName';
1464
+ const SORT_DIRECTION_FIELD = 'sortDirection';
1465
+ class FsFilterConfig {
1466
+ constructor(data = {}) {
1467
+ this.load = true;
1468
+ this.persist = false;
1469
+ this.inline = false;
1470
+ this.autofocus = false;
1471
+ this.chips = false;
1472
+ this.sortValues = null;
1473
+ this.sort = null;
1474
+ // public sortDirection = null;
1475
+ this.queryParam = false;
1476
+ this.case = 'camel';
1477
+ this._init(data);
1478
+ }
1479
+ _init(data = {}) {
1480
+ this.load = data.load ?? true;
1481
+ this.persist = data.persist;
1482
+ this.savedFilters = data.savedFilters;
1483
+ this.inline = data.inline ?? false;
1484
+ this.autofocus = data.autofocus ?? false;
1485
+ this.chips = data.chips ?? false;
1486
+ this.sortValues = data.sorts;
1487
+ this.sort = data.sort;
1488
+ this.queryParam = data.queryParam ?? false;
1489
+ this.init = data.init;
1490
+ this.change = data.change;
1491
+ this.reload = data.reload;
1492
+ this.clear = data.clear;
1493
+ this.sortChange = data.sortChange;
1494
+ this.case = data.case ?? 'camel';
1495
+ this.reloadWhenConfigChanged = data.reloadWhenConfigChanged;
1496
+ this.button = data.button;
1497
+ this.items = data.items;
1498
+ this.actions = data.actions;
1499
+ this.case = data.case ?? 'camel';
1500
+ if (this.persist) {
1501
+ if (typeof this.persist === 'object') {
1502
+ if (this.persist.name) {
1503
+ this.namespace = this.persist.name;
1504
+ }
1505
+ }
1506
+ }
1507
+ if (!this.button) {
1508
+ this.button = {};
1509
+ }
1510
+ if (this.button.label === undefined) {
1511
+ this.button.label = 'Filters';
1512
+ }
1513
+ if (this.button.icon === undefined) {
1514
+ this.button.icon = 'tune';
1515
+ }
1516
+ if (this.button.style === undefined) {
1517
+ this.button.style = ButtonStyle.Raised;
1518
+ }
1519
+ if (this.button.color === undefined) {
1520
+ this.button.color = 'default';
1521
+ }
1522
+ if (this.clear === undefined) {
1523
+ this.clear = () => { };
1524
+ }
1525
+ }
1526
+ }
1527
+
1528
+ class FsFilterItemsStore {
1529
+ constructor() {
1530
+ this.sortByItem = null;
1531
+ this.sortDirectionItem = null;
1532
+ this.keywordItem = null;
1533
+ this._ready$ = new BehaviorSubject(false);
1534
+ this._items = [];
1535
+ this._visibleItems$ = new BehaviorSubject([]);
1536
+ this._itemsByName = new Map();
1537
+ this._itemsValuesLoaded = false;
1538
+ this._hasKeyword = false;
1539
+ this._itemsChange$ = new Subject();
1540
+ this._destroy$ = new Subject();
1541
+ this._lazyInit();
1542
+ }
1543
+ get items() {
1544
+ return this._items;
1545
+ }
1546
+ get visibleItems() {
1547
+ return this._visibleItems$.getValue();
1548
+ }
1549
+ set visibleItems(items) {
1550
+ this._visibleItems$.next(items);
1551
+ }
1552
+ get visibleItems$() {
1553
+ return this._visibleItems$.asObservable();
1554
+ }
1555
+ get hasKeyword() {
1556
+ return this._hasKeyword;
1557
+ }
1558
+ get itemsChange$() {
1559
+ return this._itemsChange$.pipe(debounceTime(30));
1560
+ }
1561
+ get ready$() {
1562
+ return this._ready$.asObservable();
1563
+ }
1564
+ ngOnDestroy() {
1565
+ this.destroyItems();
1566
+ this._destroy$.next();
1567
+ this._destroy$.complete();
1568
+ }
1569
+ setConfig(config) {
1570
+ this._itemsByName.clear();
1571
+ this._config = config;
1572
+ this.initItems(config.items);
1573
+ }
1574
+ getItemByName(name) {
1575
+ return this._itemsByName.get(name);
1576
+ }
1577
+ initItems(items) {
1578
+ this._itemsValuesLoaded = false;
1579
+ if (Array.isArray(items)) {
1580
+ this._createItems(items);
1581
+ }
1582
+ }
1583
+ filtersClear() {
1584
+ this.items.forEach((item) => {
1585
+ if (item instanceof RangeItem) {
1586
+ item.clearRange(null, item.defaultValue);
1587
+ }
1588
+ else if (item instanceof BaseDateRangeItem) {
1589
+ item.clearDateRange(null, item.defaultValue);
1590
+ }
1591
+ else {
1592
+ item.clear(item.defaultValue);
1593
+ }
1594
+ });
1595
+ if (this.sortByItem) {
1596
+ if (this._config.sort) {
1597
+ this.sortByItem.model = this._config.sort.value;
1598
+ }
1599
+ else {
1600
+ this.sortByItem.clear(this.sortByItem.defaultValue);
1601
+ }
1602
+ }
1603
+ if (this.sortDirectionItem) {
1604
+ if (this._config.sort) {
1605
+ this.sortDirectionItem.model = this._config.sort.direction;
1606
+ }
1607
+ else {
1608
+ this.sortDirectionItem.clear(this.sortDirectionItem.defaultValue);
1609
+ }
1610
+ }
1611
+ this.keywordItem?.clear();
1612
+ }
1613
+ loadAsyncValues() {
1614
+ this.items
1615
+ .filter((item) => item.hasPendingValues)
1616
+ .forEach((item) => item.loadAsyncValues());
1617
+ }
1618
+ loadAsyncDefaults() {
1619
+ // default values can be asynchronous, and we must load them if there is no persisted value instead
1620
+ const defaultValuesToBeLoaded = this.items
1621
+ .filter((item) => {
1622
+ return item.defaultValueFn
1623
+ && (item.persistedValue === null || item.persistedValue === undefined);
1624
+ });
1625
+ // special hack for isolate multiple select
1626
+ // values for this type of select must be preloaded
1627
+ // Read more in class MultipleSelectItem._init()
1628
+ const valuesToBeLoaded = this.items
1629
+ .filter((item) => {
1630
+ return (item instanceof MultipleSelectItem) && item.hasPendingValues && item.isolate;
1631
+ });
1632
+ if (defaultValuesToBeLoaded.length > 0 || valuesToBeLoaded.length > 0) {
1633
+ forkJoin([
1634
+ ...defaultValuesToBeLoaded
1635
+ .map((item) => item.loadDefaultValue()),
1636
+ ...valuesToBeLoaded
1637
+ .map((item) => {
1638
+ item.loadAsyncValues();
1639
+ return item.loading$
1640
+ .pipe();
1641
+ }),
1642
+ ])
1643
+ .pipe(finalize(() => {
1644
+ this._ready$.next(true);
1645
+ }), takeUntil(this._destroy$))
1646
+ .subscribe();
1647
+ }
1648
+ else {
1649
+ this._ready$.next(true);
1650
+ }
1651
+ }
1652
+ getSort() {
1653
+ let sortBy = this.getSortByValue();
1654
+ sortBy = sortBy === '__all' ? null : sortBy;
1655
+ let sortDirection = this.getSortDirectionValue();
1656
+ sortDirection = sortDirection === '__all' ? null : sortDirection;
1657
+ return {
1658
+ value: sortBy,
1659
+ direction: sortDirection,
1660
+ };
1661
+ }
1662
+ getSortByValue() {
1663
+ return this.sortByItem ? this.sortByItem.model : null;
1664
+ }
1665
+ getSortDirectionValue() {
1666
+ return this.sortDirectionItem ? this.sortDirectionItem.model : null;
1667
+ }
1668
+ updateSort(sort) {
1669
+ if (sort.sortBy) {
1670
+ this.sortByItem.model = sort.sortBy;
1671
+ }
1672
+ if (sort.sortDirection) {
1673
+ this.sortDirectionItem.model = sort.sortDirection;
1674
+ }
1675
+ }
1676
+ values(onlyPresented = false) {
1677
+ return this.items.reduce((acc, item) => {
1678
+ const value = item.value;
1679
+ if (!onlyPresented || value !== null) {
1680
+ acc[item.name] = value;
1681
+ }
1682
+ return acc;
1683
+ }, {});
1684
+ }
1685
+ valuesAsQuery({ onlyPresented = true, items = null, persisted = false, } = {}) {
1686
+ const params = {};
1687
+ (items || this.items).forEach((filterItem) => {
1688
+ const values = persisted
1689
+ ? filterItem.persistanceObject
1690
+ : filterItem.queryObject;
1691
+ Object.assign(params, values);
1692
+ });
1693
+ if (onlyPresented) {
1694
+ return pickBy(params, (val) => {
1695
+ return val !== void 0;
1696
+ });
1697
+ }
1698
+ return params;
1699
+ }
1700
+ init(p) {
1701
+ this.items
1702
+ .forEach((item) => {
1703
+ item.initValues(p[item.name]);
1704
+ });
1705
+ this._initSortingItems(p);
1706
+ this.loadAsyncDefaults();
1707
+ this._subscribeToItemsChanges();
1708
+ }
1709
+ updateItemsWithValues(values) {
1710
+ this.items
1711
+ .forEach((item) => {
1712
+ if (values[item.name]) {
1713
+ item.model = values[item.name];
1714
+ }
1715
+ else {
1716
+ if (item instanceof RangeItem) {
1717
+ item.clearRange(null, item.defaultValue);
1718
+ }
1719
+ else if (item instanceof BaseDateRangeItem) {
1720
+ item.clearDateRange(null, item.defaultValue);
1721
+ }
1722
+ else {
1723
+ item.clear();
1724
+ }
1725
+ }
1726
+ });
1727
+ if (this.sortByItem) {
1728
+ this.sortByItem.clear();
1729
+ }
1730
+ if (this.sortDirectionItem) {
1731
+ this.sortDirectionItem.clear();
1732
+ }
1733
+ }
1734
+ destroyItems() {
1735
+ this.items
1736
+ .forEach((item) => item.destroy());
1737
+ this.sortByItem?.destroy();
1738
+ this.sortDirectionItem?.destroy();
1739
+ this._items = [];
1740
+ this.sortByItem = null;
1741
+ this.sortDirectionItem = null;
1742
+ }
1743
+ /**
1744
+ * Some items might need to load async values before they will be shown
1745
+ */
1746
+ prepareItems() {
1747
+ if (!this._itemsValuesLoaded) {
1748
+ this._itemsValuesLoaded = true;
1749
+ this.loadAsyncValues();
1750
+ }
1751
+ }
1752
+ updateItemsVisiblity() {
1753
+ this.visibleItems = this.items
1754
+ .filter((item) => !item.isTypeKeyword && !item.hide);
1755
+ }
1756
+ _createItems(items) {
1757
+ this._items = items
1758
+ .filter((item) => !item.disable)
1759
+ .filter((item) => {
1760
+ if (this._itemsByName.has(item.name)) {
1761
+ throw Error('Filter init error. Items name must be unique.');
1762
+ }
1763
+ else {
1764
+ this._itemsByName.set(item.name, null);
1765
+ return true;
1766
+ }
1767
+ })
1768
+ .map((item) => {
1769
+ const filterItem = createFilterItem(item, { case: this._config.case }, this.filter);
1770
+ if (filterItem.type === ItemType.Keyword) {
1771
+ this._hasKeyword = true;
1772
+ }
1773
+ this._itemsByName.set(item.name, filterItem);
1774
+ return filterItem;
1775
+ });
1776
+ this._createSortingItems();
1777
+ }
1778
+ _subscribeToItemsChanges() {
1779
+ this.items
1780
+ .forEach((item) => {
1781
+ item.valueChange$
1782
+ .pipe(takeUntil(item.destroy$))
1783
+ .subscribe(() => {
1784
+ this._itemsChange$.next(item);
1785
+ });
1786
+ });
1787
+ if (this._config.sortValues?.length) {
1788
+ this.sortByItem.valueChange$
1789
+ .pipe(takeUntil(this.sortByItem.destroy$))
1790
+ .subscribe(() => {
1791
+ this._itemsChange$.next(this.sortByItem);
1792
+ });
1793
+ this.sortDirectionItem.valueChange$
1794
+ .pipe(takeUntil(this.sortDirectionItem.destroy$))
1795
+ .subscribe(() => {
1796
+ this._itemsChange$.next(this.sortDirectionItem);
1797
+ });
1798
+ }
1799
+ }
1800
+ _lazyInit() {
1801
+ this.ready$
1802
+ .pipe(filter$1((state) => state), takeUntil(this._destroy$))
1803
+ .subscribe(() => {
1804
+ this.updateItemsVisiblity();
1805
+ this._setKeywordItem();
1806
+ });
1807
+ }
1808
+ _initSortingItems(p) {
1809
+ if (this.sortByItem && this.sortDirectionItem) {
1810
+ this.sortByItem.initValues(p[this.sortByItem.name]);
1811
+ this.sortDirectionItem.initValues(p[this.sortDirectionItem.name]);
1812
+ }
1813
+ }
1814
+ _createSortingItems() {
1815
+ if (this._config.sortValues?.length > 0) {
1816
+ const sortByItem = {
1817
+ name: SORT_BY_FIELD,
1818
+ type: ItemType.Select,
1819
+ label: 'Sort By',
1820
+ values: this._config.sortValues,
1821
+ };
1822
+ if (this._config.sort && this._config.sort.value) {
1823
+ sortByItem.default = this._config.sort.value;
1824
+ }
1825
+ this.sortByItem = new SimpleSelectItem(sortByItem, null, this.filter);
1826
+ const sortDirectionItem = {
1827
+ name: SORT_DIRECTION_FIELD,
1828
+ type: ItemType.Select,
1829
+ label: 'Sort Direction',
1830
+ values: [
1831
+ { name: 'Ascending', value: 'asc' },
1832
+ { name: 'Descending', value: 'desc' },
1833
+ ],
1834
+ };
1835
+ if (this._config.sort && this._config.sort.direction) {
1836
+ sortDirectionItem.default = this._config.sort.direction;
1837
+ }
1838
+ this.sortDirectionItem = new SimpleSelectItem(sortDirectionItem, null, this.filter);
1839
+ }
1840
+ }
1841
+ _setKeywordItem() {
1842
+ this.keywordItem = this
1843
+ .items
1844
+ .find((item) => item.isTypeKeyword);
1845
+ }
1846
+ }
1847
+ FsFilterItemsStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFilterItemsStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1848
+ FsFilterItemsStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFilterItemsStore });
1849
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFilterItemsStore, decorators: [{
1850
+ type: Injectable
1851
+ }], ctorParameters: function () { return []; } });
1852
+
1853
+ const FILTER_STORE_KEY = 'fs-filter-persist';
1854
+ class PersistanceParamsController extends FsPersistanceStore {
1855
+ constructor(_store, _route, _location, _itemsStore, _dialogRef, _drawerRef) {
1856
+ super(_store, _route);
1857
+ this._location = _location;
1858
+ this._itemsStore = _itemsStore;
1859
+ this._dialogRef = _dialogRef;
1860
+ this._drawerRef = _drawerRef;
1861
+ this.STORE_KEY = FILTER_STORE_KEY;
1862
+ }
1863
+ init(persistanceConfig, namespace, paramsCase) {
1864
+ this._paramsCase = paramsCase;
1865
+ namespace = namespace ?? getNormalizedPath(this._location);
1866
+ const persistanceDisabled = !!this._dialogRef || !!this._drawerRef;
1867
+ this.setConfig(persistanceConfig, namespace, persistanceDisabled);
1868
+ }
1869
+ restore() {
1870
+ if (!this.enabled) {
1871
+ return;
1872
+ }
1873
+ super.restore();
1874
+ const items = [
1875
+ ...this._itemsStore.items,
1876
+ this._itemsStore.sortByItem,
1877
+ this._itemsStore.sortDirectionItem,
1878
+ ].filter((item) => !!item);
1879
+ if (this._value) {
1880
+ this._value.data = restoreItems(this._value.data, items, this._paramsCase);
1881
+ }
1882
+ }
1883
+ }
1884
+ PersistanceParamsController.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: PersistanceParamsController, deps: [{ token: i1.FsStore }, { token: i1$1.ActivatedRoute }, { token: i3.Location }, { token: FsFilterItemsStore }, { token: i1$2.MatDialogRef, optional: true }, { token: i6.DrawerRef, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
1885
+ PersistanceParamsController.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: PersistanceParamsController });
1886
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: PersistanceParamsController, decorators: [{
1887
+ type: Injectable
1888
+ }], ctorParameters: function () { return [{ type: i1.FsStore }, { type: i1$1.ActivatedRoute }, { type: i3.Location }, { type: FsFilterItemsStore }, { type: i1$2.MatDialogRef, decorators: [{
1889
+ type: Optional
1890
+ }] }, { type: i6.DrawerRef, decorators: [{
1891
+ type: Optional
1892
+ }] }]; } });
1893
+
1894
+ class QueryParamsController {
1895
+ constructor(_router, _route, _location, _itemsStore) {
1896
+ this._router = _router;
1897
+ this._route = _route;
1898
+ this._location = _location;
1899
+ this._itemsStore = _itemsStore;
1900
+ this._enabled = false;
1901
+ }
1902
+ get enabled() {
1903
+ return this._enabled;
1904
+ }
1905
+ get fetchedParams() {
1906
+ return this._fetchedParams;
1907
+ }
1908
+ init(enabled, paramsCase) {
1909
+ this._enabled = enabled;
1910
+ this._paramsCase = paramsCase;
1911
+ if (this.enabled) {
1912
+ this.fetchFromQueryParams();
1913
+ }
1914
+ }
1915
+ writeStateToQueryParams(params) {
1916
+ if (!this._enabled) {
1917
+ return;
1918
+ }
1919
+ this._location.replaceState(this._router.createUrlTree([], {
1920
+ relativeTo: this._route,
1921
+ queryParams: params,
1922
+ queryParamsHandling: 'merge',
1923
+ preserveFragment: true,
1924
+ }).toString());
1925
+ // Trying replacing the URL without triggering an Angular navigation change
1926
+ // // Update query
1927
+ // this._router.navigate([], {
1928
+ // replaceUrl: true,
1929
+ // relativeTo: this._route,
1930
+ // queryParams: params,
1931
+ // queryParamsHandling: 'merge',
1932
+ // }).then(() => {});
1933
+ }
1934
+ /**
1935
+ * Parse query and update filter values
1936
+ */
1937
+ fetchFromQueryParams() {
1938
+ const items = [
1939
+ ...this._itemsStore.items,
1940
+ this._itemsStore.sortByItem,
1941
+ this._itemsStore.sortDirectionItem,
1942
+ ].filter((item) => !!item);
1943
+ this._fetchedParams = restoreItems(this._route.snapshot.queryParams, items, this._paramsCase);
1944
+ }
1945
+ }
1946
+ QueryParamsController.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: QueryParamsController, deps: [{ token: i1$1.Router }, { token: i1$1.ActivatedRoute }, { token: i3.Location }, { token: FsFilterItemsStore }], target: i0.ɵɵFactoryTarget.Injectable });
1947
+ QueryParamsController.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: QueryParamsController });
1948
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: QueryParamsController, decorators: [{
1949
+ type: Injectable
1950
+ }], ctorParameters: function () { return [{ type: i1$1.Router }, { type: i1$1.ActivatedRoute }, { type: i3.Location }, { type: FsFilterItemsStore }]; } });
1951
+
1952
+ class FsFilterSavedFilterEditComponent {
1953
+ constructor(data, _dialogRef) {
1954
+ this.data = data;
1955
+ this._dialogRef = _dialogRef;
1956
+ this.saveAsFilter = 'new';
1957
+ this.savedFilterName = '';
1958
+ this._destroy$ = new Subject();
1959
+ this.save = () => {
1960
+ let savedFilter;
1961
+ if (this.saveAsFilter === 'new') {
1962
+ savedFilter = {
1963
+ name: this.savedFilterName,
1964
+ active: true,
1965
+ filters: this.data.params,
1966
+ };
1967
+ }
1968
+ else {
1969
+ savedFilter = {
1970
+ ...this.saveAsFilter,
1971
+ filters: this.data.params,
1972
+ };
1973
+ }
1974
+ return this._saveCallback(savedFilter)
1975
+ .pipe(tap((filter) => {
1976
+ this._dialogRef.close(filter);
1977
+ }), takeUntil(this._destroy$));
1978
+ };
1979
+ this.savedFilters = this.data.savedFilters;
1980
+ this._saveCallback = this.data.saveCallback;
1981
+ }
1982
+ }
1983
+ FsFilterSavedFilterEditComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFilterSavedFilterEditComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1$2.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
1984
+ FsFilterSavedFilterEditComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: FsFilterSavedFilterEditComponent, selector: "ng-component", ngImport: i0, template: "<form fsForm [submit]=\"save\">\n <h1 mat-dialog-title>\n Save Filter\n </h1>\n <div mat-dialog-content>\n <mat-form-field>\n <mat-label>Save as</mat-label>\n <mat-select [(ngModel)]=\"saveAsFilter\" name=\"saveAs\">\n <mat-option value=\"new\">New filter</mat-option>\n <mat-optgroup label=\"Saved filters:\">\n <ng-container *ngFor=\"let filter of savedFilters\">\n <mat-option [value]=\"filter\">{{ filter.name }}</mat-option>\n </ng-container>\n </mat-optgroup>\n </mat-select>\n </mat-form-field>\n <br>\n <mat-form-field *ngIf=\"saveAsFilter === 'new'\">\n <mat-label>Name</mat-label>\n <input matInput name=\"filter-name\" [(ngModel)]=\"savedFilterName\" required>\n </mat-form-field>\n </div>\n <div mat-dialog-actions>\n <button mat-button\n type=\"submit\"\n color=\"primary\">\n {{ saveAsFilter === 'new' ? 'Create' : 'Save' }}\n </button>\n\n <button mat-button\n type=\"button\"\n [mat-dialog-close]=\"null\">\n Cancel\n </button>\n </div>\n</form>\n", components: [{ type: i1$3.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i2.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i3$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: i3$1.MatOptgroup, selector: "mat-optgroup", inputs: ["disabled"], exportAs: ["matOptgroup"] }, { type: i1$4.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i4.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i7.FsFormDirective, selector: "[fsForm]", inputs: ["wrapperSelector", "messageSelector", "hintSelector", "labelSelector", "autocomplete", "shortcuts", "confirm", "confirmDialog", "confirmDrawer", "confirmBrowser", "confirmTabs", "dirtySubmitButton", "submit", "successDelay", "errorDelay", "tabGroup", "deactivationGuard"], outputs: ["fsForm", "invalid", "valid", "submitted", "reseted", "cleared"], exportAs: ["fsForm"] }, { type: i1$2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i1$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i1$3.MatLabel, selector: "mat-label" }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i7.FsFormNoFsValidatorsDirective, selector: "[ngModel]:not([required]):not([fsFormRequired]):not([fsFormCompare]):not([fsFormDateRange]):not([fsFormEmail]):not([fsFormEmails]):not([fsFormFunction]):not([fsFormGreater]):not([fsFormInteger]):not([fsFormLesser]):not([fsFormMax]):not([fsFormMaxLength]):not([fsFormMin]):not([fsFormMinLength]):not([fsFormNumeric]):not([fsFormPattern]):not([fsFormPhone]):not([fsFormUrl]):not([validate])" }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i4.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i7.FsFormRequiredDirective, selector: "[fsFormRequired],[ngModel][required]", inputs: ["fsFormRequired", "required", "fsFormRequiredMessage"] }, { type: i1$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }, { type: i7.FsButtonDirective, selector: "[mat-raised-button],[mat-button],[mat-flat-button],[mat-stroked-button]", inputs: ["name", "dirtySubmit", "form"] }, { type: i1$2.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1985
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFilterSavedFilterEditComponent, decorators: [{
1986
+ type: Component,
1987
+ args: [{ changeDetection: ChangeDetectionStrategy.OnPush, template: "<form fsForm [submit]=\"save\">\n <h1 mat-dialog-title>\n Save Filter\n </h1>\n <div mat-dialog-content>\n <mat-form-field>\n <mat-label>Save as</mat-label>\n <mat-select [(ngModel)]=\"saveAsFilter\" name=\"saveAs\">\n <mat-option value=\"new\">New filter</mat-option>\n <mat-optgroup label=\"Saved filters:\">\n <ng-container *ngFor=\"let filter of savedFilters\">\n <mat-option [value]=\"filter\">{{ filter.name }}</mat-option>\n </ng-container>\n </mat-optgroup>\n </mat-select>\n </mat-form-field>\n <br>\n <mat-form-field *ngIf=\"saveAsFilter === 'new'\">\n <mat-label>Name</mat-label>\n <input matInput name=\"filter-name\" [(ngModel)]=\"savedFilterName\" required>\n </mat-form-field>\n </div>\n <div mat-dialog-actions>\n <button mat-button\n type=\"submit\"\n color=\"primary\">\n {{ saveAsFilter === 'new' ? 'Create' : 'Save' }}\n </button>\n\n <button mat-button\n type=\"button\"\n [mat-dialog-close]=\"null\">\n Cancel\n </button>\n </div>\n</form>\n" }]
1988
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1989
+ type: Inject,
1990
+ args: [MAT_DIALOG_DATA]
1991
+ }] }, { type: i1$2.MatDialogRef }]; } });
1992
+
1993
+ class SavedFiltersController {
1994
+ constructor(_itemsStore, _dialog) {
1995
+ this._itemsStore = _itemsStore;
1996
+ this._dialog = _dialog;
1997
+ this._savedFilters$ = new BehaviorSubject([]);
1998
+ this._activeFilter$ = new BehaviorSubject(null);
1999
+ this._enabled$ = new BehaviorSubject(false);
2000
+ this._destroy$ = new Subject();
2001
+ }
2002
+ get enabled() {
2003
+ return this._enabled$.getValue();
2004
+ }
2005
+ get enabled$() {
2006
+ return this._enabled$
2007
+ .pipe(distinctUntilChanged());
2008
+ }
2009
+ get savedFilters() {
2010
+ return this._savedFilters$.getValue();
2011
+ }
2012
+ get savedFilters$() {
2013
+ return this._savedFilters$
2014
+ .pipe(distinctUntilChanged());
2015
+ }
2016
+ get activeFilter() {
2017
+ return this._activeFilter$.getValue();
2018
+ }
2019
+ get activeFilter$() {
2020
+ return this._activeFilter$
2021
+ .pipe(distinctUntilChanged());
2022
+ }
2023
+ get activeFilterData() {
2024
+ return this._activeFilter$.getValue()?.filters;
2025
+ }
2026
+ set savedFilters(filters) {
2027
+ this._savedFilters$.next(filters);
2028
+ }
2029
+ ngOnDestroy() {
2030
+ this._destroy$.next();
2031
+ this._destroy$.complete();
2032
+ }
2033
+ init(remoteParamsConfig, paramsCase) {
2034
+ if (!remoteParamsConfig) {
2035
+ this._setEnabledStatus(false);
2036
+ return;
2037
+ }
2038
+ this._setEnabledStatus(true);
2039
+ this._paramsCase = paramsCase;
2040
+ this._config = remoteParamsConfig;
2041
+ }
2042
+ initSavedFilters(filters) {
2043
+ filters = [...filters];
2044
+ filters.forEach((savedFilter) => {
2045
+ savedFilter.filters = restoreItems(savedFilter.filters, this._itemsStore.items, this._paramsCase);
2046
+ });
2047
+ this.savedFilters = filters;
2048
+ }
2049
+ load() {
2050
+ return this._config.load()
2051
+ .pipe(tap((response) => {
2052
+ this.initSavedFilters(response);
2053
+ }));
2054
+ }
2055
+ save(savedFilter) {
2056
+ return this._config.save(savedFilter);
2057
+ }
2058
+ order(savedFilters) {
2059
+ return this._config.order(savedFilters)
2060
+ .pipe(tap((response) => {
2061
+ this.savedFilters = [
2062
+ ...response,
2063
+ ];
2064
+ }));
2065
+ }
2066
+ delete(savedFilter) {
2067
+ return this._config.delete(savedFilter)
2068
+ .pipe(tap((response) => {
2069
+ this.savedFilters = this.savedFilters
2070
+ .filter((f) => f.id !== response.id);
2071
+ }));
2072
+ }
2073
+ setActiveFilter(savedFilter) {
2074
+ if (savedFilter) {
2075
+ const existingFilter = this.savedFilters
2076
+ .find((f) => f.id === savedFilter.id);
2077
+ if (!existingFilter) {
2078
+ throw new Error('Saved filter cannot be activated, because it does not exists. Filter ID = ' + savedFilter.id);
2079
+ }
2080
+ this._activeFilter$.next(existingFilter);
2081
+ }
2082
+ else {
2083
+ this._activeFilter$.next(null);
2084
+ }
2085
+ }
2086
+ openSavedFilterEditDialog() {
2087
+ const params = buildQueryParams(this._itemsStore.valuesAsQuery(), this._itemsStore.items);
2088
+ const values = this._itemsStore.values(true);
2089
+ const dialogConfig = {
2090
+ data: {
2091
+ params: params,
2092
+ savedFilters: this.savedFilters,
2093
+ saveCallback: this.save.bind(this),
2094
+ },
2095
+ };
2096
+ this._dialog
2097
+ .open(FsFilterSavedFilterEditComponent, dialogConfig)
2098
+ .beforeClosed()
2099
+ .pipe(take(1), takeUntil(this._destroy$))
2100
+ .subscribe((updatedFilter) => {
2101
+ if (updatedFilter) {
2102
+ // get already saved related filter object
2103
+ const savedFilter = this.savedFilters
2104
+ .find((f) => f.id === updatedFilter.id);
2105
+ // restore values from query string
2106
+ updatedFilter.filters = restoreItems(updatedFilter.filters, this._itemsStore.items, this._paramsCase);
2107
+ if (savedFilter) {
2108
+ Object.assign(savedFilter, updatedFilter);
2109
+ }
2110
+ else {
2111
+ this.resetActiveFilter();
2112
+ this.savedFilters = [
2113
+ ...this.savedFilters,
2114
+ updatedFilter
2115
+ ];
2116
+ }
2117
+ this.updateActiveFilter();
2118
+ }
2119
+ });
2120
+ }
2121
+ updateActiveFilter() {
2122
+ // Lookup active filter
2123
+ const acitveFilter = this.savedFilters
2124
+ .find((f) => f.active);
2125
+ if (acitveFilter) {
2126
+ this.setActiveFilter(acitveFilter);
2127
+ }
2128
+ }
2129
+ resetActiveFilter() {
2130
+ // Reset all previously activated filters
2131
+ this.savedFilters.forEach((savedFilter) => {
2132
+ savedFilter.active = false;
2133
+ });
2134
+ this.setActiveFilter(null);
2135
+ }
2136
+ _setEnabledStatus(value) {
2137
+ this._enabled$.next(value);
2138
+ }
2139
+ }
2140
+ SavedFiltersController.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SavedFiltersController, deps: [{ token: FsFilterItemsStore }, { token: i1$2.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
2141
+ SavedFiltersController.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SavedFiltersController });
2142
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SavedFiltersController, decorators: [{
2143
+ type: Injectable
2144
+ }], ctorParameters: function () { return [{ type: FsFilterItemsStore }, { type: i1$2.MatDialog }]; } });
2145
+
2146
+ class ExternalParamsController {
2147
+ constructor(_itemsStore, _persistanceStore, _queryParams, _savedFilters) {
2148
+ this._itemsStore = _itemsStore;
2149
+ this._persistanceStore = _persistanceStore;
2150
+ this._queryParams = _queryParams;
2151
+ this._savedFilters = _savedFilters;
2152
+ this._pending$ = new BehaviorSubject(false);
2153
+ this._shouldResetSavedFilters = true;
2154
+ this._destroy$ = new Subject();
2155
+ }
2156
+ get params() {
2157
+ const result = {};
2158
+ if (this._persistanceStore.enabled) {
2159
+ Object.assign(result, this._persistanceStore.value?.data);
2160
+ }
2161
+ if (this._savedFilters.enabled && this._savedFilters.activeFilter) {
2162
+ Object.assign(result, this._savedFilters.activeFilterData);
2163
+ }
2164
+ if (this._queryParams.enabled) {
2165
+ Object.assign(result, this._queryParams.fetchedParams);
2166
+ }
2167
+ return result;
2168
+ }
2169
+ get pending() {
2170
+ return this._pending$.getValue();
2171
+ }
2172
+ get pending$() {
2173
+ return this._pending$.asObservable();
2174
+ }
2175
+ get savedFiltersController() {
2176
+ return this._savedFilters;
2177
+ }
2178
+ get savedFiltersEnabled() {
2179
+ return this._savedFilters.enabled;
2180
+ }
2181
+ ngOnDestroy() {
2182
+ this._destroy$.next();
2183
+ this._destroy$.complete();
2184
+ }
2185
+ setConfig(config) {
2186
+ this._config = config;
2187
+ this._initPersistance();
2188
+ this._initQueryParams();
2189
+ this._initSavedFilters();
2190
+ this.initItems();
2191
+ }
2192
+ setActiveSavedFilter(savedFilter) {
2193
+ this.savedFiltersController.setActiveFilter(savedFilter);
2194
+ if (savedFilter) {
2195
+ this.reloadFiltersWithValues(savedFilter.filters, false);
2196
+ }
2197
+ }
2198
+ reloadFiltersWithValues(params, shouldResetSavedFilters = true) {
2199
+ this._shouldResetSavedFilters = shouldResetSavedFilters;
2200
+ this._itemsStore.updateItemsWithValues(params);
2201
+ this._saveQueryParams();
2202
+ this._savePersistedParams();
2203
+ }
2204
+ initItems() {
2205
+ this._pending$.next(true);
2206
+ if (this._savedFilters.enabled) {
2207
+ this._savedFilters
2208
+ .load()
2209
+ .pipe(takeUntil(this._destroy$))
2210
+ .subscribe(() => {
2211
+ this._savedFilters.updateActiveFilter();
2212
+ this._initItemsValues();
2213
+ this._listenAndResetSavedFilters();
2214
+ this._pending$.next(false);
2215
+ });
2216
+ }
2217
+ else {
2218
+ this._initItemsValues();
2219
+ this._pending$.next(false);
2220
+ }
2221
+ this._listenItemsChange();
2222
+ }
2223
+ _initItemsValues() {
2224
+ this._itemsStore.init(this.params);
2225
+ this._saveQueryParams();
2226
+ this._savePersistedParams();
2227
+ }
2228
+ fetchQueryParams() {
2229
+ this._initQueryParams();
2230
+ this._itemsStore.updateItemsWithValues(this.params);
2231
+ }
2232
+ _initPersistance() {
2233
+ this._persistanceStore.init(this._config.persist, this._config.namespace, this._config.case);
2234
+ }
2235
+ _initQueryParams() {
2236
+ this._queryParams.init(this._config.queryParam, this._config.case);
2237
+ }
2238
+ _initSavedFilters() {
2239
+ this._savedFilters.init(this._config.savedFilters, this._config.case);
2240
+ }
2241
+ _listenItemsChange() {
2242
+ this._itemsStore.ready$
2243
+ .pipe(filter$1((v) => v), take(1), takeUntil(this._destroy$))
2244
+ .subscribe(() => {
2245
+ this._saveQueryParams();
2246
+ this._savePersistedParams();
2247
+ });
2248
+ this._itemsStore
2249
+ .itemsChange$
2250
+ .pipe(takeUntil(this._destroy$))
2251
+ .subscribe(() => {
2252
+ this._saveQueryParams();
2253
+ this._savePersistedParams();
2254
+ });
2255
+ }
2256
+ _listenAndResetSavedFilters() {
2257
+ this._itemsStore
2258
+ .itemsChange$
2259
+ .pipe(filter$1(() => !!this.savedFiltersController.activeFilter), switchMap(() => {
2260
+ const shouldReset = this._shouldResetSavedFilters;
2261
+ this._shouldResetSavedFilters = true;
2262
+ return of(shouldReset);
2263
+ }), filter$1((shouldReset) => shouldReset), takeUntil(this._destroy$))
2264
+ .subscribe(() => {
2265
+ this.savedFiltersController.resetActiveFilter();
2266
+ });
2267
+ }
2268
+ _saveQueryParams() {
2269
+ const targetItems = this._itemsStore.items
2270
+ .filter((item) => !item.queryParamsDisabled);
2271
+ const params = buildQueryParams(this._itemsStore.valuesAsQuery({
2272
+ onlyPresented: false,
2273
+ items: targetItems,
2274
+ persisted: true,
2275
+ }), targetItems);
2276
+ this._queryParams.writeStateToQueryParams(params);
2277
+ }
2278
+ _savePersistedParams() {
2279
+ const targetItems = this._itemsStore.items
2280
+ .filter((item) => !item.persistanceDisabled);
2281
+ const params = buildQueryParams(this._itemsStore.valuesAsQuery({
2282
+ onlyPresented: false,
2283
+ items: targetItems,
2284
+ persisted: true,
2285
+ }), targetItems);
2286
+ this._persistanceStore.save(params);
2287
+ }
2288
+ }
2289
+ ExternalParamsController.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ExternalParamsController, deps: [{ token: FsFilterItemsStore }, { token: PersistanceParamsController }, { token: QueryParamsController }, { token: SavedFiltersController }], target: i0.ɵɵFactoryTarget.Injectable });
2290
+ ExternalParamsController.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ExternalParamsController });
2291
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ExternalParamsController, decorators: [{
2292
+ type: Injectable
2293
+ }], ctorParameters: function () { return [{ type: FsFilterItemsStore }, { type: PersistanceParamsController }, { type: QueryParamsController }, { type: SavedFiltersController }]; } });
2294
+
2295
+ class ActionMenuItem {
2296
+ constructor(config = {}, _parent) {
2297
+ this._parent = _parent;
2298
+ this.items = [];
2299
+ this._isGroup = false;
2300
+ this._visible$ = new BehaviorSubject(true);
2301
+ this._disabled$ = new BehaviorSubject(false);
2302
+ this._init(config);
2303
+ }
2304
+ get isGroup() {
2305
+ return this._isGroup;
2306
+ }
2307
+ get visible() {
2308
+ return this._visible$.getValue();
2309
+ }
2310
+ get visible$() {
2311
+ return this._visible$.asObservable();
2312
+ }
2313
+ set disabled(value) {
2314
+ this._disabled$.next(value);
2315
+ }
2316
+ get disabled() {
2317
+ return this._disabled$.getValue();
2318
+ }
2319
+ get disabled$() {
2320
+ return this._disabled$.asObservable();
2321
+ }
2322
+ updateVisibility() {
2323
+ const visible = !!this._showFn ? this._showFn() : true;
2324
+ if (!visible || !this.isGroup) {
2325
+ this._visible$.next(visible);
2326
+ return;
2327
+ }
2328
+ const numberOfVisibleChildren = this.items
2329
+ .reduce((acc, item) => {
2330
+ item.updateVisibility();
2331
+ if (item.visible) {
2332
+ acc++;
2333
+ }
2334
+ return acc;
2335
+ }, 0);
2336
+ this._visible$.next(!!numberOfVisibleChildren);
2337
+ }
2338
+ _init(config) {
2339
+ this.label = config.label;
2340
+ this.icon = config.icon;
2341
+ this._showFn = config.show;
2342
+ if ('items' in config) {
2343
+ this._isGroup = true;
2344
+ if (Array.isArray(config.items)) {
2345
+ this.items = config
2346
+ .items
2347
+ .map((item) => new ActionMenuItem(item, this));
2348
+ }
2349
+ this.updateVisibility();
2350
+ }
2351
+ else {
2352
+ this.click = config.click;
2353
+ this.routerLink = config.link;
2354
+ if (!this._parent) {
2355
+ this.updateVisibility();
2356
+ }
2357
+ }
2358
+ }
2359
+ }
2360
+
2361
+ class Action {
2362
+ constructor(filterConfig, actionConfig = {}) {
2363
+ this.primary = true;
2364
+ this.isReorderAction = false;
2365
+ this.classArray = [];
2366
+ this.items = [];
2367
+ this._visible$ = new BehaviorSubject(true);
2368
+ this._disabled$ = new BehaviorSubject(false);
2369
+ this._init(filterConfig, actionConfig);
2370
+ }
2371
+ get visible() {
2372
+ return this._visible$.getValue();
2373
+ }
2374
+ get visible$() {
2375
+ return this._visible$.asObservable();
2376
+ }
2377
+ set disabled(value) {
2378
+ this._disabled$.next(value);
2379
+ }
2380
+ get disabled() {
2381
+ return this._disabled$.getValue();
2382
+ }
2383
+ get disabled$() {
2384
+ return this._disabled$.asObservable();
2385
+ }
2386
+ updateVisibility() {
2387
+ const visible = !!this._showFn ? this._showFn() : true;
2388
+ if (!visible || this.mode !== ActionMode.Menu) {
2389
+ this._visible$.next(visible);
2390
+ return;
2391
+ }
2392
+ const hasVisibleChildren = this.items.some((item) => item.visible);
2393
+ this._visible$.next(hasVisibleChildren);
2394
+ }
2395
+ updateDisabledState() {
2396
+ if (this._disabledFn) {
2397
+ this.disabled = this._disabledFn();
2398
+ }
2399
+ }
2400
+ _init(filterConfig, config = {}) {
2401
+ config.mode = config.mode ?? ActionMode.Button;
2402
+ this.primary = config.primary ?? true;
2403
+ this.color = config.color;
2404
+ this.tooltip = config.tooltip;
2405
+ this.label = config.label;
2406
+ this.mode = config.mode;
2407
+ this.icon = config.icon;
2408
+ this.iconPlacement = config.iconPlacement;
2409
+ this._showFn = config.show;
2410
+ this.tabIndex = config.tabIndex ?? 0;
2411
+ this.menu = config.menu;
2412
+ if (!this.type) {
2413
+ this.type = (config.type || filterConfig.button?.style || ActionType.Raised);
2414
+ if (this.type === ActionType.Stroked && this.primary) {
2415
+ this.type = ActionType.Flat;
2416
+ }
2417
+ }
2418
+ if (config.multiple !== undefined) {
2419
+ this.multiple = config.multiple;
2420
+ }
2421
+ if (config.className) {
2422
+ this.className = config.className;
2423
+ this.classArray = this.className
2424
+ .split(' ');
2425
+ }
2426
+ if (this.primary) {
2427
+ this.color = 'primary';
2428
+ }
2429
+ switch (config.mode) {
2430
+ case ActionMode.Button:
2431
+ {
2432
+ this.customize = config.customize;
2433
+ this.click = config.click ?? (() => { });
2434
+ this._disabledFn = config.disabled;
2435
+ this.updateDisabledState();
2436
+ }
2437
+ break;
2438
+ case ActionMode.Menu:
2439
+ {
2440
+ if (config.items && Array.isArray(config.items)) {
2441
+ this.items = config.items.map((item) => new ActionMenuItem(item));
2442
+ }
2443
+ }
2444
+ break;
2445
+ case ActionMode.File:
2446
+ {
2447
+ this.fileSelected = config.select;
2448
+ this.fileError = config.error;
2449
+ this.accept = config.accept;
2450
+ this.imageQuality = config.imageQuality;
2451
+ this.minWidth = config.minWidth;
2452
+ this.minHeight = config.minHeight;
2453
+ this.maxWidth = config.maxWidth;
2454
+ this.maxHeight = config.maxHeight;
2455
+ this.click = config.click ?? (() => { });
2456
+ this._disabledFn = config.disabled;
2457
+ this.updateDisabledState();
2458
+ }
2459
+ break;
2460
+ }
2461
+ this.updateVisibility();
2462
+ }
2463
+ }
2464
+
2465
+ class FsFilterActionButtonComponent {
2466
+ constructor() {
2467
+ this.ActionType = ActionType;
2468
+ }
2469
+ }
2470
+ FsFilterActionButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFilterActionButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2471
+ FsFilterActionButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: FsFilterActionButtonComponent, selector: "fs-filter-action-button", inputs: { action: "action" }, host: { classAttribute: "action-button" }, ngImport: i0, template: "<ng-container [ngSwitch]=\"action.type\">\n <button\n type=\"button\"\n *ngSwitchCase=\"ActionType.Icon\"\n mat-icon-button\n (click)=\"action.click && action.click($event)\"\n [color]=\"action.color\"\n [ngClass]=\"action.classArray\"\n [disabled]=\"action.disabled$ | async\"\n [tabIndex]=\"action.tabIndex\">\n <ng-template [ngTemplateOutlet]=\"buttonContent\"></ng-template>\n </button>\n\n <!-- Fab button -->\n <button \n type=\"button\"\n *ngSwitchCase=\"ActionType.Fab\"\n mat-fab\n (click)=\"action.click && action.click($event)\"\n [color]=\"action.color\"\n [ngClass]=\"action.classArray\"\n [disabled]=\"action.disabled$ | async\"\n [tabIndex]=\"action.tabIndex\">\n <ng-template [ngTemplateOutlet]=\"buttonContent\"></ng-template>\n </button>\n\n <!-- Mini Fab button -->\n <button \n type=\"button\"\n *ngSwitchCase=\"ActionType.MiniFab\"\n mat-mini-fab\n (click)=\"action.click && action.click($event)\"\n [color]=\"action.color\"\n [ngClass]=\"action.classArray\"\n [disabled]=\"action.disabled$ | async\"\n [tabIndex]=\"action.tabIndex\">\n <ng-template [ngTemplateOutlet]=\"buttonContent\"></ng-template>\n </button>\n\n <button \n type=\"button\"\n *ngSwitchDefault\n mat-button\n [ngClass]=\"{ \n 'mat-raised-button': action.type === 'raised',\n 'mat-flat-button': action.type === 'flat',\n 'mat-stroked-button': action.type === 'stroked',\n 'mat-button': action.type === 'basic',\n 'mat-icon-button': action.type === 'icon'\n }\"\n (click)=\"action.click && action.click($event)\"\n [color]=\"action.color\"\n [class]=\"action.classArray.join(' ')\"\n [disabled]=\"action.disabled$ | async\"\n [tabIndex]=\"action.tabIndex\">\n <ng-template [ngTemplateOutlet]=\"buttonContent\"></ng-template>\n </button>\n\n <ng-template #buttonContent>\n <ng-container *ngIf=\"!action.icon else withIcon\">\n {{action.label}}\n </ng-container>\n\n <ng-template #withIcon>\n <mat-icon *ngIf=\"!action.iconPlacement || action.iconPlacement === 'left'\">{{action.icon}}</mat-icon>\n {{action.label}}\n <mat-icon *ngIf=\"action.iconPlacement === 'right'\">{{action.icon}}</mat-icon>\n </ng-template>\n </ng-template>\n</ng-container>\n", components: [{ type: i1$4.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i3.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i3.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { type: i7.FsButtonDirective, selector: "[mat-raised-button],[mat-button],[mat-flat-button],[mat-stroked-button]", inputs: ["name", "dirtySubmit", "form"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i3.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
2472
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFilterActionButtonComponent, decorators: [{
2473
+ type: Component,
2474
+ args: [{ selector: 'fs-filter-action-button', host: {
2475
+ class: 'action-button',
2476
+ }, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container [ngSwitch]=\"action.type\">\n <button\n type=\"button\"\n *ngSwitchCase=\"ActionType.Icon\"\n mat-icon-button\n (click)=\"action.click && action.click($event)\"\n [color]=\"action.color\"\n [ngClass]=\"action.classArray\"\n [disabled]=\"action.disabled$ | async\"\n [tabIndex]=\"action.tabIndex\">\n <ng-template [ngTemplateOutlet]=\"buttonContent\"></ng-template>\n </button>\n\n <!-- Fab button -->\n <button \n type=\"button\"\n *ngSwitchCase=\"ActionType.Fab\"\n mat-fab\n (click)=\"action.click && action.click($event)\"\n [color]=\"action.color\"\n [ngClass]=\"action.classArray\"\n [disabled]=\"action.disabled$ | async\"\n [tabIndex]=\"action.tabIndex\">\n <ng-template [ngTemplateOutlet]=\"buttonContent\"></ng-template>\n </button>\n\n <!-- Mini Fab button -->\n <button \n type=\"button\"\n *ngSwitchCase=\"ActionType.MiniFab\"\n mat-mini-fab\n (click)=\"action.click && action.click($event)\"\n [color]=\"action.color\"\n [ngClass]=\"action.classArray\"\n [disabled]=\"action.disabled$ | async\"\n [tabIndex]=\"action.tabIndex\">\n <ng-template [ngTemplateOutlet]=\"buttonContent\"></ng-template>\n </button>\n\n <button \n type=\"button\"\n *ngSwitchDefault\n mat-button\n [ngClass]=\"{ \n 'mat-raised-button': action.type === 'raised',\n 'mat-flat-button': action.type === 'flat',\n 'mat-stroked-button': action.type === 'stroked',\n 'mat-button': action.type === 'basic',\n 'mat-icon-button': action.type === 'icon'\n }\"\n (click)=\"action.click && action.click($event)\"\n [color]=\"action.color\"\n [class]=\"action.classArray.join(' ')\"\n [disabled]=\"action.disabled$ | async\"\n [tabIndex]=\"action.tabIndex\">\n <ng-template [ngTemplateOutlet]=\"buttonContent\"></ng-template>\n </button>\n\n <ng-template #buttonContent>\n <ng-container *ngIf=\"!action.icon else withIcon\">\n {{action.label}}\n </ng-container>\n\n <ng-template #withIcon>\n <mat-icon *ngIf=\"!action.iconPlacement || action.iconPlacement === 'left'\">{{action.icon}}</mat-icon>\n {{action.label}}\n <mat-icon *ngIf=\"action.iconPlacement === 'right'\">{{action.icon}}</mat-icon>\n </ng-template>\n </ng-template>\n</ng-container>\n" }]
2477
+ }], propDecorators: { action: [{
2478
+ type: Input
2479
+ }] } });
2480
+
2481
+ class FsFilterActionKebabActionsComponent {
2482
+ }
2483
+ FsFilterActionKebabActionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFilterActionKebabActionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2484
+ FsFilterActionKebabActionsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: FsFilterActionKebabActionsComponent, selector: "fs-filter-action-kebab-actions", inputs: { kebabActions: "kebabActions" }, ngImport: i0, template: "<button \n type=\"button\"\n mat-icon-button\n class=\"menu-button\"\n [fsMenuTriggerFor]=\"kebabActionsMenu\">\n <mat-icon>more_vert</mat-icon>\n</button>\n<fs-menu #kebabActionsMenu>\n <ng-container *ngFor=\"let action of kebabActions\">\n <ng-container [ngSwitch]=\"action.mode\">\n <!-- Case when actions was collapsed from action with mode = 'menu'-->\n <ng-container *ngSwitchCase=\"'menu'\">\n <ng-container *ngFor=\"let childAction of action.items\">\n <ng-container *ngIf=\"childAction.isGroup else simpleMenuItem\">\n <fs-menu-group>\n <ng-template fs-group-menu-item-template>\n {{ action.label }} <mat-icon style=\"margin: 0;\">arrow_right</mat-icon> {{childAction.label}}\n </ng-template>\n <ng-container *ngFor=\"let subAction of childAction.items\">\n <ng-template \n fs-menu-item\n [link]=\"subAction.routerLink?.link\"\n [queryParams]=\"subAction.routerLink?.queryParams\"\n [hidden]=\"!(subAction.visible$ | async)\"\n (click)=\"subAction.click($event)\">\n <mat-icon *ngIf=\"subAction.icon\">{{subAction.icon}}</mat-icon>\n {{subAction.label}}\n </ng-template>\n </ng-container>\n </fs-menu-group>\n </ng-container>\n <ng-template #simpleMenuItem>\n <ng-template \n fs-menu-item\n [link]=\"childAction.routerLink?.link\"\n [queryParams]=\"childAction.routerLink?.queryParams\"\n [hidden]=\"!(childAction.visible$ | async)\"\n (click)=\"childAction.click($event);\">\n <mat-icon *ngIf=\"childAction.icon\">{{childAction.icon}}</mat-icon>\n {{ action.label }} <mat-icon style=\"margin: 0;\">arrow_right</mat-icon>{{ childAction.label }}\n </ng-template>\n </ng-template>\n </ng-container>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'file'\">\n <ng-template \n fs-menu-file-item\n [fsClass]=\"action.classArray\"\n [multiple]=\"action.multiple\"\n [accept]=\"action.accept || '*'\"\n [minWidth]=\"action.minWidth\"\n [minHeight]=\"action.minHeight\"\n [imageWidth]=\"action.maxWidth\"\n [imageHeight]=\"action.maxHeight\"\n (error)=\"action.fileError($event)\"\n (select)=\"action.fileSelected($event)\"\n (click)=\"action.click($event)\">\n <mat-icon *ngIf=\"action.icon\">{{action.icon}}</mat-icon> {{action.label}}\n </ng-template>\n </ng-container>\n\n <ng-container *ngSwitchDefault>\n <ng-template \n fs-menu-item\n (click)=\"action.click($event)\"\n [fsClass]=\"action.classArray\">\n <mat-icon *ngIf=\"action.icon\">{{action.icon}}</mat-icon> {{action.label}}\n </ng-template>\n </ng-container>\n\n </ng-container>\n </ng-container>\n</fs-menu>\n", styles: [".menu-button{width:36px;height:36px;line-height:36px}\n"], components: [{ type: i1$4.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i3$3.FsMenuComponent, selector: "fs-menu", inputs: ["class", "buttonClass", "buttonType", "buttonColor"], outputs: ["opened", "closed"] }], directives: [{ type: i3$3.FsMenuTriggerDirective, selector: "[fsMenuTriggerFor]", inputs: ["fsMenuTriggerFor"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i3.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3$3.FsMenuItemDirective, selector: "fs-menu-group,[fs-menu-item]" }, { type: i3$3.FsGroupMenuItemTemplateDirective, selector: "[fs-group-menu-item-template]" }, { type: i3$3.FsMenuFileItemDirective, selector: "[fs-menu-file-item]", inputs: ["multiple", "accept", "minWidth", "minHeight", "imageWidth", "imageHeight"], outputs: ["select", "error"] }, { type: i3.NgSwitchDefault, selector: "[ngSwitchDefault]" }], pipes: { "async": i3.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
2485
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFilterActionKebabActionsComponent, decorators: [{
2486
+ type: Component,
2487
+ args: [{ selector: 'fs-filter-action-kebab-actions', changeDetection: ChangeDetectionStrategy.OnPush, template: "<button \n type=\"button\"\n mat-icon-button\n class=\"menu-button\"\n [fsMenuTriggerFor]=\"kebabActionsMenu\">\n <mat-icon>more_vert</mat-icon>\n</button>\n<fs-menu #kebabActionsMenu>\n <ng-container *ngFor=\"let action of kebabActions\">\n <ng-container [ngSwitch]=\"action.mode\">\n <!-- Case when actions was collapsed from action with mode = 'menu'-->\n <ng-container *ngSwitchCase=\"'menu'\">\n <ng-container *ngFor=\"let childAction of action.items\">\n <ng-container *ngIf=\"childAction.isGroup else simpleMenuItem\">\n <fs-menu-group>\n <ng-template fs-group-menu-item-template>\n {{ action.label }} <mat-icon style=\"margin: 0;\">arrow_right</mat-icon> {{childAction.label}}\n </ng-template>\n <ng-container *ngFor=\"let subAction of childAction.items\">\n <ng-template \n fs-menu-item\n [link]=\"subAction.routerLink?.link\"\n [queryParams]=\"subAction.routerLink?.queryParams\"\n [hidden]=\"!(subAction.visible$ | async)\"\n (click)=\"subAction.click($event)\">\n <mat-icon *ngIf=\"subAction.icon\">{{subAction.icon}}</mat-icon>\n {{subAction.label}}\n </ng-template>\n </ng-container>\n </fs-menu-group>\n </ng-container>\n <ng-template #simpleMenuItem>\n <ng-template \n fs-menu-item\n [link]=\"childAction.routerLink?.link\"\n [queryParams]=\"childAction.routerLink?.queryParams\"\n [hidden]=\"!(childAction.visible$ | async)\"\n (click)=\"childAction.click($event);\">\n <mat-icon *ngIf=\"childAction.icon\">{{childAction.icon}}</mat-icon>\n {{ action.label }} <mat-icon style=\"margin: 0;\">arrow_right</mat-icon>{{ childAction.label }}\n </ng-template>\n </ng-template>\n </ng-container>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'file'\">\n <ng-template \n fs-menu-file-item\n [fsClass]=\"action.classArray\"\n [multiple]=\"action.multiple\"\n [accept]=\"action.accept || '*'\"\n [minWidth]=\"action.minWidth\"\n [minHeight]=\"action.minHeight\"\n [imageWidth]=\"action.maxWidth\"\n [imageHeight]=\"action.maxHeight\"\n (error)=\"action.fileError($event)\"\n (select)=\"action.fileSelected($event)\"\n (click)=\"action.click($event)\">\n <mat-icon *ngIf=\"action.icon\">{{action.icon}}</mat-icon> {{action.label}}\n </ng-template>\n </ng-container>\n\n <ng-container *ngSwitchDefault>\n <ng-template \n fs-menu-item\n (click)=\"action.click($event)\"\n [fsClass]=\"action.classArray\">\n <mat-icon *ngIf=\"action.icon\">{{action.icon}}</mat-icon> {{action.label}}\n </ng-template>\n </ng-container>\n\n </ng-container>\n </ng-container>\n</fs-menu>\n", styles: [".menu-button{width:36px;height:36px;line-height:36px}\n"] }]
2488
+ }], propDecorators: { kebabActions: [{
2489
+ type: Input
2490
+ }] } });
2491
+
2492
+ class FsFilterActionsComponent {
2493
+ constructor() {
2494
+ this.kebabActions = [];
2495
+ this.actions = [];
2496
+ }
2497
+ }
2498
+ FsFilterActionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFilterActionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2499
+ FsFilterActionsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: FsFilterActionsComponent, selector: "fs-filter-actions", inputs: { kebabActions: "kebabActions", actions: "actions" }, ngImport: i0, template: "<!-- Buttons -->\n<ng-container *ngFor=\"let action of actions\">\n <ng-container [ngSwitch]=\"action.mode\">\n <ng-container *ngSwitchCase=\"'button'\">\n <fs-filter-action-button\n [action]=\"action\"\n fsPopover\n [enabled]=\"!!action.tooltip\"\n [text]=\"action.tooltip\">\n </fs-filter-action-button>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'menu'\">\n <fs-filter-action-button\n [action]=\"action\"\n [fsMenuTriggerFor]=\"someRef\"\n fsPopover\n [enabled]=\"!!action.tooltip\"\n [text]=\"action.tooltip\">\n </fs-filter-action-button>\n\n <fs-menu #someRef>\n <ng-container *ngFor=\"let childAction of action.items\">\n <ng-container *ngIf=\"childAction.isGroup else simpleMenuItem\">\n <fs-menu-group [label]=\"childAction.label\">\n <ng-container *ngFor=\"let subAction of childAction.items\">\n <ng-template\n fs-menu-item\n [link]=\"subAction.routerLink?.link\"\n [queryParams]=\"subAction.routerLink?.queryParams\"\n [hidden]=\"!(subAction.visible$ | async)\"\n (click)=\"subAction.click($event)\">\n <mat-icon *ngIf=\"subAction.icon\">{{subAction.icon}}</mat-icon>\n {{subAction.label}}\n </ng-template>\n </ng-container>\n </fs-menu-group>\n </ng-container>\n <ng-template #simpleMenuItem>\n <ng-template\n fs-menu-item\n [link]=\"childAction.routerLink?.link\"\n [queryParams]=\"childAction.routerLink?.queryParams\"\n [hidden]=\"!(childAction.visible$ | async)\"\n (click)=\"childAction.click($event);\">\n <mat-icon *ngIf=\"childAction.icon\">{{childAction.icon}}</mat-icon>\n {{childAction.label}}\n </ng-template>\n </ng-template>\n </ng-container>\n </fs-menu>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'file'\">\n <fs-file\n class=\"action-button\"\n [accept]=\"action.accept || '*'\"\n [multiple]=\"action.multiple\"\n [minWidth]=\"action.minWidth\"\n [minHeight]=\"action.minHeight\"\n [imageWidth]=\"action.maxWidth\"\n [imageHeight]=\"action.maxHeight\"\n (select)=\"action.fileSelected($event)\"\n (error)=\"action.fileError($event)\"\n (clicked)=\"action.click($event)\"\n fsPopover\n [enabled]=\"!!action.tooltip\"\n [text]=\"action.tooltip\">\n <fs-filter-action-button \n [action]=\"action\">\n </fs-filter-action-button>\n </fs-file>\n </ng-container>\n </ng-container>\n</ng-container>\n<!-- /Buttons -->\n<!-- menu -->\n<ng-container *ngIf=\"kebabActions?.length\">\n <fs-filter-action-kebab-actions\n [kebabActions]=\"kebabActions\">\n </fs-filter-action-kebab-actions>\n</ng-container>\n", styles: [":host{display:inline-flex}.action-button{display:block}.action-button+.action-button,fs-menu+.action-button{margin-left:5px}.menu-button{width:36px;height:36px;line-height:36px}\n"], components: [{ type: FsFilterActionButtonComponent, selector: "fs-filter-action-button", inputs: ["action"] }, { type: i3$3.FsMenuComponent, selector: "fs-menu", inputs: ["class", "buttonClass", "buttonType", "buttonColor"], outputs: ["opened", "closed"] }, { type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i4$1.FsFileComponent, selector: "fs-file", inputs: ["minHeight", "minWidth", "orientate", "multiple", "capture", "allowClick", "allowDrop", "accept", "disabled", "imageWidth", "imageHeight", "imageQuality"], outputs: ["select", "selectPreviews", "error", "clicked", "declined"] }, { type: FsFilterActionKebabActionsComponent, selector: "fs-filter-action-kebab-actions", inputs: ["kebabActions"] }], directives: [{ type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i3.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i7$1.FsPopoverDirective, selector: "[fsPopover]", inputs: ["text", "template", "data", "leaveDelay", "showDelay", "maxWidth", "wrapperClass", "autoShow", "autoClose", "loadingDiameter", "loading", "indication", "position", "theme", "size", "trigger", "enabled"] }, { type: i3$3.FsMenuTriggerDirective, selector: "[fsMenuTriggerFor]", inputs: ["fsMenuTriggerFor"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3$3.FsMenuItemDirective, selector: "fs-menu-group,[fs-menu-item]" }], pipes: { "async": i3.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
2500
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFilterActionsComponent, decorators: [{
2501
+ type: Component,
2502
+ args: [{ selector: 'fs-filter-actions', changeDetection: ChangeDetectionStrategy.OnPush, template: "<!-- Buttons -->\n<ng-container *ngFor=\"let action of actions\">\n <ng-container [ngSwitch]=\"action.mode\">\n <ng-container *ngSwitchCase=\"'button'\">\n <fs-filter-action-button\n [action]=\"action\"\n fsPopover\n [enabled]=\"!!action.tooltip\"\n [text]=\"action.tooltip\">\n </fs-filter-action-button>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'menu'\">\n <fs-filter-action-button\n [action]=\"action\"\n [fsMenuTriggerFor]=\"someRef\"\n fsPopover\n [enabled]=\"!!action.tooltip\"\n [text]=\"action.tooltip\">\n </fs-filter-action-button>\n\n <fs-menu #someRef>\n <ng-container *ngFor=\"let childAction of action.items\">\n <ng-container *ngIf=\"childAction.isGroup else simpleMenuItem\">\n <fs-menu-group [label]=\"childAction.label\">\n <ng-container *ngFor=\"let subAction of childAction.items\">\n <ng-template\n fs-menu-item\n [link]=\"subAction.routerLink?.link\"\n [queryParams]=\"subAction.routerLink?.queryParams\"\n [hidden]=\"!(subAction.visible$ | async)\"\n (click)=\"subAction.click($event)\">\n <mat-icon *ngIf=\"subAction.icon\">{{subAction.icon}}</mat-icon>\n {{subAction.label}}\n </ng-template>\n </ng-container>\n </fs-menu-group>\n </ng-container>\n <ng-template #simpleMenuItem>\n <ng-template\n fs-menu-item\n [link]=\"childAction.routerLink?.link\"\n [queryParams]=\"childAction.routerLink?.queryParams\"\n [hidden]=\"!(childAction.visible$ | async)\"\n (click)=\"childAction.click($event);\">\n <mat-icon *ngIf=\"childAction.icon\">{{childAction.icon}}</mat-icon>\n {{childAction.label}}\n </ng-template>\n </ng-template>\n </ng-container>\n </fs-menu>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'file'\">\n <fs-file\n class=\"action-button\"\n [accept]=\"action.accept || '*'\"\n [multiple]=\"action.multiple\"\n [minWidth]=\"action.minWidth\"\n [minHeight]=\"action.minHeight\"\n [imageWidth]=\"action.maxWidth\"\n [imageHeight]=\"action.maxHeight\"\n (select)=\"action.fileSelected($event)\"\n (error)=\"action.fileError($event)\"\n (clicked)=\"action.click($event)\"\n fsPopover\n [enabled]=\"!!action.tooltip\"\n [text]=\"action.tooltip\">\n <fs-filter-action-button \n [action]=\"action\">\n </fs-filter-action-button>\n </fs-file>\n </ng-container>\n </ng-container>\n</ng-container>\n<!-- /Buttons -->\n<!-- menu -->\n<ng-container *ngIf=\"kebabActions?.length\">\n <fs-filter-action-kebab-actions\n [kebabActions]=\"kebabActions\">\n </fs-filter-action-kebab-actions>\n</ng-container>\n", styles: [":host{display:inline-flex}.action-button{display:block}.action-button+.action-button,fs-menu+.action-button{margin-left:5px}.menu-button{width:36px;height:36px;line-height:36px}\n"] }]
2503
+ }], propDecorators: { kebabActions: [{
2504
+ type: Input
2505
+ }], actions: [{
2506
+ type: Input
2507
+ }] } });
2508
+
2509
+ class FsFilterChipContentComponent {
2510
+ constructor(_cdRef) {
2511
+ this._cdRef = _cdRef;
2512
+ this._destroy$ = new Subject();
2513
+ }
2514
+ ngOnInit() {
2515
+ this.listenValueChangesForRanges();
2516
+ }
2517
+ ngOnDestroy() {
2518
+ this._destroy$.next();
2519
+ this._destroy$.complete();
2520
+ }
2521
+ listenValueChangesForRanges() {
2522
+ this.item.value$
2523
+ .pipe(takeUntil(this._destroy$))
2524
+ .subscribe(() => {
2525
+ this.content = this._getContent();
2526
+ this._cdRef.detectChanges();
2527
+ });
2528
+ }
2529
+ _getContent() {
2530
+ const result = this.item.getChipsContent(this.type);
2531
+ if (this.item.chipLabel !== undefined) {
2532
+ if (this.item.chipLabel === '') {
2533
+ return `${result}`;
2534
+ }
2535
+ else {
2536
+ if (Array.isArray(this.item.chipLabel)) {
2537
+ const label = getLabelFromArray(this.item.chipLabel, this.type);
2538
+ return `${label}: ${result}`;
2539
+ }
2540
+ else {
2541
+ return `${this.item.chipLabel}: ${result}`;
2542
+ }
2543
+ }
2544
+ }
2545
+ else {
2546
+ if (Array.isArray(this.item.label)) {
2547
+ const label = getLabelFromArray(this.item.label, this.type);
2548
+ return `${label}: ${result}`;
2549
+ }
2550
+ else {
2551
+ if (this.item.isTypeCheckbox) {
2552
+ return result;
2553
+ }
2554
+ else {
2555
+ return `${this.item.label}: ${result}`;
2556
+ }
2557
+ }
2558
+ }
2559
+ }
2560
+ }
2561
+ FsFilterChipContentComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFilterChipContentComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2562
+ FsFilterChipContentComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: FsFilterChipContentComponent, selector: "fs-filter-chip-content", inputs: { item: "item", type: "type" }, ngImport: i0, template: "{{ content }}\n", styles: [""], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2563
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFilterChipContentComponent, decorators: [{
2564
+ type: Component,
2565
+ args: [{ selector: 'fs-filter-chip-content', changeDetection: ChangeDetectionStrategy.OnPush, template: "{{ content }}\n", styles: [""] }]
2566
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { item: [{
2567
+ type: Input
2568
+ }], type: [{
2569
+ type: Input
2570
+ }] } });
2571
+ function getLabelFromArray(labelArr, type) {
2572
+ if (type === 'from' && labelArr[0]) {
2573
+ return `${labelArr[0]}`;
2574
+ }
2575
+ else if (type === 'to' && labelArr[1]) {
2576
+ return `${labelArr[1]}`;
2577
+ }
2578
+ else {
2579
+ return '';
2580
+ }
2581
+ }
2582
+
2583
+ class FocusControllerService {
2584
+ constructor() {
2585
+ this._focusOn = new BehaviorSubject(null);
2586
+ }
2587
+ get focusOn$() {
2588
+ return this._focusOn.asObservable();
2589
+ }
2590
+ click(item, type = null) {
2591
+ this._focusOn.next({ item, type });
2592
+ }
2593
+ listenFocusFor$(targetItem, targetType = null) {
2594
+ return this._focusOn
2595
+ .pipe(filter$1((event) => !!event), filter$1(({ item, type }) => {
2596
+ return targetItem === item && targetType === type;
2597
+ }), tap(() => this.clearFocus()));
2598
+ }
2599
+ clearFocus() {
2600
+ this._focusOn.next(null);
2601
+ }
2602
+ }
2603
+ FocusControllerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FocusControllerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2604
+ FocusControllerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FocusControllerService });
2605
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FocusControllerService, decorators: [{
2606
+ type: Injectable
2607
+ }], ctorParameters: function () { return []; } });
2608
+
2609
+ class FsFilterChipComponent {
2610
+ constructor(_cdRef, _focusController) {
2611
+ this._cdRef = _cdRef;
2612
+ this._focusController = _focusController;
2613
+ this._chipRenderTimer$ = timer(500)
2614
+ .pipe(mapTo(true));
2615
+ this._destroy$ = new Subject();
2616
+ }
2617
+ ngOnInit() {
2618
+ this.rangeItem = this.item.isTypeDateRange
2619
+ || this.item.isTypeRange
2620
+ || this.item.isTypeDateTimeRange;
2621
+ this.listenValueChangesForRanges();
2622
+ this._updateVisibility();
2623
+ if (this.item.hasPendingValues) {
2624
+ this.item.loadAsyncValues(false);
2625
+ this.item.values$
2626
+ .pipe(take(2), takeUntil(this._destroy$))
2627
+ .subscribe(() => {
2628
+ this._updateVisibility();
2629
+ this._cdRef.markForCheck();
2630
+ });
2631
+ this._initDelayRender();
2632
+ }
2633
+ }
2634
+ ngOnDestroy() {
2635
+ this._destroy$.next();
2636
+ this._destroy$.complete();
2637
+ }
2638
+ focusOnItem(type = null) {
2639
+ this._focusController.click(this.item, type);
2640
+ }
2641
+ removeItem(event, type = null) {
2642
+ if (this.item instanceof RangeItem) {
2643
+ this.item.clearRange(type);
2644
+ }
2645
+ else if (this.item instanceof DateRangeItem || this.item instanceof DateTimeRangeItem) {
2646
+ this.item.clearDateRange(type);
2647
+ }
2648
+ else {
2649
+ this.item.clear();
2650
+ }
2651
+ }
2652
+ listenValueChangesForRanges() {
2653
+ this.item.value$
2654
+ .pipe(distinctUntilChanged(), takeUntil(this._destroy$))
2655
+ .subscribe(() => {
2656
+ this._updateVisibility();
2657
+ this._cdRef.markForCheck();
2658
+ });
2659
+ }
2660
+ _updateVisibility() {
2661
+ this.itemVisible = this.item.isChipVisible;
2662
+ }
2663
+ _initDelayRender() {
2664
+ this.chipDelayedRender$ = combineLatest([
2665
+ this.item.values$,
2666
+ this._chipRenderTimer$.pipe(startWith(false)),
2667
+ ])
2668
+ .pipe(map(([values, timerValue]) => {
2669
+ return !!values || timerValue;
2670
+ }));
2671
+ }
2672
+ }
2673
+ FsFilterChipComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFilterChipComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: FocusControllerService }], target: i0.ɵɵFactoryTarget.Component });
2674
+ FsFilterChipComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: FsFilterChipComponent, selector: "fs-filter-chip", inputs: { item: "item" }, ngImport: i0, template: "<ng-container *ngIf=\"!item.hasPendingValues || (chipDelayedRender$ | async)\">\n <ng-container *ngIf=\"rangeItem; else defaultChip\">\n <fs-chip\n *ngIf=\"item.model?.min || item.model?.from\"\n [value]=\"item\"\n [selectable]=\"false\"\n [removable]=\"item.showClear\"\n size=\"small\"\n (click)=\"focusOnItem('from')\"\n (removed)=\"removeItem($event, 'from')\">\n <ng-template\n [ngTemplateOutlet]=\"chipContent\"\n [ngTemplateOutletContext]=\"{ item: item, type: 'from' }\"\n ></ng-template>\n </fs-chip>\n\n <fs-chip\n *ngIf=\"item.model?.max || item.model?.to\"\n [value]=\"item\"\n [selectable]=\"false\"\n [removable]=\"item.showClear\"\n size=\"small\"\n (click)=\"focusOnItem('to')\"\n (removed)=\"removeItem($event, 'to')\">\n <ng-template\n [ngTemplateOutlet]=\"chipContent\"\n [ngTemplateOutletContext]=\"{ item: item, type: 'to' }\"\n ></ng-template>\n </fs-chip>\n\n </ng-container>\n\n <ng-template #defaultChip>\n <fs-chip\n *ngIf=\"itemVisible\"\n [value]=\"item\"\n [selectable]=\"false\"\n [removable]=\"item.showClear\"\n size=\"small\"\n (click)=\"focusOnItem()\"\n (removed)=\"removeItem($event)\">\n <ng-template\n [ngTemplateOutlet]=\"chipContent\"\n [ngTemplateOutletContext]=\"{ item: item }\"\n ></ng-template>\n </fs-chip>\n </ng-template>\n\n <ng-template #chipContent let-item=\"item\" let-type=\"type\">\n <ng-container *ngIf=\"!item.hasPendingValues && !item.loading; else lodaingValues\">\n <fs-filter-chip-content [item]=\"item\" [type]=\"type\"></fs-filter-chip-content>\n </ng-container>\n\n <ng-template #lodaingValues>\n Loading...\n </ng-template>\n </ng-template>\n</ng-container>\n\n", styles: ["fs-chip{cursor:pointer;color:#6f6f6f}\n"], components: [{ type: i2$2.FsChipComponent, selector: "fs-chip", inputs: ["size", "value", "backgroundColor", "borderColor", "color", "outlined", "removable", "selectable", "selected", "image"], outputs: ["selectedToggled", "removed"] }, { type: FsFilterChipContentComponent, selector: "fs-filter-chip-content", inputs: ["item", "type"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "async": i3.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
2675
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFilterChipComponent, decorators: [{
2676
+ type: Component,
2677
+ args: [{ selector: 'fs-filter-chip', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"!item.hasPendingValues || (chipDelayedRender$ | async)\">\n <ng-container *ngIf=\"rangeItem; else defaultChip\">\n <fs-chip\n *ngIf=\"item.model?.min || item.model?.from\"\n [value]=\"item\"\n [selectable]=\"false\"\n [removable]=\"item.showClear\"\n size=\"small\"\n (click)=\"focusOnItem('from')\"\n (removed)=\"removeItem($event, 'from')\">\n <ng-template\n [ngTemplateOutlet]=\"chipContent\"\n [ngTemplateOutletContext]=\"{ item: item, type: 'from' }\"\n ></ng-template>\n </fs-chip>\n\n <fs-chip\n *ngIf=\"item.model?.max || item.model?.to\"\n [value]=\"item\"\n [selectable]=\"false\"\n [removable]=\"item.showClear\"\n size=\"small\"\n (click)=\"focusOnItem('to')\"\n (removed)=\"removeItem($event, 'to')\">\n <ng-template\n [ngTemplateOutlet]=\"chipContent\"\n [ngTemplateOutletContext]=\"{ item: item, type: 'to' }\"\n ></ng-template>\n </fs-chip>\n\n </ng-container>\n\n <ng-template #defaultChip>\n <fs-chip\n *ngIf=\"itemVisible\"\n [value]=\"item\"\n [selectable]=\"false\"\n [removable]=\"item.showClear\"\n size=\"small\"\n (click)=\"focusOnItem()\"\n (removed)=\"removeItem($event)\">\n <ng-template\n [ngTemplateOutlet]=\"chipContent\"\n [ngTemplateOutletContext]=\"{ item: item }\"\n ></ng-template>\n </fs-chip>\n </ng-template>\n\n <ng-template #chipContent let-item=\"item\" let-type=\"type\">\n <ng-container *ngIf=\"!item.hasPendingValues && !item.loading; else lodaingValues\">\n <fs-filter-chip-content [item]=\"item\" [type]=\"type\"></fs-filter-chip-content>\n </ng-container>\n\n <ng-template #lodaingValues>\n Loading...\n </ng-template>\n </ng-template>\n</ng-container>\n\n", styles: ["fs-chip{cursor:pointer;color:#6f6f6f}\n"] }]
2678
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: FocusControllerService }]; }, propDecorators: { item: [{
2679
+ type: Input
2680
+ }] } });
2681
+
2682
+ class FsFilterChipsComponent {
2683
+ constructor() {
2684
+ this.ItemType = ItemType;
2685
+ this.chips = [];
2686
+ }
2687
+ }
2688
+ FsFilterChipsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFilterChipsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2689
+ FsFilterChipsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: FsFilterChipsComponent, selector: "fs-filter-chips", inputs: { filters: "filters" }, ngImport: i0, template: "<fs-chips [(ngModel)]=\"chips\">\n <ng-container *ngFor=\"let item of filters\">\n <ng-container *ngIf=\"(item.value$ | async) !== undefined && item.type !== ItemType.Keyword\">\n <fs-filter-chip [item]=\"item\"></fs-filter-chip>\n </ng-container>\n </ng-container>\n</fs-chips>\n", styles: [""], components: [{ type: i2$2.FsChipsComponent, selector: "fs-chips", inputs: ["compare", "multiple"] }, { type: FsFilterChipComponent, selector: "fs-filter-chip", inputs: ["item"] }], directives: [{ type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i7.FsFormNoFsValidatorsDirective, selector: "[ngModel]:not([required]):not([fsFormRequired]):not([fsFormCompare]):not([fsFormDateRange]):not([fsFormEmail]):not([fsFormEmails]):not([fsFormFunction]):not([fsFormGreater]):not([fsFormInteger]):not([fsFormLesser]):not([fsFormMax]):not([fsFormMaxLength]):not([fsFormMin]):not([fsFormMinLength]):not([fsFormNumeric]):not([fsFormPattern]):not([fsFormPhone]):not([fsFormUrl]):not([validate])" }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i3.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
2690
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFilterChipsComponent, decorators: [{
2691
+ type: Component,
2692
+ args: [{ selector: 'fs-filter-chips', changeDetection: ChangeDetectionStrategy.OnPush, template: "<fs-chips [(ngModel)]=\"chips\">\n <ng-container *ngFor=\"let item of filters\">\n <ng-container *ngIf=\"(item.value$ | async) !== undefined && item.type !== ItemType.Keyword\">\n <fs-filter-chip [item]=\"item\"></fs-filter-chip>\n </ng-container>\n </ng-container>\n</fs-chips>\n", styles: [""] }]
2693
+ }], propDecorators: { filters: [{
2694
+ type: Input
2695
+ }] } });
2696
+
2697
+ class FsFilterDrawerActionsComponent {
2698
+ constructor(externalParams) {
2699
+ this.externalParams = externalParams;
2700
+ this._clear = new EventEmitter();
2701
+ this._done = new EventEmitter();
2702
+ }
2703
+ get savedFilters() {
2704
+ return this.externalParams.savedFiltersController;
2705
+ }
2706
+ done() {
2707
+ this._done.emit();
2708
+ }
2709
+ clear() {
2710
+ this._clear.emit();
2711
+ }
2712
+ saveFilters() {
2713
+ this.externalParams
2714
+ .savedFiltersController
2715
+ .openSavedFilterEditDialog();
2716
+ }
2717
+ }
2718
+ FsFilterDrawerActionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFilterDrawerActionsComponent, deps: [{ token: ExternalParamsController }], target: i0.ɵɵFactoryTarget.Component });
2719
+ FsFilterDrawerActionsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: FsFilterDrawerActionsComponent, selector: "fs-filter-drawer-actions", outputs: { _clear: "clear", _done: "done" }, ngImport: i0, template: "<button type=\"button\" mat-button color=\"primary\" (click)=\"done()\">Done</button>\n<button type=\"button\" mat-button (click)=\"clear()\">Clear</button>\n<ng-container *ngIf=\"savedFilters.enabled$ | async\">\n <button type=\"button\" mat-button (click)=\"saveFilters()\">Save</button>\n</ng-container>\n\n", components: [{ type: i1$4.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i7.FsButtonDirective, selector: "[mat-raised-button],[mat-button],[mat-flat-button],[mat-stroked-button]", inputs: ["name", "dirtySubmit", "form"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i3.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
2720
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFilterDrawerActionsComponent, decorators: [{
2721
+ type: Component,
2722
+ args: [{ selector: 'fs-filter-drawer-actions', changeDetection: ChangeDetectionStrategy.OnPush, template: "<button type=\"button\" mat-button color=\"primary\" (click)=\"done()\">Done</button>\n<button type=\"button\" mat-button (click)=\"clear()\">Clear</button>\n<ng-container *ngIf=\"savedFilters.enabled$ | async\">\n <button type=\"button\" mat-button (click)=\"saveFilters()\">Save</button>\n</ng-container>\n\n" }]
2723
+ }], ctorParameters: function () { return [{ type: ExternalParamsController }]; }, propDecorators: { _clear: [{
2724
+ type: Output,
2725
+ args: ['clear']
2726
+ }], _done: [{
2727
+ type: Output,
2728
+ args: ['done']
2729
+ }] } });
2730
+
2731
+ const FILTER_DRAWER_DATA = new InjectionToken('fs.filter-drawer-data');
2732
+
2733
+ const FILTER_DRAWER_OVERLAY = new InjectionToken('fs.filter-drawer-overlay');
2734
+
2735
+ class BaseItemComponent {
2736
+ constructor(_kvDiffers, _cd) {
2737
+ this._kvDiffers = _kvDiffers;
2738
+ this._cd = _cd;
2739
+ this.inline = false;
2740
+ this._destroy$ = new Subject();
2741
+ this._debouncer$ = new Subject();
2742
+ this._kvDiffer = this._kvDiffers.find(this.item || {}).create();
2743
+ this.listenWithDebounce();
2744
+ }
2745
+ set item(value) {
2746
+ this._item = value;
2747
+ }
2748
+ get item() {
2749
+ return this._item;
2750
+ }
2751
+ ngDoCheck() {
2752
+ if (this._kvDiffer) {
2753
+ const changes = this._kvDiffer.diff(this.item);
2754
+ if (changes) {
2755
+ this._cd.detectChanges();
2756
+ }
2757
+ }
2758
+ }
2759
+ ngOnChanges(changes) {
2760
+ if (changes.item) {
2761
+ this.label = Array.isArray(this.item.label) ? this.item.label[0] : this.item.label;
2762
+ }
2763
+ }
2764
+ ngOnDestroy() {
2765
+ this._destroy$.next();
2766
+ this._destroy$.complete();
2767
+ }
2768
+ listenWithDebounce() {
2769
+ this._debouncer$
2770
+ .pipe(debounceTime(150), takeUntil(this._destroy$))
2771
+ .subscribe(() => {
2772
+ this.item.valueChanged();
2773
+ });
2774
+ }
2775
+ itemChange() {
2776
+ this._debouncer$.next();
2777
+ }
2778
+ }
2779
+ BaseItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: BaseItemComponent, deps: [{ token: i0.KeyValueDiffers }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2780
+ BaseItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: BaseItemComponent, selector: "base-item", inputs: { item: "item", inline: "inline" }, usesOnChanges: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
2781
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: BaseItemComponent, decorators: [{
2782
+ type: Component,
2783
+ args: [{
2784
+ selector: 'base-item',
2785
+ template: '',
2786
+ changeDetection: ChangeDetectionStrategy.OnPush,
2787
+ }]
2788
+ }], ctorParameters: function () { return [{ type: i0.KeyValueDiffers }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { item: [{
2789
+ type: Input
2790
+ }], inline: [{
2791
+ type: Input
2792
+ }] } });
2793
+
2794
+ class FocusToItemDirective {
2795
+ constructor(_el, _focusController, _targetSelect, _targetDate, _targetDateScroll, _targetDateRangeFrom, _targetDateRangeTo, _targetAutocomplete, _targetAutocompleteChips) {
2796
+ this._el = _el;
2797
+ this._focusController = _focusController;
2798
+ this._targetSelect = _targetSelect;
2799
+ this._targetDate = _targetDate;
2800
+ this._targetDateScroll = _targetDateScroll;
2801
+ this._targetDateRangeFrom = _targetDateRangeFrom;
2802
+ this._targetDateRangeTo = _targetDateRangeTo;
2803
+ this._targetAutocomplete = _targetAutocomplete;
2804
+ this._targetAutocompleteChips = _targetAutocompleteChips;
2805
+ this._destroy$ = new Subject();
2806
+ }
2807
+ ngOnInit() {
2808
+ this._focusController
2809
+ .listenFocusFor$(this._item, this._focusTargetType)
2810
+ .pipe(delay(500), takeUntil(this._destroy$))
2811
+ .subscribe(() => {
2812
+ this._focus();
2813
+ });
2814
+ }
2815
+ ngOnDestroy() {
2816
+ this._destroy$.next();
2817
+ this._destroy$.complete();
2818
+ }
2819
+ _focus() {
2820
+ switch (this._item.type) {
2821
+ case ItemType.Select:
2822
+ {
2823
+ this._targetSelect.open();
2824
+ }
2825
+ break;
2826
+ case ItemType.Text:
2827
+ case ItemType.Range:
2828
+ {
2829
+ this._el.nativeElement.focus();
2830
+ }
2831
+ break;
2832
+ case ItemType.Date:
2833
+ {
2834
+ if (this._item.mode === ItemDateMode.Calendar) {
2835
+ this._targetDate.open();
2836
+ }
2837
+ else {
2838
+ this._targetDateScroll.open();
2839
+ }
2840
+ }
2841
+ break;
2842
+ case ItemType.DateRange:
2843
+ {
2844
+ if (this._focusTargetType === 'from') {
2845
+ this._targetDateRangeFrom.open();
2846
+ }
2847
+ else {
2848
+ this._targetDateRangeTo.open();
2849
+ }
2850
+ }
2851
+ break;
2852
+ case ItemType.AutoComplete:
2853
+ {
2854
+ this._targetAutocomplete.focus();
2855
+ }
2856
+ break;
2857
+ case ItemType.AutoCompleteChips:
2858
+ {
2859
+ this._targetAutocompleteChips.focus();
2860
+ }
2861
+ break;
2862
+ }
2863
+ }
2864
+ }
2865
+ FocusToItemDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FocusToItemDirective, deps: [{ token: i0.ElementRef }, { token: FocusControllerService }, { token: i2.MatSelect, optional: true, self: true }, { token: i3$4.FsDatePickerComponent, optional: true, self: true }, { token: i3$4.FsDateScrollPickerComponent, optional: true, self: true }, { token: i3$4.DateRangePickerFromComponent, optional: true, self: true }, { token: i3$4.DateRangePickerToComponent, optional: true, self: true }, { token: i4$2.FsAutocompleteComponent, optional: true, self: true }, { token: i5.FsAutocompleteChipsComponent, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Directive });
2866
+ FocusToItemDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FocusToItemDirective, selector: "[fsFilterFocusTrigger]", inputs: { _item: ["fsFilterFocusTrigger", "_item"], _focusTargetType: ["focusTargetType", "_focusTargetType"] }, ngImport: i0 });
2867
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FocusToItemDirective, decorators: [{
2868
+ type: Directive,
2869
+ args: [{
2870
+ selector: '[fsFilterFocusTrigger]',
2871
+ }]
2872
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: FocusControllerService }, { type: i2.MatSelect, decorators: [{
2873
+ type: Optional
2874
+ }, {
2875
+ type: Self
2876
+ }] }, { type: i3$4.FsDatePickerComponent, decorators: [{
2877
+ type: Optional
2878
+ }, {
2879
+ type: Self
2880
+ }] }, { type: i3$4.FsDateScrollPickerComponent, decorators: [{
2881
+ type: Optional
2882
+ }, {
2883
+ type: Self
2884
+ }] }, { type: i3$4.DateRangePickerFromComponent, decorators: [{
2885
+ type: Optional
2886
+ }, {
2887
+ type: Self
2888
+ }] }, { type: i3$4.DateRangePickerToComponent, decorators: [{
2889
+ type: Optional
2890
+ }, {
2891
+ type: Self
2892
+ }] }, { type: i4$2.FsAutocompleteComponent, decorators: [{
2893
+ type: Optional
2894
+ }, {
2895
+ type: Self
2896
+ }] }, { type: i5.FsAutocompleteChipsComponent, decorators: [{
2897
+ type: Optional
2898
+ }, {
2899
+ type: Self
2900
+ }] }]; }, propDecorators: { _item: [{
2901
+ type: Input,
2902
+ args: ['fsFilterFocusTrigger']
2903
+ }], _focusTargetType: [{
2904
+ type: Input,
2905
+ args: ['focusTargetType']
2906
+ }] } });
2907
+
2908
+ class TextComponent extends BaseItemComponent {
2909
+ constructor(_kvDiffers, _cd) {
2910
+ super(_kvDiffers, _cd);
2911
+ this._kvDiffers = _kvDiffers;
2912
+ this._cd = _cd;
2913
+ this.textControl = new FormControl();
2914
+ this.destroy$ = new Subject();
2915
+ }
2916
+ ngOnInit() {
2917
+ this._listenControlValueChanges();
2918
+ this._listenModelChanges();
2919
+ }
2920
+ ngOnDestroy() {
2921
+ this.destroy$.next();
2922
+ this.destroy$.complete();
2923
+ }
2924
+ _listenControlValueChanges() {
2925
+ this.textControl.valueChanges
2926
+ .pipe(distinctUntilChanged(), debounceTime(200), takeUntil(this.destroy$))
2927
+ .subscribe((value) => {
2928
+ this.item.model = value;
2929
+ });
2930
+ }
2931
+ _listenModelChanges() {
2932
+ this._item.value$
2933
+ .pipe(takeUntil(this.destroy$))
2934
+ .subscribe(() => {
2935
+ this.textControl.setValue(this.item.model, { emitEvent: false });
2936
+ });
2937
+ }
2938
+ }
2939
+ TextComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: TextComponent, deps: [{ token: i0.KeyValueDiffers }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2940
+ TextComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: TextComponent, selector: "filter-item-text", usesInheritance: true, ngImport: i0, template: "<mat-form-field>\n <mat-label>{{item.label}}</mat-label>\n <span matPrefix *ngIf=\"item.prefix\" [innerHtml]=\"item.prefix\"></span>\n <input matInput [formControl]=\"textControl\" [fsFilterFocusTrigger]=\"item\">\n <span matSuffix *ngIf=\"item.suffix\" [innerHtml]=\"item.suffix\"></span>\n</mat-form-field>\n", styles: [""], components: [{ type: i1$3.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }], directives: [{ type: i1$3.MatLabel, selector: "mat-label" }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1$3.MatPrefix, selector: "[matPrefix]" }, { type: i3$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: FocusToItemDirective, selector: "[fsFilterFocusTrigger]", inputs: ["fsFilterFocusTrigger", "focusTargetType"] }, { type: i1$3.MatSuffix, selector: "[matSuffix]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2941
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: TextComponent, decorators: [{
2942
+ type: Component,
2943
+ args: [{ selector: 'filter-item-text', changeDetection: ChangeDetectionStrategy.OnPush, template: "<mat-form-field>\n <mat-label>{{item.label}}</mat-label>\n <span matPrefix *ngIf=\"item.prefix\" [innerHtml]=\"item.prefix\"></span>\n <input matInput [formControl]=\"textControl\" [fsFilterFocusTrigger]=\"item\">\n <span matSuffix *ngIf=\"item.suffix\" [innerHtml]=\"item.suffix\"></span>\n</mat-form-field>\n", styles: [""] }]
2944
+ }], ctorParameters: function () { return [{ type: i0.KeyValueDiffers }, { type: i0.ChangeDetectorRef }]; } });
2945
+
2946
+ class FsFilterIsolateValues {
2947
+ transform(values, isolate) {
2948
+ if (!isolate) {
2949
+ return values;
2950
+ }
2951
+ return values.filter((value) => {
2952
+ return value.value !== isolate.value;
2953
+ });
2954
+ }
2955
+ }
2956
+ FsFilterIsolateValues.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFilterIsolateValues, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
2957
+ FsFilterIsolateValues.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFilterIsolateValues, name: "fsFilterIsolateValues" });
2958
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFilterIsolateValues, decorators: [{
2959
+ type: Pipe,
2960
+ args: [{
2961
+ name: 'fsFilterIsolateValues',
2962
+ }]
2963
+ }] });
2964
+
2965
+ class SelectMultipleComponent {
2966
+ constructor(cd) {
2967
+ this.cd = cd;
2968
+ }
2969
+ changed() {
2970
+ if (this.item.isolate) {
2971
+ this.item.isolate.enabled = false;
2972
+ if (this.item.multiple && Array.isArray(this.item.model)) {
2973
+ const index = this.item.model.indexOf(this.item.isolate.value);
2974
+ if (index > -1) {
2975
+ this.item.model.splice(index, 1);
2976
+ }
2977
+ }
2978
+ }
2979
+ }
2980
+ close() {
2981
+ this.select.close();
2982
+ }
2983
+ isolateChange(filter) {
2984
+ if (filter.isolate.enabled) {
2985
+ filter.model = filter.multiple ? [filter.isolate.value] : filter.isolate.value;
2986
+ }
2987
+ else {
2988
+ if (filter.multiple) {
2989
+ filter.model = filter.defaultValue ? filter.defaultValue : [];
2990
+ }
2991
+ else {
2992
+ filter.model = filter.defaultValue ? filter.defaultValue : null;
2993
+ }
2994
+ }
2995
+ }
2996
+ }
2997
+ SelectMultipleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SelectMultipleComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2998
+ SelectMultipleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: SelectMultipleComponent, selector: "filter-item-select-multiple", inputs: { item: "item" }, viewQueries: [{ propertyName: "select", first: true, predicate: ["select"], descendants: true, static: true }], ngImport: i0, template: "<mat-form-field [ngClass]=\"{ isolate: item.isolate }\">\n <mat-label>{{item.label}}</mat-label>\n <mat-select\n #select\n [fsFilterFocusTrigger]=\"item\"\n [(ngModel)]=\"item.model\"\n (ngModelChange)=\"changed()\"\n [multiple]=\"item.multiple\">\n <mat-option\n *ngFor=\"let item of item.values | fsFilterIsolateValues: item.isolate\"\n [value]=\"item.value\">\n {{ item.name }}\n </mat-option>\n </mat-select>\n\n <mat-hint>\n <div *ngIf=\"item.isolate\">\n <mat-checkbox (change)=\"isolateChange(item)\" [(ngModel)]=\"item.isolate.enabled\">\n <span class=\"checkbox-label\">{{ item.isolate.label }}</span>\n </mat-checkbox>\n </div>\n </mat-hint>\n</mat-form-field>\n", styles: [".isolate{margin-bottom:25px}\n"], components: [{ type: i1$3.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i2.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i3$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: i4$3.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "aria-describedby", "id", "required", "labelPosition", "name", "value", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }], directives: [{ type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1$3.MatLabel, selector: "mat-label" }, { type: FocusToItemDirective, selector: "[fsFilterFocusTrigger]", inputs: ["fsFilterFocusTrigger", "focusTargetType"] }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i7.FsFormNoFsValidatorsDirective, selector: "[ngModel]:not([required]):not([fsFormRequired]):not([fsFormCompare]):not([fsFormDateRange]):not([fsFormEmail]):not([fsFormEmails]):not([fsFormFunction]):not([fsFormGreater]):not([fsFormInteger]):not([fsFormLesser]):not([fsFormMax]):not([fsFormMaxLength]):not([fsFormMin]):not([fsFormMinLength]):not([fsFormNumeric]):not([fsFormPattern]):not([fsFormPhone]):not([fsFormUrl]):not([validate])" }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1$3.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "fsFilterIsolateValues": FsFilterIsolateValues }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
2999
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SelectMultipleComponent, decorators: [{
3000
+ type: Component,
3001
+ args: [{ selector: 'filter-item-select-multiple', changeDetection: ChangeDetectionStrategy.OnPush, template: "<mat-form-field [ngClass]=\"{ isolate: item.isolate }\">\n <mat-label>{{item.label}}</mat-label>\n <mat-select\n #select\n [fsFilterFocusTrigger]=\"item\"\n [(ngModel)]=\"item.model\"\n (ngModelChange)=\"changed()\"\n [multiple]=\"item.multiple\">\n <mat-option\n *ngFor=\"let item of item.values | fsFilterIsolateValues: item.isolate\"\n [value]=\"item.value\">\n {{ item.name }}\n </mat-option>\n </mat-select>\n\n <mat-hint>\n <div *ngIf=\"item.isolate\">\n <mat-checkbox (change)=\"isolateChange(item)\" [(ngModel)]=\"item.isolate.enabled\">\n <span class=\"checkbox-label\">{{ item.isolate.label }}</span>\n </mat-checkbox>\n </div>\n </mat-hint>\n</mat-form-field>\n", styles: [".isolate{margin-bottom:25px}\n"] }]
3002
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { item: [{
3003
+ type: Input
3004
+ }], select: [{
3005
+ type: ViewChild,
3006
+ args: ['select', { static: true }]
3007
+ }] } });
3008
+
3009
+ class SelectSimpleComponent {
3010
+ constructor(cd) {
3011
+ this.cd = cd;
3012
+ }
3013
+ changed() {
3014
+ if (this.item.isolate) {
3015
+ this.item.isolate.enabled = false;
3016
+ }
3017
+ }
3018
+ isolateChange(filter) {
3019
+ if (filter.isolate.enabled) {
3020
+ filter.model = filter.isolate.value;
3021
+ }
3022
+ else {
3023
+ filter.model = null;
3024
+ }
3025
+ }
3026
+ }
3027
+ SelectSimpleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SelectSimpleComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
3028
+ SelectSimpleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: SelectSimpleComponent, selector: "filter-item-select-simple", inputs: { item: "item" }, viewQueries: [{ propertyName: "select", first: true, predicate: ["select"], descendants: true, static: true }], ngImport: i0, template: "<mat-form-field [ngClass]=\"{ isolate: item.isolate }\">\n <mat-label>{{item.label}}</mat-label>\n <mat-select\n #select\n [fsFilterFocusTrigger]=\"item\"\n [(ngModel)]=\"item.model\"\n (ngModelChange)=\"changed()\">\n <mat-option *ngFor=\"let item of item.values | fsFilterIsolateValues: item.isolate\"\n [value]=\"item.value\"\n >\n {{ item.name }}\n </mat-option>\n </mat-select>\n\n <mat-hint>\n <div *ngIf=\"item.isolate\">\n <mat-checkbox (change)=\"isolateChange(item)\" [(ngModel)]=\"item.isolate.enabled\">\n <span class=\"checkbox-label\">{{ item.isolate.label }}</span>\n </mat-checkbox>\n </div>\n </mat-hint>\n</mat-form-field>\n", styles: [".isolate{margin-bottom:25px}\n"], components: [{ type: i1$3.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i2.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i3$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: i4$3.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "aria-describedby", "id", "required", "labelPosition", "name", "value", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }], directives: [{ type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1$3.MatLabel, selector: "mat-label" }, { type: FocusToItemDirective, selector: "[fsFilterFocusTrigger]", inputs: ["fsFilterFocusTrigger", "focusTargetType"] }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i7.FsFormNoFsValidatorsDirective, selector: "[ngModel]:not([required]):not([fsFormRequired]):not([fsFormCompare]):not([fsFormDateRange]):not([fsFormEmail]):not([fsFormEmails]):not([fsFormFunction]):not([fsFormGreater]):not([fsFormInteger]):not([fsFormLesser]):not([fsFormMax]):not([fsFormMaxLength]):not([fsFormMin]):not([fsFormMinLength]):not([fsFormNumeric]):not([fsFormPattern]):not([fsFormPhone]):not([fsFormUrl]):not([validate])" }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1$3.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "fsFilterIsolateValues": FsFilterIsolateValues }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
3029
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SelectSimpleComponent, decorators: [{
3030
+ type: Component,
3031
+ args: [{ selector: 'filter-item-select-simple', changeDetection: ChangeDetectionStrategy.OnPush, template: "<mat-form-field [ngClass]=\"{ isolate: item.isolate }\">\n <mat-label>{{item.label}}</mat-label>\n <mat-select\n #select\n [fsFilterFocusTrigger]=\"item\"\n [(ngModel)]=\"item.model\"\n (ngModelChange)=\"changed()\">\n <mat-option *ngFor=\"let item of item.values | fsFilterIsolateValues: item.isolate\"\n [value]=\"item.value\"\n >\n {{ item.name }}\n </mat-option>\n </mat-select>\n\n <mat-hint>\n <div *ngIf=\"item.isolate\">\n <mat-checkbox (change)=\"isolateChange(item)\" [(ngModel)]=\"item.isolate.enabled\">\n <span class=\"checkbox-label\">{{ item.isolate.label }}</span>\n </mat-checkbox>\n </div>\n </mat-hint>\n</mat-form-field>\n", styles: [".isolate{margin-bottom:25px}\n"] }]
3032
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { item: [{
3033
+ type: Input
3034
+ }], select: [{
3035
+ type: ViewChild,
3036
+ args: ['select', { static: true }]
3037
+ }] } });
3038
+
3039
+ class SelectGroupsComponent {
3040
+ constructor(cd) {
3041
+ this.cd = cd;
3042
+ }
3043
+ compare(o1, o2) {
3044
+ return o1 == o2;
3045
+ }
3046
+ }
3047
+ SelectGroupsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SelectGroupsComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
3048
+ SelectGroupsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: SelectGroupsComponent, selector: "filter-item-select-groups", inputs: { item: "item" }, viewQueries: [{ propertyName: "select", first: true, predicate: ["select"], descendants: true, static: true }], ngImport: i0, template: "<mat-form-field>\n <mat-label>{{item.label}}</mat-label>\n <mat-select\n #select\n [fsFilterFocusTrigger]=\"item\"\n [(ngModel)]=\"item.model\"\n [compareWith]=\"compare\">\n <ng-container *ngFor=\"let selectItem of item.values\">\n <ng-container *ngIf=\"selectItem[item.children]; else simpleOption\">\n <mat-optgroup [label]=\"selectItem.name\">\n <mat-option *ngFor=\"let subItem of selectItem[item.children]\"\n [value]=\"subItem.value\"\n [ngStyle]=\"selectItem.style\">\n {{ subItem.name }}\n </mat-option>\n </mat-optgroup>\n </ng-container>\n\n <ng-template #simpleOption>\n <mat-option\n [value]=\"selectItem.value\"\n [ngStyle]=\"selectItem.style\">\n {{ selectItem.name }}\n </mat-option>\n </ng-template>\n </ng-container>\n </mat-select>\n</mat-form-field>\n", components: [{ type: i1$3.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i2.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i3$1.MatOptgroup, selector: "mat-optgroup", inputs: ["disabled"], exportAs: ["matOptgroup"] }, { type: i3$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }], directives: [{ type: i1$3.MatLabel, selector: "mat-label" }, { type: FocusToItemDirective, selector: "[fsFilterFocusTrigger]", inputs: ["fsFilterFocusTrigger", "focusTargetType"] }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i7.FsFormNoFsValidatorsDirective, selector: "[ngModel]:not([required]):not([fsFormRequired]):not([fsFormCompare]):not([fsFormDateRange]):not([fsFormEmail]):not([fsFormEmails]):not([fsFormFunction]):not([fsFormGreater]):not([fsFormInteger]):not([fsFormLesser]):not([fsFormMax]):not([fsFormMaxLength]):not([fsFormMin]):not([fsFormMinLength]):not([fsFormNumeric]):not([fsFormPattern]):not([fsFormPhone]):not([fsFormUrl]):not([validate])" }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3049
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SelectGroupsComponent, decorators: [{
3050
+ type: Component,
3051
+ args: [{ selector: 'filter-item-select-groups', changeDetection: ChangeDetectionStrategy.OnPush, template: "<mat-form-field>\n <mat-label>{{item.label}}</mat-label>\n <mat-select\n #select\n [fsFilterFocusTrigger]=\"item\"\n [(ngModel)]=\"item.model\"\n [compareWith]=\"compare\">\n <ng-container *ngFor=\"let selectItem of item.values\">\n <ng-container *ngIf=\"selectItem[item.children]; else simpleOption\">\n <mat-optgroup [label]=\"selectItem.name\">\n <mat-option *ngFor=\"let subItem of selectItem[item.children]\"\n [value]=\"subItem.value\"\n [ngStyle]=\"selectItem.style\">\n {{ subItem.name }}\n </mat-option>\n </mat-optgroup>\n </ng-container>\n\n <ng-template #simpleOption>\n <mat-option\n [value]=\"selectItem.value\"\n [ngStyle]=\"selectItem.style\">\n {{ selectItem.name }}\n </mat-option>\n </ng-template>\n </ng-container>\n </mat-select>\n</mat-form-field>\n" }]
3052
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { select: [{
3053
+ type: ViewChild,
3054
+ args: ['select', { static: true }]
3055
+ }], item: [{
3056
+ type: Input
3057
+ }] } });
3058
+
3059
+ class SelectComponent extends BaseItemComponent {
3060
+ constructor(_kvDiffers, _cd) {
3061
+ super(_kvDiffers, _cd);
3062
+ this._kvDiffers = _kvDiffers;
3063
+ this._cd = _cd;
3064
+ // For case when we have multiple selection with __all option
3065
+ // If _all has been selected than we must disable all other items
3066
+ this.allItemsOptionSelected = false;
3067
+ }
3068
+ get multipleSelectItem() {
3069
+ return this.item;
3070
+ }
3071
+ get simpleSelectItem() {
3072
+ return this.item;
3073
+ }
3074
+ ngOnChanges(changes) {
3075
+ if (changes.item) {
3076
+ this.values$ = this.item.values$;
3077
+ }
3078
+ }
3079
+ ngDoCheck() {
3080
+ if (this._kvDiffer) {
3081
+ const changes = this._kvDiffer.diff(this.item);
3082
+ if (changes) {
3083
+ this._cd.markForCheck();
3084
+ if (this.selectedItem) {
3085
+ this.selectedItem.cd.markForCheck();
3086
+ }
3087
+ }
3088
+ }
3089
+ }
3090
+ }
3091
+ SelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SelectComponent, deps: [{ token: i0.KeyValueDiffers }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
3092
+ SelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: SelectComponent, selector: "filter-item-select", viewQueries: [{ propertyName: "selectedItem", first: true, predicate: ["selectItem"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<ng-container *ngIf=\"(item.loading$ | async) else itemSelect\">\n <mat-form-field>\n <mat-label>{{item.label}}</mat-label>\n <mat-select disabled></mat-select>\n </mat-form-field>\n</ng-container>\n\n<ng-template #itemSelect>\n <ng-container *ngIf=\"(values$ | async)?.length\">\n <ng-container *ngIf=\"item.multiple && !item.children\">\n <filter-item-select-multiple\n [item]=\"multipleSelectItem\"\n #selectItem>\n </filter-item-select-multiple>\n </ng-container>\n\n <ng-container *ngIf=\"!item.multiple && !item.children\">\n <filter-item-select-simple\n [item]=\"simpleSelectItem\"\n #selectItem>\n </filter-item-select-simple>\n </ng-container>\n\n <ng-container *ngIf=\"item.children\">\n <filter-item-select-groups\n [item]=\"item\"\n #selectItem>\n </filter-item-select-groups>\n </ng-container>\n </ng-container>\n</ng-template>\n", components: [{ type: i1$3.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i2.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: SelectMultipleComponent, selector: "filter-item-select-multiple", inputs: ["item"] }, { type: SelectSimpleComponent, selector: "filter-item-select-simple", inputs: ["item"] }, { type: SelectGroupsComponent, selector: "filter-item-select-groups", inputs: ["item"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1$3.MatLabel, selector: "mat-label" }], pipes: { "async": i3.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
3093
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SelectComponent, decorators: [{
3094
+ type: Component,
3095
+ args: [{ selector: 'filter-item-select', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"(item.loading$ | async) else itemSelect\">\n <mat-form-field>\n <mat-label>{{item.label}}</mat-label>\n <mat-select disabled></mat-select>\n </mat-form-field>\n</ng-container>\n\n<ng-template #itemSelect>\n <ng-container *ngIf=\"(values$ | async)?.length\">\n <ng-container *ngIf=\"item.multiple && !item.children\">\n <filter-item-select-multiple\n [item]=\"multipleSelectItem\"\n #selectItem>\n </filter-item-select-multiple>\n </ng-container>\n\n <ng-container *ngIf=\"!item.multiple && !item.children\">\n <filter-item-select-simple\n [item]=\"simpleSelectItem\"\n #selectItem>\n </filter-item-select-simple>\n </ng-container>\n\n <ng-container *ngIf=\"item.children\">\n <filter-item-select-groups\n [item]=\"item\"\n #selectItem>\n </filter-item-select-groups>\n </ng-container>\n </ng-container>\n</ng-template>\n" }]
3096
+ }], ctorParameters: function () { return [{ type: i0.KeyValueDiffers }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { selectedItem: [{
3097
+ type: ViewChild,
3098
+ args: ['selectItem']
3099
+ }] } });
3100
+
3101
+ class ChipsComponent extends BaseItemComponent {
3102
+ constructor(_kvDiffers, _cd) {
3103
+ super(_kvDiffers, _cd);
3104
+ this._kvDiffers = _kvDiffers;
3105
+ this._cd = _cd;
3106
+ }
3107
+ modelChange() {
3108
+ this.itemChange();
3109
+ }
3110
+ compareFn(modelValue, chipValue) {
3111
+ return modelValue.value === chipValue.value;
3112
+ }
3113
+ }
3114
+ ChipsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ChipsComponent, deps: [{ token: i0.KeyValueDiffers }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
3115
+ ChipsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: ChipsComponent, selector: "filter-item-chips", usesInheritance: true, ngImport: i0, template: "<ng-template [ngIf]=\"item.values?.length\">\n <fs-label-field>\n <fs-label>{{item.label}}</fs-label>\n <fs-chips [(ngModel)]=\"item.model\"\n [compare]=\"compareFn\"\n [multiple]=\"item.multiple\">\n <fs-chip *ngFor=\"let value of item.values\"\n [value]=\"value\"\n [selectable]=\"true\">\n {{ value.name }}\n </fs-chip>\n </fs-chips>\n </fs-label-field>\n</ng-template>\n\n<ng-template [ngIf]=\"item.loading\">{{ item.label }} loading...</ng-template>\n", styles: ["fs-chip{line-height:40px}\n"], components: [{ type: i1$5.FsLabelFieldComponent, selector: "fs-label-field", inputs: ["bottomMargin", "topMargin", "labelMargin"] }, { type: i1$5.FsLabelComponent, selector: "fs-label" }, { type: i2$2.FsChipsComponent, selector: "fs-chips", inputs: ["compare", "multiple"] }, { type: i2$2.FsChipComponent, selector: "fs-chip", inputs: ["size", "value", "backgroundColor", "borderColor", "color", "outlined", "removable", "selectable", "selected", "image"], outputs: ["selectedToggled", "removed"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i7.FsFormNoFsValidatorsDirective, selector: "[ngModel]:not([required]):not([fsFormRequired]):not([fsFormCompare]):not([fsFormDateRange]):not([fsFormEmail]):not([fsFormEmails]):not([fsFormFunction]):not([fsFormGreater]):not([fsFormInteger]):not([fsFormLesser]):not([fsFormMax]):not([fsFormMaxLength]):not([fsFormMin]):not([fsFormMinLength]):not([fsFormNumeric]):not([fsFormPattern]):not([fsFormPhone]):not([fsFormUrl]):not([validate])" }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3116
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ChipsComponent, decorators: [{
3117
+ type: Component,
3118
+ args: [{ selector: 'filter-item-chips', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template [ngIf]=\"item.values?.length\">\n <fs-label-field>\n <fs-label>{{item.label}}</fs-label>\n <fs-chips [(ngModel)]=\"item.model\"\n [compare]=\"compareFn\"\n [multiple]=\"item.multiple\">\n <fs-chip *ngFor=\"let value of item.values\"\n [value]=\"value\"\n [selectable]=\"true\">\n {{ value.name }}\n </fs-chip>\n </fs-chips>\n </fs-label-field>\n</ng-template>\n\n<ng-template [ngIf]=\"item.loading\">{{ item.label }} loading...</ng-template>\n", styles: ["fs-chip{line-height:40px}\n"] }]
3119
+ }], ctorParameters: function () { return [{ type: i0.KeyValueDiffers }, { type: i0.ChangeDetectorRef }]; } });
3120
+
3121
+ class RangeComponent extends BaseItemComponent {
3122
+ constructor(_kvDiffers, _cd) {
3123
+ super(_kvDiffers, _cd);
3124
+ this._kvDiffers = _kvDiffers;
3125
+ this._cd = _cd;
3126
+ }
3127
+ ngOnInit() {
3128
+ this.listenChanges();
3129
+ }
3130
+ listenChanges() {
3131
+ const fromListener = fromEvent(this.from.nativeElement, 'keyup')
3132
+ .pipe(distinctUntilChanged());
3133
+ const toListener = fromEvent(this.to.nativeElement, 'keyup')
3134
+ .pipe(distinctUntilChanged());
3135
+ merge(fromListener, toListener)
3136
+ .pipe(takeUntil(this._destroy$))
3137
+ .subscribe(() => {
3138
+ this.itemChange();
3139
+ });
3140
+ }
3141
+ }
3142
+ RangeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: RangeComponent, deps: [{ token: i0.KeyValueDiffers }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
3143
+ RangeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: RangeComponent, selector: "filter-item-range", viewQueries: [{ propertyName: "from", first: true, predicate: ["from"], descendants: true, static: true }, { propertyName: "to", first: true, predicate: ["to"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"form-field\">\n <mat-form-field class=\"filter-range-min\">\n <mat-label>{{item.label[0]}}</mat-label>\n <span matPrefix *ngIf=\"item.prefix\" [innerHtml]=\"item.prefix\"></span>\n <input \n matInput\n [fsFilterFocusTrigger]=\"item\"\n [focusTargetType]=\"'from'\"\n type=\"text\"\n inputmode=\"decimal\"\n [(ngModel)]=\"item.model.min\"\n #from>\n <span matSuffix *ngIf=\"item.suffix\" [innerHtml]=\"item.suffix\"></span>\n </mat-form-field>\n\n <mat-form-field class=\"filter-range-max\">\n <mat-label>{{item.label[1]}}</mat-label>\n <span matPrefix *ngIf=\"item.prefix\" [innerHtml]=\"item.prefix\"></span>\n <input \n matInput\n [fsFilterFocusTrigger]=\"item\"\n [focusTargetType]=\"'to'\"\n type=\"text\"\n inputmode=\"decimal\"\n [(ngModel)]=\"item.model.max\"\n #to>\n <span matSuffix *ngIf=\"item.suffix\" [innerHtml]=\"item.suffix\"></span>\n </mat-form-field>\n</div>\n", styles: [".form-field{display:flex}.form-field mat-form-field{min-width:0}.form-field mat-form-field+mat-form-field{margin-left:10px}\n"], components: [{ type: i1$3.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }], directives: [{ type: i1$3.MatLabel, selector: "mat-label" }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1$3.MatPrefix, selector: "[matPrefix]" }, { type: i3$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: FocusToItemDirective, selector: "[fsFilterFocusTrigger]", inputs: ["fsFilterFocusTrigger", "focusTargetType"] }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i7.FsFormNoFsValidatorsDirective, selector: "[ngModel]:not([required]):not([fsFormRequired]):not([fsFormCompare]):not([fsFormDateRange]):not([fsFormEmail]):not([fsFormEmails]):not([fsFormFunction]):not([fsFormGreater]):not([fsFormInteger]):not([fsFormLesser]):not([fsFormMax]):not([fsFormMaxLength]):not([fsFormMin]):not([fsFormMinLength]):not([fsFormNumeric]):not([fsFormPattern]):not([fsFormPhone]):not([fsFormUrl]):not([validate])" }, { type: i1$3.MatSuffix, selector: "[matSuffix]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3144
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: RangeComponent, decorators: [{
3145
+ type: Component,
3146
+ args: [{ selector: 'filter-item-range', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"form-field\">\n <mat-form-field class=\"filter-range-min\">\n <mat-label>{{item.label[0]}}</mat-label>\n <span matPrefix *ngIf=\"item.prefix\" [innerHtml]=\"item.prefix\"></span>\n <input \n matInput\n [fsFilterFocusTrigger]=\"item\"\n [focusTargetType]=\"'from'\"\n type=\"text\"\n inputmode=\"decimal\"\n [(ngModel)]=\"item.model.min\"\n #from>\n <span matSuffix *ngIf=\"item.suffix\" [innerHtml]=\"item.suffix\"></span>\n </mat-form-field>\n\n <mat-form-field class=\"filter-range-max\">\n <mat-label>{{item.label[1]}}</mat-label>\n <span matPrefix *ngIf=\"item.prefix\" [innerHtml]=\"item.prefix\"></span>\n <input \n matInput\n [fsFilterFocusTrigger]=\"item\"\n [focusTargetType]=\"'to'\"\n type=\"text\"\n inputmode=\"decimal\"\n [(ngModel)]=\"item.model.max\"\n #to>\n <span matSuffix *ngIf=\"item.suffix\" [innerHtml]=\"item.suffix\"></span>\n </mat-form-field>\n</div>\n", styles: [".form-field{display:flex}.form-field mat-form-field{min-width:0}.form-field mat-form-field+mat-form-field{margin-left:10px}\n"] }]
3147
+ }], ctorParameters: function () { return [{ type: i0.KeyValueDiffers }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { from: [{
3148
+ type: ViewChild,
3149
+ args: ['from', { static: true }]
3150
+ }], to: [{
3151
+ type: ViewChild,
3152
+ args: ['to', { static: true }]
3153
+ }] } });
3154
+
3155
+ class AutocompleteComponent extends BaseItemComponent {
3156
+ constructor(_kvDiffers, _cd) {
3157
+ super(_kvDiffers, _cd);
3158
+ this._kvDiffers = _kvDiffers;
3159
+ this._cd = _cd;
3160
+ this.displayWith = (data) => {
3161
+ return data ? data.name : data;
3162
+ };
3163
+ this.fetch = (keyword) => {
3164
+ return this.item.valuesFn(keyword, this.item.filter);
3165
+ };
3166
+ }
3167
+ }
3168
+ AutocompleteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AutocompleteComponent, deps: [{ token: i0.KeyValueDiffers }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
3169
+ AutocompleteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: AutocompleteComponent, selector: "filter-item-autocomplete", usesInheritance: true, ngImport: i0, template: "<fs-autocomplete\n [fsFilterFocusTrigger]=\"item\"\n [fetch]=\"fetch\"\n [displayWith]=\"displayWith\"\n [(ngModel)]=\"item.model\"\n [placeholder]=\"label\"\n [fetchOnFocus]=\"item.fetchOnFocus\"\n [showClear]=\"item.showClear\"\n name=\"item.name\">\n <ng-template fsAutocompleteTemplate let-data=\"data\">\n {{data.name}}\n </ng-template>\n</fs-autocomplete>\n", components: [{ type: i4$2.FsAutocompleteComponent, selector: "fs-autocomplete", inputs: ["fetch", "displayWith", "placeholder", "fetchOnFocus", "readonly", "required", "disabled", "formFieldClass", "appearance", "hint", "panelWidth", "panelClass", "showClear"], outputs: ["cleared", "opened", "closed"] }], directives: [{ type: FocusToItemDirective, selector: "[fsFilterFocusTrigger]", inputs: ["fsFilterFocusTrigger", "focusTargetType"] }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i7.FsFormNoFsValidatorsDirective, selector: "[ngModel]:not([required]):not([fsFormRequired]):not([fsFormCompare]):not([fsFormDateRange]):not([fsFormEmail]):not([fsFormEmails]):not([fsFormFunction]):not([fsFormGreater]):not([fsFormInteger]):not([fsFormLesser]):not([fsFormMax]):not([fsFormMaxLength]):not([fsFormMin]):not([fsFormMinLength]):not([fsFormNumeric]):not([fsFormPattern]):not([fsFormPhone]):not([fsFormUrl]):not([validate])" }, { type: i4$2.FsAutocompleteTemplateDirective, selector: "[fsAutocompleteTemplate]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3170
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AutocompleteComponent, decorators: [{
3171
+ type: Component,
3172
+ args: [{ selector: 'filter-item-autocomplete', changeDetection: ChangeDetectionStrategy.OnPush, template: "<fs-autocomplete\n [fsFilterFocusTrigger]=\"item\"\n [fetch]=\"fetch\"\n [displayWith]=\"displayWith\"\n [(ngModel)]=\"item.model\"\n [placeholder]=\"label\"\n [fetchOnFocus]=\"item.fetchOnFocus\"\n [showClear]=\"item.showClear\"\n name=\"item.name\">\n <ng-template fsAutocompleteTemplate let-data=\"data\">\n {{data.name}}\n </ng-template>\n</fs-autocomplete>\n" }]
3173
+ }], ctorParameters: function () { return [{ type: i0.KeyValueDiffers }, { type: i0.ChangeDetectorRef }]; } });
3174
+
3175
+ class AutocompletechipsComponent extends BaseItemComponent {
3176
+ constructor(_kvDiffers, _cd) {
3177
+ super(_kvDiffers, _cd);
3178
+ this._kvDiffers = _kvDiffers;
3179
+ this._cd = _cd;
3180
+ this.fetch = (keyword) => {
3181
+ return this.item.valuesFn(keyword, this.item.filter);
3182
+ };
3183
+ }
3184
+ addAutocompleteChipItem(event) {
3185
+ if (event.data && this.item.model.indexOf(event.data.value) === -1) {
3186
+ this.item.model.push(event.data);
3187
+ this.itemChange();
3188
+ }
3189
+ }
3190
+ removeAutocompleteChipItem(event) {
3191
+ remove(this.item.model, { value: event.data.value });
3192
+ this.itemChange();
3193
+ }
3194
+ clearAutocompleteChipItem() {
3195
+ this.item.clear();
3196
+ this.itemChange();
3197
+ }
3198
+ compareItems(item1, item2) {
3199
+ return item1?.value === item2?.value;
3200
+ }
3201
+ }
3202
+ AutocompletechipsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AutocompletechipsComponent, deps: [{ token: i0.KeyValueDiffers }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
3203
+ AutocompletechipsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: AutocompletechipsComponent, selector: "filter-item-autocompletechips", usesInheritance: true, ngImport: i0, template: "<fs-autocomplete-chips\n [fsFilterFocusTrigger]=\"item\"\n [fetch]=\"fetch\"\n [ngModel]=\"item.model\"\n (selected)=\"addAutocompleteChipItem($event)\"\n (removed)=\"removeAutocompleteChipItem($event)\"\n (clear)=\"clearAutocompleteChipItem()\"\n [allowText]=\"false\"\n [fetchOnFocus]=\"item.fetchOnFocus\"\n [placeholder]=\"label\"\n [chipImage]=\"item.chipImage\"\n [chipColor]=\"item.chipColor\"\n [chipIconColor]=\"item.chipIcon\"\n [chipBackground]=\"item.chipBackground\"\n [chipIcon]=\"item.chipIcon\"\n [chipClass]=\"item.chipClass\"\n [allowClear]=\"item.showClear\"\n [removable]=\"item.showClear\"\n [compareWith]=\"compareItems\"\n [panelWidth]=\"300\"\n name=\"model\">\n <ng-template fsAutocompleteObject let-object=\"object\">\n {{ object.name }}\n </ng-template>\n</fs-autocomplete-chips>\n\n<!--<mat-form-field floatLabel=\"auto\">\n <mat-label>{{item.label}}</mat-label>\n <mat-chip-list #chipList>\n <mat-chip *ngFor=\"let item of item.model\"\n (removed)=\"removeAutocompleteChipItem(item)\">\n {{ item.name }}\n <mat-icon matChipRemove>cancel</mat-icon>\n </mat-chip>\n\n <input #chipsInput\n type=\"text\"\n matInput\n [(ngModel)]=\"item.selectedValue\"\n (ngModelChange)=\"onAutocompleteChipsChange(chipsInput)\"\n [name]=\"item.name\"\n [matChipInputFor]=\"chipList\"\n [matAutocomplete]=\"autocompleteChipsInput\">\n </mat-chip-list>\n\n <mat-autocomplete #autocompleteChipsInput=\"matAutocomplete\"\n (optionSelected)=\"addAutocompleteChipItem( $event)\"\n >\n <mat-option *ngFor=\"let item of item.values$ | async\" [value]=\"item\">\n {{ item.name }}\n </mat-option>\n </mat-autocomplete>\n <mat-placeholder *ngIf=\"inline\">{{ item.label }}</mat-placeholder>\n</mat-form-field>-->\n", components: [{ type: i5.FsAutocompleteChipsComponent, selector: "fs-autocomplete-chips", inputs: ["fetch", "appearance", "readonly", "size", "placeholder", "chipImage", "chipBackground", "chipColor", "chipIcon", "chipIconColor", "chipClass", "hint", "allowText", "allowObject", "delay", "validateText", "removable", "allowClear", "color", "background", "orderable", "limit", "initOnClick", "fetchOnFocus", "multiple", "confirm", "disabled", "panelWidth", "panelClass", "compareWith"], outputs: ["selected", "removed", "reordered", "clear"] }], directives: [{ type: FocusToItemDirective, selector: "[fsFilterFocusTrigger]", inputs: ["fsFilterFocusTrigger", "focusTargetType"] }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i7.FsFormNoFsValidatorsDirective, selector: "[ngModel]:not([required]):not([fsFormRequired]):not([fsFormCompare]):not([fsFormDateRange]):not([fsFormEmail]):not([fsFormEmails]):not([fsFormFunction]):not([fsFormGreater]):not([fsFormInteger]):not([fsFormLesser]):not([fsFormMax]):not([fsFormMaxLength]):not([fsFormMin]):not([fsFormMinLength]):not([fsFormNumeric]):not([fsFormPattern]):not([fsFormPhone]):not([fsFormUrl]):not([validate])" }, { type: i5.FsAutocompleteObjectDirective, selector: "[fsAutocompleteObject],[fsAutocompleteChipsTemplate]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3204
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: AutocompletechipsComponent, decorators: [{
3205
+ type: Component,
3206
+ args: [{ selector: 'filter-item-autocompletechips', changeDetection: ChangeDetectionStrategy.OnPush, template: "<fs-autocomplete-chips\n [fsFilterFocusTrigger]=\"item\"\n [fetch]=\"fetch\"\n [ngModel]=\"item.model\"\n (selected)=\"addAutocompleteChipItem($event)\"\n (removed)=\"removeAutocompleteChipItem($event)\"\n (clear)=\"clearAutocompleteChipItem()\"\n [allowText]=\"false\"\n [fetchOnFocus]=\"item.fetchOnFocus\"\n [placeholder]=\"label\"\n [chipImage]=\"item.chipImage\"\n [chipColor]=\"item.chipColor\"\n [chipIconColor]=\"item.chipIcon\"\n [chipBackground]=\"item.chipBackground\"\n [chipIcon]=\"item.chipIcon\"\n [chipClass]=\"item.chipClass\"\n [allowClear]=\"item.showClear\"\n [removable]=\"item.showClear\"\n [compareWith]=\"compareItems\"\n [panelWidth]=\"300\"\n name=\"model\">\n <ng-template fsAutocompleteObject let-object=\"object\">\n {{ object.name }}\n </ng-template>\n</fs-autocomplete-chips>\n\n<!--<mat-form-field floatLabel=\"auto\">\n <mat-label>{{item.label}}</mat-label>\n <mat-chip-list #chipList>\n <mat-chip *ngFor=\"let item of item.model\"\n (removed)=\"removeAutocompleteChipItem(item)\">\n {{ item.name }}\n <mat-icon matChipRemove>cancel</mat-icon>\n </mat-chip>\n\n <input #chipsInput\n type=\"text\"\n matInput\n [(ngModel)]=\"item.selectedValue\"\n (ngModelChange)=\"onAutocompleteChipsChange(chipsInput)\"\n [name]=\"item.name\"\n [matChipInputFor]=\"chipList\"\n [matAutocomplete]=\"autocompleteChipsInput\">\n </mat-chip-list>\n\n <mat-autocomplete #autocompleteChipsInput=\"matAutocomplete\"\n (optionSelected)=\"addAutocompleteChipItem( $event)\"\n >\n <mat-option *ngFor=\"let item of item.values$ | async\" [value]=\"item\">\n {{ item.name }}\n </mat-option>\n </mat-autocomplete>\n <mat-placeholder *ngIf=\"inline\">{{ item.label }}</mat-placeholder>\n</mat-form-field>-->\n" }]
3207
+ }], ctorParameters: function () { return [{ type: i0.KeyValueDiffers }, { type: i0.ChangeDetectorRef }]; } });
3208
+
3209
+ class DateComponent extends BaseItemComponent {
3210
+ constructor(_kvDiffers, _cd) {
3211
+ super(_kvDiffers, _cd);
3212
+ this._kvDiffers = _kvDiffers;
3213
+ this._cd = _cd;
3214
+ this.viewType = PickerViewType.Date;
3215
+ this.itemDateMode = ItemDateMode;
3216
+ this.showYear = true;
3217
+ this.showMonth = true;
3218
+ this.showDay = true;
3219
+ }
3220
+ ngOnInit() {
3221
+ if (this.item.type === ItemType.DateTime) {
3222
+ this.viewType = PickerViewType.DateTime;
3223
+ }
3224
+ else {
3225
+ this.viewType = PickerViewType.Date;
3226
+ }
3227
+ if (this.item.mode === ItemDateMode.ScrollMonthYear) {
3228
+ this.showDay = false;
3229
+ }
3230
+ }
3231
+ }
3232
+ DateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: DateComponent, deps: [{ token: i0.KeyValueDiffers }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
3233
+ DateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: DateComponent, selector: "filter-item-date", usesInheritance: true, ngImport: i0, template: "<mat-form-field *ngIf=\"item.mode===itemDateMode.Calendar; else elseMode\">\n <mat-label>{{item.label}}</mat-label>\n <input matInput\n fsDatePicker\n [fsFilterFocusTrigger]=\"item\"\n [(ngModel)]=\"item.model\"\n [maxYear]=\"item.maxYear\"\n [view]=\"viewType\"\n [clear]=\"item.showClear\"\n [name]=\"item.name\">\n <mat-placeholder *ngIf=\"inline\">{{ item.label }}</mat-placeholder>\n</mat-form-field>\n\n<ng-template #elseMode>\n <mat-form-field>\n <mat-label>{{item.label}}</mat-label>\n <input matInput\n fsDateScrollPicker\n [fsFilterFocusTrigger]=\"item\"\n [(ngModel)]=\"item.model\"\n [maxYear]=\"item.maxYear\"\n [showMonth]=\"showMonth\"\n [showDay]=\"showDay\"\n [showYear]=\"showYear\"\n [clear]=\"item.showClear\"\n [name]=\"item.name\">\n <mat-placeholder *ngIf=\"inline\">{{ item.label }}</mat-placeholder>\n </mat-form-field>\n</ng-template>\n", components: [{ type: i1$3.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i3$4.FsDatePickerComponent, selector: "[fsDatePicker]", inputs: ["minYear", "maxYear", "minDate", "maxDate", "startOfDay", "view", "format", "minutes", "weekStartsOn"], outputs: ["change"] }, { type: i3$4.FsDateScrollPickerComponent, selector: "[fsDateScrollPicker]", inputs: ["minYear", "maxYear", "minDate", "maxDate", "showMonth", "showYear", "showDay"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1$3.MatLabel, selector: "mat-label" }, { type: i3$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: FocusToItemDirective, selector: "[fsFilterFocusTrigger]", inputs: ["fsFilterFocusTrigger", "focusTargetType"] }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i7.FsFormNoFsValidatorsDirective, selector: "[ngModel]:not([required]):not([fsFormRequired]):not([fsFormCompare]):not([fsFormDateRange]):not([fsFormEmail]):not([fsFormEmails]):not([fsFormFunction]):not([fsFormGreater]):not([fsFormInteger]):not([fsFormLesser]):not([fsFormMax]):not([fsFormMaxLength]):not([fsFormMin]):not([fsFormMinLength]):not([fsFormNumeric]):not([fsFormPattern]):not([fsFormPhone]):not([fsFormUrl]):not([validate])" }, { type: i1$3.MatPlaceholder, selector: "mat-placeholder" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3234
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: DateComponent, decorators: [{
3235
+ type: Component,
3236
+ args: [{ selector: 'filter-item-date', changeDetection: ChangeDetectionStrategy.OnPush, template: "<mat-form-field *ngIf=\"item.mode===itemDateMode.Calendar; else elseMode\">\n <mat-label>{{item.label}}</mat-label>\n <input matInput\n fsDatePicker\n [fsFilterFocusTrigger]=\"item\"\n [(ngModel)]=\"item.model\"\n [maxYear]=\"item.maxYear\"\n [view]=\"viewType\"\n [clear]=\"item.showClear\"\n [name]=\"item.name\">\n <mat-placeholder *ngIf=\"inline\">{{ item.label }}</mat-placeholder>\n</mat-form-field>\n\n<ng-template #elseMode>\n <mat-form-field>\n <mat-label>{{item.label}}</mat-label>\n <input matInput\n fsDateScrollPicker\n [fsFilterFocusTrigger]=\"item\"\n [(ngModel)]=\"item.model\"\n [maxYear]=\"item.maxYear\"\n [showMonth]=\"showMonth\"\n [showDay]=\"showDay\"\n [showYear]=\"showYear\"\n [clear]=\"item.showClear\"\n [name]=\"item.name\">\n <mat-placeholder *ngIf=\"inline\">{{ item.label }}</mat-placeholder>\n </mat-form-field>\n</ng-template>\n" }]
3237
+ }], ctorParameters: function () { return [{ type: i0.KeyValueDiffers }, { type: i0.ChangeDetectorRef }]; } });
3238
+
3239
+ class DateRangeComponent extends BaseItemComponent {
3240
+ constructor(_kvDiffers, _cd) {
3241
+ super(_kvDiffers, _cd);
3242
+ this._kvDiffers = _kvDiffers;
3243
+ this._cd = _cd;
3244
+ this.viewType = PickerViewType.Date;
3245
+ }
3246
+ ngOnInit() {
3247
+ if (this.item.type === ItemType.DateTimeRange) {
3248
+ this.viewType = PickerViewType.DateTime;
3249
+ }
3250
+ else {
3251
+ this.viewType = PickerViewType.Date;
3252
+ }
3253
+ }
3254
+ }
3255
+ DateRangeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: DateRangeComponent, deps: [{ token: i0.KeyValueDiffers }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
3256
+ DateRangeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: DateRangeComponent, selector: "filter-item-date-range", usesInheritance: true, ngImport: i0, template: "<mat-form-field>\n <mat-label>{{item.label[0]}}</mat-label>\n <input\n matInput\n [fsFilterFocusTrigger]=\"item\"\n [focusTargetType]=\"'from'\"\n [fsDateRangeFrom]=\"item.name\"\n [(ngModel)]=\"item.model.from\"\n (ngModelChange)=\"itemChange()\"\n [clear]=\"item.showClear\"\n [view]=\"viewType\"\n name=\"date_from\">\n</mat-form-field>\n\n<mat-form-field>\n <mat-label>{{item.label[1]}}</mat-label>\n <input\n matInput\n [fsFilterFocusTrigger]=\"item\"\n [focusTargetType]=\"'to'\"\n [fsDateRangeTo]=\"item.name\"\n [(ngModel)]=\"item.model.to\"\n (ngModelChange)=\"itemChange()\"\n [clear]=\"item.showClear\"\n [view]=\"viewType\"\n name=\"date_to\">\n</mat-form-field>\n", components: [{ type: i1$3.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i3$4.DateRangePickerFromComponent, selector: "[fsDateRangeFrom],[fsDateRangeFromPicker]", inputs: ["fsDateRangeFrom", "fsDateRangeFromPicker"] }, { type: i3$4.DateRangePickerToComponent, selector: "[fsDateRangeTo],[fsDateRangeToPicker]", inputs: ["fsDateRangeTo", "fsDateRangeToPicker"] }], directives: [{ type: i1$3.MatLabel, selector: "mat-label" }, { type: i3$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: FocusToItemDirective, selector: "[fsFilterFocusTrigger]", inputs: ["fsFilterFocusTrigger", "focusTargetType"] }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i7.FsFormNoFsValidatorsDirective, selector: "[ngModel]:not([required]):not([fsFormRequired]):not([fsFormCompare]):not([fsFormDateRange]):not([fsFormEmail]):not([fsFormEmails]):not([fsFormFunction]):not([fsFormGreater]):not([fsFormInteger]):not([fsFormLesser]):not([fsFormMax]):not([fsFormMaxLength]):not([fsFormMin]):not([fsFormMinLength]):not([fsFormNumeric]):not([fsFormPattern]):not([fsFormPhone]):not([fsFormUrl]):not([validate])" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3257
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: DateRangeComponent, decorators: [{
3258
+ type: Component,
3259
+ args: [{ selector: 'filter-item-date-range', changeDetection: ChangeDetectionStrategy.OnPush, template: "<mat-form-field>\n <mat-label>{{item.label[0]}}</mat-label>\n <input\n matInput\n [fsFilterFocusTrigger]=\"item\"\n [focusTargetType]=\"'from'\"\n [fsDateRangeFrom]=\"item.name\"\n [(ngModel)]=\"item.model.from\"\n (ngModelChange)=\"itemChange()\"\n [clear]=\"item.showClear\"\n [view]=\"viewType\"\n name=\"date_from\">\n</mat-form-field>\n\n<mat-form-field>\n <mat-label>{{item.label[1]}}</mat-label>\n <input\n matInput\n [fsFilterFocusTrigger]=\"item\"\n [focusTargetType]=\"'to'\"\n [fsDateRangeTo]=\"item.name\"\n [(ngModel)]=\"item.model.to\"\n (ngModelChange)=\"itemChange()\"\n [clear]=\"item.showClear\"\n [view]=\"viewType\"\n name=\"date_to\">\n</mat-form-field>\n" }]
3260
+ }], ctorParameters: function () { return [{ type: i0.KeyValueDiffers }, { type: i0.ChangeDetectorRef }]; } });
3261
+
3262
+ class WeekComponent extends BaseItemComponent {
3263
+ constructor(_kvDiffers, _cd) {
3264
+ super(_kvDiffers, _cd);
3265
+ this._kvDiffers = _kvDiffers;
3266
+ this._cd = _cd;
3267
+ }
3268
+ ngOnInit() { }
3269
+ }
3270
+ WeekComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: WeekComponent, deps: [{ token: i0.KeyValueDiffers }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
3271
+ WeekComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: WeekComponent, selector: "filter-item-week", usesInheritance: true, ngImport: i0, template: "<mat-form-field>\n <mat-label>{{item.label}}</mat-label>\n <input matInput\n fsDateWeekPicker\n [fsFilterFocusTrigger]=\"item\"\n [(ngModel)]=\"item.model\"\n [seedDate]=\"item.seedDate\"\n [clear]=\"item.showClear\"\n [name]=\"item.name\">\n <mat-placeholder *ngIf=\"inline\">{{ item.label }}</mat-placeholder>\n</mat-form-field>\n", components: [{ type: i1$3.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i3$4.FsDateWeekPickerComponent, selector: "[fsDateWeekPicker]", inputs: ["minYear", "maxYear", "minDate", "maxDate", "seedDate", "period", "view", "weekStartsOn"], outputs: ["change"] }], directives: [{ type: i1$3.MatLabel, selector: "mat-label" }, { type: i3$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: FocusToItemDirective, selector: "[fsFilterFocusTrigger]", inputs: ["fsFilterFocusTrigger", "focusTargetType"] }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i7.FsFormNoFsValidatorsDirective, selector: "[ngModel]:not([required]):not([fsFormRequired]):not([fsFormCompare]):not([fsFormDateRange]):not([fsFormEmail]):not([fsFormEmails]):not([fsFormFunction]):not([fsFormGreater]):not([fsFormInteger]):not([fsFormLesser]):not([fsFormMax]):not([fsFormMaxLength]):not([fsFormMin]):not([fsFormMinLength]):not([fsFormNumeric]):not([fsFormPattern]):not([fsFormPhone]):not([fsFormUrl]):not([validate])" }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1$3.MatPlaceholder, selector: "mat-placeholder" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3272
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: WeekComponent, decorators: [{
3273
+ type: Component,
3274
+ args: [{ selector: 'filter-item-week', changeDetection: ChangeDetectionStrategy.OnPush, template: "<mat-form-field>\n <mat-label>{{item.label}}</mat-label>\n <input matInput\n fsDateWeekPicker\n [fsFilterFocusTrigger]=\"item\"\n [(ngModel)]=\"item.model\"\n [seedDate]=\"item.seedDate\"\n [clear]=\"item.showClear\"\n [name]=\"item.name\">\n <mat-placeholder *ngIf=\"inline\">{{ item.label }}</mat-placeholder>\n</mat-form-field>\n" }]
3275
+ }], ctorParameters: function () { return [{ type: i0.KeyValueDiffers }, { type: i0.ChangeDetectorRef }]; } });
3276
+
3277
+ class CheckboxComponent extends BaseItemComponent {
3278
+ constructor(_kvDiffers, _cd) {
3279
+ super(_kvDiffers, _cd);
3280
+ this._kvDiffers = _kvDiffers;
3281
+ this._cd = _cd;
3282
+ }
3283
+ }
3284
+ CheckboxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: CheckboxComponent, deps: [{ token: i0.KeyValueDiffers }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
3285
+ CheckboxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: CheckboxComponent, selector: "filter-item-checkbox", usesInheritance: true, ngImport: i0, template: "<fs-label-field>\n <mat-checkbox [(ngModel)]=\"item.model\">\n {{ item.label }}\n </mat-checkbox>\n</fs-label-field>\n", styles: ["fs-label-field{margin:0}\n"], components: [{ type: i1$5.FsLabelFieldComponent, selector: "fs-label-field", inputs: ["bottomMargin", "topMargin", "labelMargin"] }, { type: i4$3.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "aria-describedby", "id", "required", "labelPosition", "name", "value", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }], directives: [{ type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i7.FsFormNoFsValidatorsDirective, selector: "[ngModel]:not([required]):not([fsFormRequired]):not([fsFormCompare]):not([fsFormDateRange]):not([fsFormEmail]):not([fsFormEmails]):not([fsFormFunction]):not([fsFormGreater]):not([fsFormInteger]):not([fsFormLesser]):not([fsFormMax]):not([fsFormMaxLength]):not([fsFormMin]):not([fsFormMinLength]):not([fsFormNumeric]):not([fsFormPattern]):not([fsFormPhone]):not([fsFormUrl]):not([validate])" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3286
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: CheckboxComponent, decorators: [{
3287
+ type: Component,
3288
+ args: [{ selector: 'filter-item-checkbox', changeDetection: ChangeDetectionStrategy.OnPush, template: "<fs-label-field>\n <mat-checkbox [(ngModel)]=\"item.model\">\n {{ item.label }}\n </mat-checkbox>\n</fs-label-field>\n", styles: ["fs-label-field{margin:0}\n"] }]
3289
+ }], ctorParameters: function () { return [{ type: i0.KeyValueDiffers }, { type: i0.ChangeDetectorRef }]; } });
3290
+
3291
+ class FilterItemComponent {
3292
+ constructor(_cdRef) {
3293
+ this._cdRef = _cdRef;
3294
+ this.itemType = ItemType;
3295
+ this._destroy$ = new Subject();
3296
+ }
3297
+ get textItem() {
3298
+ return this.item;
3299
+ }
3300
+ get chipsItem() {
3301
+ return this.item;
3302
+ }
3303
+ get baseSelectItem() {
3304
+ return this.item;
3305
+ }
3306
+ get rangeItem() {
3307
+ return this.item;
3308
+ }
3309
+ get autocompleteItem() {
3310
+ return this.item;
3311
+ }
3312
+ get autocompleteChipsItem() {
3313
+ return this.item;
3314
+ }
3315
+ get dateItem() {
3316
+ return this.item;
3317
+ }
3318
+ get dateRangeItem() {
3319
+ return this.item;
3320
+ }
3321
+ get dateTimeItem() {
3322
+ return this.item;
3323
+ }
3324
+ get dateTimeRangeItem() {
3325
+ return this.item;
3326
+ }
3327
+ get weekItem() {
3328
+ return this.item;
3329
+ }
3330
+ get checkboxItem() {
3331
+ return this.item;
3332
+ }
3333
+ ngOnInit() {
3334
+ this.item.value$
3335
+ .pipe(takeUntil(this._destroy$))
3336
+ .subscribe(() => {
3337
+ this._cdRef.markForCheck();
3338
+ });
3339
+ }
3340
+ ngOnDestroy() {
3341
+ this._destroy$.next();
3342
+ this._destroy$.complete();
3343
+ }
3344
+ }
3345
+ FilterItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FilterItemComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
3346
+ FilterItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: FilterItemComponent, selector: "filter-item", inputs: { item: "item" }, ngImport: i0, template: "<div class=\"filter filter-{{ item.type }}\">\n\n <ng-container [ngSwitch]=\"item.type\">\n <filter-item-text \n class=\"interface\"\n *ngSwitchCase=\"itemType.Text\"\n [item]=\"textItem\">\n </filter-item-text>\n\n <filter-item-select \n class=\"interface\"\n *ngSwitchCase=\"itemType.Select\"\n [item]=\"baseSelectItem\">\n </filter-item-select>\n\n <filter-item-chips \n class=\"interface\"\n *ngSwitchCase=\"itemType.Chips\"\n [item]=\"chipsItem\">\n </filter-item-chips>\n\n <filter-item-range \n class=\"interface interface-range\"\n *ngSwitchCase=\"itemType.Range\"\n [item]=\"rangeItem\">\n </filter-item-range>\n\n <filter-item-autocomplete \n class=\"interface\"\n *ngSwitchCase=\"itemType.AutoComplete\"\n [item]=\"autocompleteItem\">\n </filter-item-autocomplete>\n\n <filter-item-autocompletechips \n class=\"interface\"\n *ngSwitchCase=\"itemType.AutoCompleteChips\"\n [item]=\"autocompleteChipsItem\">\n </filter-item-autocompletechips>\n\n <filter-item-date \n class=\"interface interface-date\"\n *ngSwitchCase=\"itemType.Date\"\n [item]=\"dateItem\">\n </filter-item-date>\n\n <filter-item-date \n class=\"interface interface-date\"\n *ngSwitchCase=\"itemType.DateTime\"\n [item]=\"dateTimeItem\">\n </filter-item-date>\n\n <filter-item-date-range \n class=\"interface interface-date\"\n *ngSwitchCase=\"itemType.DateRange\"\n [item]=\"dateRangeItem\">\n </filter-item-date-range>\n\n <filter-item-date-range \n class=\"interface interface-date\"\n *ngSwitchCase=\"itemType.DateTimeRange\"\n [item]=\"dateTimeRangeItem\">\n </filter-item-date-range>\n\n <filter-item-week \n class=\"interface\"\n *ngSwitchCase=\"itemType.Week\"\n [item]=\"weekItem\">\n </filter-item-week>\n\n <filter-item-checkbox \n class=\"interface interface-checkbox\"\n *ngSwitchCase=\"itemType.Checkbox\"\n [item]=\"checkboxItem\">\n </filter-item-checkbox>\n </ng-container>\n\n</div>\n", components: [{ type: TextComponent, selector: "filter-item-text" }, { type: SelectComponent, selector: "filter-item-select" }, { type: ChipsComponent, selector: "filter-item-chips" }, { type: RangeComponent, selector: "filter-item-range" }, { type: AutocompleteComponent, selector: "filter-item-autocomplete" }, { type: AutocompletechipsComponent, selector: "filter-item-autocompletechips" }, { type: DateComponent, selector: "filter-item-date" }, { type: DateRangeComponent, selector: "filter-item-date-range" }, { type: WeekComponent, selector: "filter-item-week" }, { type: CheckboxComponent, selector: "filter-item-checkbox" }], directives: [{ type: i3.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i3.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3347
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FilterItemComponent, decorators: [{
3348
+ type: Component,
3349
+ args: [{ selector: 'filter-item', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"filter filter-{{ item.type }}\">\n\n <ng-container [ngSwitch]=\"item.type\">\n <filter-item-text \n class=\"interface\"\n *ngSwitchCase=\"itemType.Text\"\n [item]=\"textItem\">\n </filter-item-text>\n\n <filter-item-select \n class=\"interface\"\n *ngSwitchCase=\"itemType.Select\"\n [item]=\"baseSelectItem\">\n </filter-item-select>\n\n <filter-item-chips \n class=\"interface\"\n *ngSwitchCase=\"itemType.Chips\"\n [item]=\"chipsItem\">\n </filter-item-chips>\n\n <filter-item-range \n class=\"interface interface-range\"\n *ngSwitchCase=\"itemType.Range\"\n [item]=\"rangeItem\">\n </filter-item-range>\n\n <filter-item-autocomplete \n class=\"interface\"\n *ngSwitchCase=\"itemType.AutoComplete\"\n [item]=\"autocompleteItem\">\n </filter-item-autocomplete>\n\n <filter-item-autocompletechips \n class=\"interface\"\n *ngSwitchCase=\"itemType.AutoCompleteChips\"\n [item]=\"autocompleteChipsItem\">\n </filter-item-autocompletechips>\n\n <filter-item-date \n class=\"interface interface-date\"\n *ngSwitchCase=\"itemType.Date\"\n [item]=\"dateItem\">\n </filter-item-date>\n\n <filter-item-date \n class=\"interface interface-date\"\n *ngSwitchCase=\"itemType.DateTime\"\n [item]=\"dateTimeItem\">\n </filter-item-date>\n\n <filter-item-date-range \n class=\"interface interface-date\"\n *ngSwitchCase=\"itemType.DateRange\"\n [item]=\"dateRangeItem\">\n </filter-item-date-range>\n\n <filter-item-date-range \n class=\"interface interface-date\"\n *ngSwitchCase=\"itemType.DateTimeRange\"\n [item]=\"dateTimeRangeItem\">\n </filter-item-date-range>\n\n <filter-item-week \n class=\"interface\"\n *ngSwitchCase=\"itemType.Week\"\n [item]=\"weekItem\">\n </filter-item-week>\n\n <filter-item-checkbox \n class=\"interface interface-checkbox\"\n *ngSwitchCase=\"itemType.Checkbox\"\n [item]=\"checkboxItem\">\n </filter-item-checkbox>\n </ng-container>\n\n</div>\n" }]
3350
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { item: [{
3351
+ type: Input
3352
+ }] } });
3353
+
3354
+ class FilterDrawerComponent {
3355
+ constructor(_overlayRef, _data, externalParams, _cd, _itemsStore) {
3356
+ this._overlayRef = _overlayRef;
3357
+ this._data = _data;
3358
+ this.externalParams = externalParams;
3359
+ this._cd = _cd;
3360
+ this._itemsStore = _itemsStore;
3361
+ this.inline = false;
3362
+ this.windowDesktop = false;
3363
+ this._itemsStore.prepareItems();
3364
+ this._clear = this._data.clear;
3365
+ this._done = this._data.done;
3366
+ this.updateWindowWidth();
3367
+ }
3368
+ updateWindowWidth() {
3369
+ this.windowDesktop = window.innerWidth > 1200;
3370
+ }
3371
+ get items$() {
3372
+ return this._itemsStore.visibleItems$;
3373
+ }
3374
+ get sortItem() {
3375
+ return this._itemsStore.sortByItem;
3376
+ }
3377
+ get sortDirectionItem() {
3378
+ return this._itemsStore.sortDirectionItem;
3379
+ }
3380
+ clear() {
3381
+ this._clear();
3382
+ // this.overlayRef.detach();
3383
+ }
3384
+ done() {
3385
+ this._done();
3386
+ this._overlayRef.detach();
3387
+ }
3388
+ backdropClick() {
3389
+ this.done();
3390
+ }
3391
+ }
3392
+ FilterDrawerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FilterDrawerComponent, deps: [{ token: FILTER_DRAWER_OVERLAY }, { token: FILTER_DRAWER_DATA }, { token: ExternalParamsController }, { token: i0.ChangeDetectorRef }, { token: FsFilterItemsStore }], target: i0.ɵɵFactoryTarget.Component });
3393
+ FilterDrawerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: FilterDrawerComponent, selector: "ng-component", inputs: { inline: "inline" }, host: { listeners: { "window:resize": "updateWindowWidth()" } }, ngImport: i0, template: "<div class=\"filters\">\n <div class=\"filters-wrap\">\n\n <div class=\"filter-by\">\n <mat-icon>tune</mat-icon>\n <span class=\"text\">Filters</span>\n </div>\n\n <div class=\"overflow-shadow filter-items\">\n <div class=\"overflow-shadow-content\">\n <ng-container *fsSkeleton=\"(externalParams.pending$ | async) !== true\">\n <filter-item \n *ngFor=\"let filterItem of items$ | async\"\n class=\"filter-group\"\n [item]=\"filterItem\">\n </filter-item>\n\n <ng-container *ngIf=\"sortItem && sortItem.values && sortItem.values.length > 0\">\n <filter-item \n class=\"filter-group sort\"\n [item]=\"sortItem\">\n </filter-item>\n <filter-item \n class=\"filter-group sort\"\n [item]=\"sortDirectionItem\">\n </filter-item>\n </ng-container>\n </ng-container>\n </div>\n </div>\n\n <fs-filter-drawer-actions \n class=\"filter-actions\"\n *ngIf=\"(externalParams.pending$ | async) !== true\"\n (clear)=\"clear()\"\n (done)=\"done()\">\n </fs-filter-drawer-actions>\n </div>\n</div>\n<div class=\"backdrop\" *ngIf=\"!windowDesktop\" (click)=\"backdropClick()\"></div>\n", styles: [":host ::ng-deep mat-form-field{width:100%}.filter-by{display:flex;flex-direction:row;align-items:center;box-sizing:border-box;padding:20px 25px}.filter-by mat-icon{margin-right:8px}.filter-by .text{font-weight:400;font-size:19px}.filter-actions{display:block;box-sizing:border-box;padding:13px}.filter-actions button{margin-right:6px}.filter-actions button:last-child{margin-right:0}.filters{position:fixed;display:block;top:0;right:0;z-index:1002;bottom:0}.filters .filters-wrap{background:#fff;box-shadow:0 2px 4px -1px #0003,0 4px 5px #00000024,0 1px 10px #0000001f;width:85vw;max-width:350px;display:flex;flex-direction:column;height:100%;padding-top:env(safe-area-inset-top)}.filters .filters-wrap .filter-items{overflow-y:auto}.filters .filters-wrap .filter-items .overflow-shadow-content{padding:0 25px;box-sizing:border-box}.filters .filter-group{margin:10px 0 0}.filters .filter-group:first-child{margin:0}.filters .filter label{white-space:nowrap;color:#0000008a}.filters .filter .interface.interface-range input,.filters .filter .interface.interface-range .mat-input-wrapper,.filters .filter .interface.interface-range{text-align:center}.filters .filter .interface.interface-datetime fs-datetime.has-time .md-input{width:100%}.filters .filter .interface fs-datetime-range input{text-align:center}.filters .filter .filter-label{width:1%;white-space:nowrap;vertical-align:middle;padding-right:15px}.filters md-autocomplete-container md-input-container{margin:0}.filters .isolate{margin-top:-12px}.filters .isolate .interface{line-height:20px;padding-bottom:1.25em}.filters .isolate md-checkbox{margin:0 0 0 2px}.backdrop{position:fixed;inset:0;z-index:900;outline:none}\n"], components: [{ type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: FilterItemComponent, selector: "filter-item", inputs: ["item"] }, { type: FsFilterDrawerActionsComponent, selector: "fs-filter-drawer-actions", outputs: ["clear", "done"] }], directives: [{ type: i6$1.FsSkeletonContentDirective, selector: "[fsSkeleton]", inputs: ["fsSkeleton", "fsSkeletonPattern"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i3.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
3394
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FilterDrawerComponent, decorators: [{
3395
+ type: Component,
3396
+ args: [{ changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"filters\">\n <div class=\"filters-wrap\">\n\n <div class=\"filter-by\">\n <mat-icon>tune</mat-icon>\n <span class=\"text\">Filters</span>\n </div>\n\n <div class=\"overflow-shadow filter-items\">\n <div class=\"overflow-shadow-content\">\n <ng-container *fsSkeleton=\"(externalParams.pending$ | async) !== true\">\n <filter-item \n *ngFor=\"let filterItem of items$ | async\"\n class=\"filter-group\"\n [item]=\"filterItem\">\n </filter-item>\n\n <ng-container *ngIf=\"sortItem && sortItem.values && sortItem.values.length > 0\">\n <filter-item \n class=\"filter-group sort\"\n [item]=\"sortItem\">\n </filter-item>\n <filter-item \n class=\"filter-group sort\"\n [item]=\"sortDirectionItem\">\n </filter-item>\n </ng-container>\n </ng-container>\n </div>\n </div>\n\n <fs-filter-drawer-actions \n class=\"filter-actions\"\n *ngIf=\"(externalParams.pending$ | async) !== true\"\n (clear)=\"clear()\"\n (done)=\"done()\">\n </fs-filter-drawer-actions>\n </div>\n</div>\n<div class=\"backdrop\" *ngIf=\"!windowDesktop\" (click)=\"backdropClick()\"></div>\n", styles: [":host ::ng-deep mat-form-field{width:100%}.filter-by{display:flex;flex-direction:row;align-items:center;box-sizing:border-box;padding:20px 25px}.filter-by mat-icon{margin-right:8px}.filter-by .text{font-weight:400;font-size:19px}.filter-actions{display:block;box-sizing:border-box;padding:13px}.filter-actions button{margin-right:6px}.filter-actions button:last-child{margin-right:0}.filters{position:fixed;display:block;top:0;right:0;z-index:1002;bottom:0}.filters .filters-wrap{background:#fff;box-shadow:0 2px 4px -1px #0003,0 4px 5px #00000024,0 1px 10px #0000001f;width:85vw;max-width:350px;display:flex;flex-direction:column;height:100%;padding-top:env(safe-area-inset-top)}.filters .filters-wrap .filter-items{overflow-y:auto}.filters .filters-wrap .filter-items .overflow-shadow-content{padding:0 25px;box-sizing:border-box}.filters .filter-group{margin:10px 0 0}.filters .filter-group:first-child{margin:0}.filters .filter label{white-space:nowrap;color:#0000008a}.filters .filter .interface.interface-range input,.filters .filter .interface.interface-range .mat-input-wrapper,.filters .filter .interface.interface-range{text-align:center}.filters .filter .interface.interface-datetime fs-datetime.has-time .md-input{width:100%}.filters .filter .interface fs-datetime-range input{text-align:center}.filters .filter .filter-label{width:1%;white-space:nowrap;vertical-align:middle;padding-right:15px}.filters md-autocomplete-container md-input-container{margin:0}.filters .isolate{margin-top:-12px}.filters .isolate .interface{line-height:20px;padding-bottom:1.25em}.filters .isolate md-checkbox{margin:0 0 0 2px}.backdrop{position:fixed;inset:0;z-index:900;outline:none}\n"] }]
3397
+ }], ctorParameters: function () { return [{ type: i1$6.OverlayRef, decorators: [{
3398
+ type: Inject,
3399
+ args: [FILTER_DRAWER_OVERLAY]
3400
+ }] }, { type: undefined, decorators: [{
3401
+ type: Inject,
3402
+ args: [FILTER_DRAWER_DATA]
3403
+ }] }, { type: ExternalParamsController }, { type: i0.ChangeDetectorRef }, { type: FsFilterItemsStore }]; }, propDecorators: { inline: [{
3404
+ type: Input
3405
+ }], updateWindowWidth: [{
3406
+ type: HostListener,
3407
+ args: ['window:resize']
3408
+ }] } });
3409
+
3410
+ class ActionsController {
3411
+ constructor(_breakpointObserver) {
3412
+ this._breakpointObserver = _breakpointObserver;
3413
+ this._visible$ = new BehaviorSubject(false);
3414
+ this._actions$ = new BehaviorSubject([]);
3415
+ this._menuActions$ = new BehaviorSubject([]);
3416
+ this._destroy$ = new Subject();
3417
+ this._mobileMedia = '(max-width: 799px)';
3418
+ this._allActions = [];
3419
+ this._listenMobileMedia();
3420
+ }
3421
+ get menuActions() {
3422
+ return this._menuActions$.value;
3423
+ }
3424
+ get actions() {
3425
+ return this._actions$.value;
3426
+ }
3427
+ get actions$() {
3428
+ return this._actions$.asObservable();
3429
+ }
3430
+ get menuActions$() {
3431
+ return this._menuActions$.asObservable();
3432
+ }
3433
+ get visible$() {
3434
+ return this._visible$.asObservable();
3435
+ }
3436
+ get mobileMode() {
3437
+ return this._breakpointObserver.isMatched(this._mobileMedia);
3438
+ }
3439
+ ngOnDestroy() {
3440
+ this._destroy$.next();
3441
+ this._destroy$.complete();
3442
+ }
3443
+ setConfig(config) {
3444
+ this._config = config;
3445
+ this.initActions(config.actions);
3446
+ }
3447
+ initActions(rawActions) {
3448
+ if (!rawActions || !Array.isArray(rawActions)) {
3449
+ return;
3450
+ }
3451
+ this.show();
3452
+ this._allActions = rawActions
3453
+ .map((action) => new Action(this._config, action));
3454
+ if (this._reorderAction) {
3455
+ this._allActions.unshift(this._reorderAction);
3456
+ }
3457
+ this._classifyActions();
3458
+ }
3459
+ show() {
3460
+ this._visible$.next(true);
3461
+ }
3462
+ hide() {
3463
+ this._visible$.next(false);
3464
+ }
3465
+ addReorderAction(action) {
3466
+ this._allActions.unshift(action);
3467
+ action.isReorderAction = true;
3468
+ this._classifyAction(action);
3469
+ this._reorderAction = action;
3470
+ }
3471
+ clearActions() {
3472
+ this._allActions = [];
3473
+ this._setActions([]);
3474
+ this._setKebabActions([]);
3475
+ }
3476
+ updateActionsVisibility() {
3477
+ this._allActions.forEach((action) => action.updateVisibility());
3478
+ this._classifyActions();
3479
+ }
3480
+ updateDisabledState() {
3481
+ this.actions.forEach((action) => action.updateDisabledState());
3482
+ }
3483
+ _setKebabActions(actions) {
3484
+ this._menuActions$.next(actions);
3485
+ }
3486
+ _setActions(actions) {
3487
+ this._actions$.next(actions);
3488
+ }
3489
+ _classifyActions() {
3490
+ const kebabActions = [];
3491
+ const actions = [];
3492
+ const mobileMode = this.mobileMode;
3493
+ this._allActions
3494
+ .filter((action) => {
3495
+ return action.visible;
3496
+ })
3497
+ .forEach((action) => {
3498
+ if (action.menu !== false && (action.menu || mobileMode)) {
3499
+ kebabActions.push(action);
3500
+ }
3501
+ else {
3502
+ actions.push(action);
3503
+ }
3504
+ });
3505
+ this._setKebabActions(kebabActions);
3506
+ this._setActions(actions);
3507
+ }
3508
+ _classifyAction(action) {
3509
+ if (action.menu) {
3510
+ this._setKebabActions([...this.menuActions, action]);
3511
+ }
3512
+ else {
3513
+ this._setActions([...this.actions, action]);
3514
+ }
3515
+ }
3516
+ _listenMobileMedia() {
3517
+ this._breakpointObserver.observe(this._mobileMedia)
3518
+ .pipe(skip(1), takeUntil(this._destroy$))
3519
+ .subscribe(() => {
3520
+ this._classifyActions();
3521
+ });
3522
+ }
3523
+ }
3524
+ ActionsController.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ActionsController, deps: [{ token: i1$7.BreakpointObserver }], target: i0.ɵɵFactoryTarget.Injectable });
3525
+ ActionsController.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ActionsController });
3526
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ActionsController, decorators: [{
3527
+ type: Injectable
3528
+ }], ctorParameters: function () { return [{ type: i1$7.BreakpointObserver }]; } });
3529
+
3530
+ const FS_FILTER_META = new InjectionToken('fs.filter.meta', {
3531
+ providedIn: 'root',
3532
+ factory: () => {
3533
+ return {
3534
+ openedFilters: 0,
3535
+ };
3536
+ }
3537
+ });
3538
+
3539
+ class FsFilterOverlayService {
3540
+ constructor(_filterMeta, _injector, _overlay, _focusController) {
3541
+ this._filterMeta = _filterMeta;
3542
+ this._injector = _injector;
3543
+ this._overlay = _overlay;
3544
+ this._focusController = _focusController;
3545
+ this.detach$ = new Subject();
3546
+ this.attach$ = new Subject();
3547
+ this._destroy$ = new Subject();
3548
+ this._openWhenChipClicked();
3549
+ }
3550
+ get isOpened() {
3551
+ return !!this._overlayRef;
3552
+ }
3553
+ setClearFn(fn) {
3554
+ this._clearFn = fn;
3555
+ }
3556
+ setDoneFn(fn) {
3557
+ this._doneFn = fn;
3558
+ }
3559
+ close() {
3560
+ if (this._overlayRef) {
3561
+ this._overlayRef.detach();
3562
+ this._overlayRef = null;
3563
+ this._removeFilterClass();
3564
+ }
3565
+ }
3566
+ open() {
3567
+ this._overlayRef = this._createOverlay();
3568
+ this._overlayRef.backdropClick()
3569
+ .pipe(takeUntil(this._destroy$))
3570
+ .subscribe(() => {
3571
+ this._overlayRef.detach();
3572
+ });
3573
+ this._overlayRef.detachments()
3574
+ .pipe(takeUntil(this._destroy$))
3575
+ .subscribe(() => {
3576
+ this.detach$.next();
3577
+ });
3578
+ this._overlayRef.attachments()
3579
+ .pipe(takeUntil(this._destroy$))
3580
+ .subscribe(() => {
3581
+ this.attach$.next();
3582
+ });
3583
+ this._addFilterClass();
3584
+ return this._openPortalPreview();
3585
+ }
3586
+ ngOnDestroy() {
3587
+ this._destroy$.next();
3588
+ this._destroy$.complete();
3589
+ }
3590
+ _createOverlay() {
3591
+ const overlayConfig = new OverlayConfig({
3592
+ hasBackdrop: true,
3593
+ backdropClass: 'fs-filter-backdrop',
3594
+ });
3595
+ return this._overlay.create(overlayConfig);
3596
+ }
3597
+ _openPortalPreview() {
3598
+ const data = {
3599
+ done: this._doneFn,
3600
+ clear: this._clearFn,
3601
+ };
3602
+ const injector = this._createInjector(this._injector, data, this._overlayRef);
3603
+ const containerPortal = new ComponentPortal(FilterDrawerComponent, undefined, injector);
3604
+ const containerRef = this._overlayRef.attach(containerPortal);
3605
+ return containerRef.instance;
3606
+ }
3607
+ _createInjector(parentInjector, data, overlayRef) {
3608
+ const injectionTokens = new WeakMap([
3609
+ [FILTER_DRAWER_DATA, data],
3610
+ [FILTER_DRAWER_OVERLAY, overlayRef],
3611
+ ]);
3612
+ return new PortalInjector(parentInjector, injectionTokens);
3613
+ }
3614
+ _removeFilterClass() {
3615
+ this._filterMeta.openedFilters--;
3616
+ if (this._filterMeta.openedFilters === 0) {
3617
+ window.document.body.classList.remove('fs-filter-open');
3618
+ }
3619
+ }
3620
+ _addFilterClass() {
3621
+ this._filterMeta.openedFilters++;
3622
+ if (this._filterMeta.openedFilters === 1) {
3623
+ window.document.body.classList.add('fs-filter-open');
3624
+ }
3625
+ }
3626
+ _openWhenChipClicked() {
3627
+ this._focusController.focusOn$
3628
+ .pipe(filter$1((v) => !!v), takeUntil(this._destroy$))
3629
+ .subscribe(() => {
3630
+ if (!this.isOpened) {
3631
+ this.open();
3632
+ }
3633
+ });
3634
+ }
3635
+ }
3636
+ FsFilterOverlayService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFilterOverlayService, deps: [{ token: FS_FILTER_META }, { token: i0.Injector }, { token: i1$6.Overlay }, { token: FocusControllerService }], target: i0.ɵɵFactoryTarget.Injectable });
3637
+ FsFilterOverlayService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFilterOverlayService });
3638
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFilterOverlayService, decorators: [{
3639
+ type: Injectable
3640
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
3641
+ type: Inject,
3642
+ args: [FS_FILTER_META]
3643
+ }] }, { type: i0.Injector }, { type: i1$6.Overlay }, { type: FocusControllerService }]; } });
3644
+
3645
+ class FilterStatusBarDirective {
3646
+ constructor(templateRef) {
3647
+ this.templateRef = templateRef;
3648
+ }
3649
+ }
3650
+ FilterStatusBarDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FilterStatusBarDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
3651
+ FilterStatusBarDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FilterStatusBarDirective, selector: "[fsFilterStatusBar]", ngImport: i0 });
3652
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FilterStatusBarDirective, decorators: [{
3653
+ type: Directive,
3654
+ args: [{
3655
+ selector: '[fsFilterStatusBar]',
3656
+ }]
3657
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
3658
+
3659
+ const FS_FILTER_CONFIG = new InjectionToken('fs.filter-config');
3660
+
3661
+ class FilterComponent {
3662
+ constructor(_defaultConfig, _filterOverlay, _zone, _externalParams, _filterItems, _actions) {
3663
+ this._defaultConfig = _defaultConfig;
3664
+ this._filterOverlay = _filterOverlay;
3665
+ this._zone = _zone;
3666
+ this._externalParams = _externalParams;
3667
+ this._filterItems = _filterItems;
3668
+ this._actions = _actions;
3669
+ this.showSortBy = true;
3670
+ this.showFilterInput = true;
3671
+ this.closed = new EventEmitter();
3672
+ this.opened = new EventEmitter();
3673
+ this.ready = new EventEmitter();
3674
+ this.showFilterMenu = false;
3675
+ this.windowDesktop = false;
3676
+ this.fsFilterClass = true;
3677
+ this.searchPlaceholder = 'Search';
3678
+ this.keyword = '';
3679
+ this._config = null;
3680
+ this._filtersBtnVisible$ = new BehaviorSubject(true);
3681
+ this._keywordVisible$ = new BehaviorSubject(true);
3682
+ this._hasFilterChips$ = new BehaviorSubject(false);
3683
+ this._keyword$ = new Subject();
3684
+ this._destroy$ = new Subject();
3685
+ this._filterItems.filter = this;
3686
+ this._listenWhenFilterReady();
3687
+ this._updateWindowWidth();
3688
+ this._filterOverlay.attach$
3689
+ .pipe(takeUntil(this._destroy$))
3690
+ .subscribe(() => {
3691
+ this.showFilterMenu = true;
3692
+ });
3693
+ this._filterOverlay.detach$
3694
+ .pipe(takeUntil(this._destroy$))
3695
+ .subscribe(() => {
3696
+ this.showFilterMenu = false;
3697
+ });
3698
+ this._listenWindowResize();
3699
+ }
3700
+ set setConfig(config) {
3701
+ this._initFilterWithConfig(config);
3702
+ }
3703
+ set setFilter(config) {
3704
+ this._initFilterWithConfig(config);
3705
+ }
3706
+ get hasKeyword() {
3707
+ return this._filterItems.hasKeyword;
3708
+ }
3709
+ get config() {
3710
+ return this._config;
3711
+ }
3712
+ get filterParams() {
3713
+ return this._filterItems.values();
3714
+ }
3715
+ get filterParamsQuery() {
3716
+ return this._filterItems.valuesAsQuery();
3717
+ }
3718
+ get items() {
3719
+ return this._filterItems.items;
3720
+ }
3721
+ get visibleItems() {
3722
+ return this._filterItems.visibleItems;
3723
+ }
3724
+ get itemsReady$() {
3725
+ return this._filterItems.ready$;
3726
+ }
3727
+ get hasFilterChips$() {
3728
+ return this._hasFilterChips$.asObservable();
3729
+ }
3730
+ get hasVisibleItemOrSorting() {
3731
+ return this.visibleItems.length > 0 || !!this._filterItems.sortByItem;
3732
+ }
3733
+ get filtersBtnVisible$() {
3734
+ return this._filtersBtnVisible$.asObservable();
3735
+ }
3736
+ get keywordVisible$() {
3737
+ return this._keywordVisible$.asObservable();
3738
+ }
3739
+ get actionsVisible$() {
3740
+ return this._actions.visible$;
3741
+ }
3742
+ get actions$() {
3743
+ return this._actions.actions$;
3744
+ }
3745
+ get menuActions$() {
3746
+ return this._actions.menuActions$;
3747
+ }
3748
+ ngOnInit() {
3749
+ // Avoid ngChanges error
3750
+ setTimeout(() => {
3751
+ if (this.config.autofocus) {
3752
+ this.focus();
3753
+ }
3754
+ });
3755
+ this._listenInputChanges();
3756
+ this._listenInternalItemsChange();
3757
+ this._initOverlay();
3758
+ }
3759
+ ngOnDestroy() {
3760
+ this._destroyFilterDrawer();
3761
+ this._destroy$.next();
3762
+ this._destroy$.complete();
3763
+ }
3764
+ focus() {
3765
+ this.keywordMatInput?.focus();
3766
+ }
3767
+ updateSort(sort) {
3768
+ this._filterItems.updateSort(sort);
3769
+ }
3770
+ /**
3771
+ *
3772
+ * Do update value of some field
3773
+ *
3774
+ * @param values - values for update
3775
+ *
3776
+ * To update text value just pass new text value
3777
+ *
3778
+ * public updateSelectValue(val) {
3779
+ * this.filterEl.updateValues({ keyword: val });
3780
+ * }
3781
+ *
3782
+ * To update select or observable select you could pass suitable value
3783
+ *
3784
+ * public updateSelectValue(val: number) {
3785
+ * this.filterEl.updateValues({ simple_select: val }, { observable_select: val });
3786
+ * }
3787
+ *
3788
+ * To update checkbox value just pass true/false as value
3789
+ *
3790
+ * public updateCheckox(val: boolean) {
3791
+ * this.filterEl.updateValues({ checkbox: val });
3792
+ * }
3793
+ *
3794
+ * To update range value just pass object with min&max object or just with one of targets
3795
+ *
3796
+ * Ex.: { min: 10, max 15 }, { min: 5 }, { max 5 }
3797
+ *
3798
+ * public updateRange(val) {
3799
+ * this.filterEl.updateValues({ range: val });
3800
+ * }
3801
+ *
3802
+ * To update autocomplete just pass object with name/value fields
3803
+ *
3804
+ * Ex.: { name: 'John Doe', value: 1 }
3805
+ *
3806
+ * public updateAutocomplete(val) {
3807
+ * this.filterEl.updateValues({ autocomplete_user_id: val });
3808
+ * }
3809
+ *
3810
+ * To update autocompletechips just pass:
3811
+ *
3812
+ * 1) object with name/value fields - will be appended to existing set of values
3813
+ *
3814
+ * { name: 'John Doe', value: 1 }
3815
+ *
3816
+ * 2) array of objects - will be appended to existing set of values
3817
+ *
3818
+ * [{ name: 'John Doe', value: 1 }, { name: 'Darya Filipova', value: 2 }]
3819
+ *
3820
+ * 3) null - clear existing set of values
3821
+ *
3822
+ * public updateAutocomplete(val) {
3823
+ * this.filterEl.updateValues({ autocompletechips_user_id: val });
3824
+ * }
3825
+ *
3826
+ */
3827
+ updateValues(values) {
3828
+ Object.keys(values).forEach((key) => {
3829
+ const filterItem = this.items
3830
+ .find((item) => item.name === key);
3831
+ if (!filterItem) {
3832
+ return;
3833
+ }
3834
+ filterItem.model = values[key];
3835
+ });
3836
+ }
3837
+ hide() {
3838
+ this.changeVisibility(false);
3839
+ }
3840
+ show() {
3841
+ this.changeVisibility(true);
3842
+ }
3843
+ changeVisibilityClick(value, event = null) {
3844
+ if (event) {
3845
+ event.stopPropagation();
3846
+ }
3847
+ this.changeVisibility(value);
3848
+ }
3849
+ get itemValues() {
3850
+ return this.items
3851
+ .map((item) => item.value);
3852
+ }
3853
+ get nonEmptyItemValues() {
3854
+ return this.items
3855
+ .filter((item) => item.value !== undefined)
3856
+ .map((item) => item.value);
3857
+ }
3858
+ get hasItemValues() {
3859
+ return this.items
3860
+ .some((item) => item.value !== undefined);
3861
+ }
3862
+ getItemValue(name) {
3863
+ const item = this.items
3864
+ .find((item) => item.name === name);
3865
+ return item?.value;
3866
+ }
3867
+ showItem(name) {
3868
+ const item = this.getItem(name);
3869
+ if (item) {
3870
+ item.hide = false;
3871
+ this._filterItems.updateItemsVisiblity();
3872
+ }
3873
+ }
3874
+ hideItem(name) {
3875
+ const item = this.getItem(name);
3876
+ if (!item) {
3877
+ return;
3878
+ }
3879
+ item.hide = true;
3880
+ this._filterItems.updateItemsVisiblity();
3881
+ }
3882
+ clearItem(name) {
3883
+ const item = this.getItem(name);
3884
+ if (!item) {
3885
+ return;
3886
+ }
3887
+ item.clear();
3888
+ }
3889
+ updateItemConfig(name, params) {
3890
+ const item = this.getItem(name);
3891
+ if (!item) {
3892
+ return;
3893
+ }
3894
+ item.label = params.label ?? item.label;
3895
+ item.chipLabel = params.chipLabel ?? item.chipLabel;
3896
+ this._filterItems.updateItemsVisiblity();
3897
+ }
3898
+ getItemValueChange$(name) {
3899
+ const item = this.items.find((i) => i.name === name);
3900
+ if (item) {
3901
+ return item.value$
3902
+ .pipe(map(() => {
3903
+ return item.model;
3904
+ }));
3905
+ }
3906
+ return null;
3907
+ }
3908
+ changeVisibility(state) {
3909
+ if (state === this.showFilterMenu) {
3910
+ return;
3911
+ }
3912
+ if (!state) {
3913
+ this.closed.emit();
3914
+ return this._destroyFilterDrawer();
3915
+ }
3916
+ if (!this.hasVisibleItemOrSorting) {
3917
+ return;
3918
+ }
3919
+ this._listenEscButton();
3920
+ this.opened.emit();
3921
+ this._filterOverlay.open();
3922
+ }
3923
+ init() {
3924
+ const data = this._filterItems.valuesAsQuery();
3925
+ this._sort = this._filterItems.getSort();
3926
+ if (this.config.init) {
3927
+ this.config.init(data, this._sort, this);
3928
+ }
3929
+ this._updateChipsVisibility();
3930
+ this.items
3931
+ .forEach((item) => {
3932
+ item.init(item, this);
3933
+ });
3934
+ }
3935
+ clear(event = null) {
3936
+ if (event) {
3937
+ event.stopPropagation();
3938
+ }
3939
+ this._filterItems.filtersClear();
3940
+ if (this.config.clear) {
3941
+ this.config.clear();
3942
+ }
3943
+ this.keyword = '';
3944
+ }
3945
+ /**
3946
+ * Close filter window and do change callback
3947
+ */
3948
+ search(event) {
3949
+ this.changeVisibilityClick(false, event);
3950
+ }
3951
+ reload(event = null) {
3952
+ if (event) {
3953
+ event.preventDefault();
3954
+ event.stopPropagation();
3955
+ }
3956
+ const data = this._filterItems.valuesAsQuery();
3957
+ if (this.config.reload) {
3958
+ this.config.reload(data, this._filterItems.getSort());
3959
+ }
3960
+ }
3961
+ getItem(name) {
3962
+ return this.items
3963
+ .find((item) => item.name === name);
3964
+ }
3965
+ fetchQueryParams() {
3966
+ this._externalParams.fetchQueryParams();
3967
+ }
3968
+ /**
3969
+ * Call change callback and apply new filter values
3970
+ */
3971
+ change() {
3972
+ const data = this._filterItems.valuesAsQuery();
3973
+ const sort = this._filterItems.getSort();
3974
+ const sortingChanged = ((!sort || !this._sort) && sort !== this._sort)
3975
+ || (sort && this._sort && !objectsAreEquals(this._sort, sort));
3976
+ if (sortingChanged) {
3977
+ this._sort = sort;
3978
+ if (this.config.sortChange) {
3979
+ this.config.sortChange(data, sort);
3980
+ }
3981
+ }
3982
+ if (this.config.change) {
3983
+ this.config.change(data, sort);
3984
+ }
3985
+ this._updateChipsVisibility();
3986
+ // visibility for actions can depend on filters state
3987
+ this._actions.updateActionsVisibility();
3988
+ }
3989
+ /**
3990
+ * Update filter actions config
3991
+ *
3992
+ * @param actions
3993
+ */
3994
+ updateActions(actions) {
3995
+ this._actions.initActions(actions);
3996
+ }
3997
+ /**
3998
+ * Show "Filters" button
3999
+ */
4000
+ showFiltersBtn() {
4001
+ this._filtersBtnVisible$.next(true);
4002
+ }
4003
+ /**
4004
+ * Hide "Filters" button
4005
+ */
4006
+ hideFiltersBtn() {
4007
+ this._filtersBtnVisible$.next(false);
4008
+ }
4009
+ /**
4010
+ * Show "Keyword" field if it present
4011
+ */
4012
+ showKeywordField() {
4013
+ this._keywordVisible$.next(true);
4014
+ }
4015
+ /**
4016
+ * Hide "Keyword" field if it present
4017
+ */
4018
+ hideKeywordField() {
4019
+ this._keywordVisible$.next(false);
4020
+ }
4021
+ /**
4022
+ * Go through actions and check show() callback and update visible actions
4023
+ */
4024
+ updateActionsVisibility() {
4025
+ this._actions.updateActionsVisibility();
4026
+ }
4027
+ /**
4028
+ * Go through actions and check disabled() callback and update disabled state
4029
+ */
4030
+ updateDisabledState() {
4031
+ this._actions.updateDisabledState();
4032
+ }
4033
+ setItems(items) {
4034
+ this._filterItems.destroyItems();
4035
+ this.config.items = items;
4036
+ this._filterItems.setConfig(this._config);
4037
+ this._externalParams.initItems();
4038
+ this._syncSearchInputWithKeyword();
4039
+ }
4040
+ keywordChange(keyword) {
4041
+ this._keyword$.next(keyword);
4042
+ }
4043
+ _initFilterWithConfig(config) {
4044
+ if (this.config) {
4045
+ this._filterItems.destroyItems();
4046
+ }
4047
+ config = {
4048
+ ...(this._defaultConfig || {}),
4049
+ ...config,
4050
+ };
4051
+ this._config = new FsFilterConfig(config);
4052
+ this._actions.setConfig(this._config);
4053
+ this._filterItems.setConfig(this._config);
4054
+ this._externalParams.setConfig(this._config);
4055
+ this._syncSearchInputWithKeyword();
4056
+ if (!!this.config.reloadWhenConfigChanged) {
4057
+ this.change();
4058
+ }
4059
+ }
4060
+ _destroyFilterDrawer() {
4061
+ this._filterOverlay.close();
4062
+ }
4063
+ _updateWindowWidth() {
4064
+ this.windowDesktop = window.innerWidth > 1200;
4065
+ }
4066
+ _listenEscButton() {
4067
+ this._zone.runOutsideAngular(() => {
4068
+ fromEvent(window, 'keyup')
4069
+ .pipe(filter$1((event) => event.code === 'Escape'), takeUntil(this.closed), takeUntil(this._destroy$))
4070
+ .subscribe(() => {
4071
+ this._zone.run(() => {
4072
+ this.changeVisibility(false);
4073
+ });
4074
+ });
4075
+ });
4076
+ }
4077
+ _listenWindowResize() {
4078
+ this._zone.runOutsideAngular(() => {
4079
+ fromEvent(window, 'resize')
4080
+ .pipe(debounceTime(100), takeUntil(this._destroy$))
4081
+ .subscribe(() => {
4082
+ this._zone.run(() => {
4083
+ this._updateWindowWidth();
4084
+ });
4085
+ });
4086
+ });
4087
+ }
4088
+ _listenInputChanges() {
4089
+ this._keyword$
4090
+ .pipe(debounceTime(200), distinctUntilChanged(), takeUntil(this._destroy$))
4091
+ .subscribe((value) => {
4092
+ const keywordItem = this._filterItems.keywordItem;
4093
+ keywordItem.model = value;
4094
+ this.change();
4095
+ });
4096
+ }
4097
+ _syncSearchInputWithKeyword() {
4098
+ const keywordItem = this._filterItems.keywordItem;
4099
+ if (keywordItem) {
4100
+ this.keyword = keywordItem.model;
4101
+ this.searchPlaceholder = keywordItem.label || 'Search';
4102
+ }
4103
+ }
4104
+ _listenInternalItemsChange() {
4105
+ this._filterItems
4106
+ .itemsChange$
4107
+ .pipe(takeUntil(this._destroy$))
4108
+ .subscribe(() => {
4109
+ this.change();
4110
+ });
4111
+ }
4112
+ _initOverlay() {
4113
+ this._filterOverlay.setClearFn(this.clear.bind(this));
4114
+ this._filterOverlay.setDoneFn(this.hide.bind(this));
4115
+ }
4116
+ // We may need some time to recieve external params and after that ready can be emitted
4117
+ _listenWhenFilterReady() {
4118
+ combineLatest([
4119
+ this._externalParams.pending$,
4120
+ this.itemsReady$,
4121
+ ])
4122
+ .pipe(filter$1(([pendingParams, itemsReady]) => !pendingParams && itemsReady), takeUntil(this._destroy$))
4123
+ .subscribe(() => {
4124
+ this.init();
4125
+ this._syncSearchInputWithKeyword();
4126
+ this.ready.emit();
4127
+ });
4128
+ }
4129
+ _updateChipsVisibility() {
4130
+ const hasFilterChips = this._filterItems.items
4131
+ .some((item) => {
4132
+ return item.isChipVisible;
4133
+ });
4134
+ this._hasFilterChips$.next(hasFilterChips);
4135
+ }
4136
+ }
4137
+ FilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FilterComponent, deps: [{ token: FS_FILTER_CONFIG, optional: true }, { token: FsFilterOverlayService }, { token: i0.NgZone }, { token: ExternalParamsController }, { token: FsFilterItemsStore }, { token: ActionsController }], target: i0.ɵɵFactoryTarget.Component });
4138
+ FilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: FilterComponent, selector: "fs-filter", inputs: { setConfig: ["config", "setConfig"], setFilter: ["filter", "setFilter"], showSortBy: "showSortBy", showFilterInput: "showFilterInput" }, outputs: { closed: "closed", opened: "opened", ready: "ready" }, host: { properties: { "class.filters-open": "this.showFilterMenu", "class.window-desktop": "this.windowDesktop", "class.fs-filter": "this.fsFilterClass", "class.has-keyword": "this.hasKeyword" } }, providers: [
4139
+ FsFilterOverlayService,
4140
+ ExternalParamsController,
4141
+ PersistanceParamsController,
4142
+ QueryParamsController,
4143
+ FocusControllerService,
4144
+ FsFilterItemsStore,
4145
+ SavedFiltersController,
4146
+ ActionsController,
4147
+ ], queries: [{ propertyName: "statusBar", first: true, predicate: FilterStatusBarDirective, descendants: true }], viewQueries: [{ propertyName: "keywordMatInput", first: true, predicate: ["keywordMatInput"], descendants: true, read: MatInput }], ngImport: i0, template: "<div class=\"filter-container\">\n <div class=\"filter-inner-container\">\n <ng-container *ngIf=\"!hasKeyword; else filterKeyword\">\n <div>\n <ng-container *ngTemplateOutlet=\"filterStatusBarChips\"></ng-container> \n </div>\n </ng-container>\n \n <ng-container [ngTemplateOutlet]=\"filterToolbar\"></ng-container>\n <ng-container [ngTemplateOutlet]=\"filterActions\"></ng-container>\n </div>\n\n <ng-container *ngIf=\"hasKeyword\">\n <ng-container *ngTemplateOutlet=\"filterStatusBarChips\"></ng-container>\n </ng-container>\n</div>\n\n<ng-template #filterStatusBarChips>\n <ng-container *ngIf=\"statusBar\">\n <div class=\"filter-status-container\" [ngClass]=\"{ 'has-status': !!filterStatus.textContent }\">\n <div class=\"filter-status\" #filterStatus>\n <ng-container *ngTemplateOutlet=\"statusBar.templateRef\"></ng-container>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"config.chips && hasFilterChips$ | async\">\n <fs-filter-chips \n class=\"filter-chips\"\n [filters]=\"items\">\n </fs-filter-chips>\n </ng-container>\n</ng-template>\n\n<ng-template #filterKeyword>\n <div class=\"filter-keyword\">\n <ng-container *ngIf=\"keywordVisible$ | async\">\n <mat-form-field \n [floatLabel]=\"'never'\" \n class=\"form-field-padless\" \n [ngClass]=\"search\"\n appearance=\"outline\">\n <span matPrefix>\n <mat-icon matPrefix>search</mat-icon>\n </span>\n <input\n #keywordMatInput\n matInput\n [(ngModel)]=\"keyword\"\n (ngModelChange)=\"keywordChange($event)\"\n name=\"filter-input\"\n [fsClear]=\"true\"\n [placeholder]=\"searchPlaceholder\">\n </mat-form-field>\n </ng-container>\n </div>\n</ng-template>\n\n<ng-template #filterActions>\n <div class=\"filter-actions\">\n <fs-filter-actions\n *ngIf=\"actionsVisible$ | async\"\n [actions]=\"actions$ | async\"\n [kebabActions]=\"menuActions$ | async\">\n </fs-filter-actions>\n </div>\n</ng-template>\n\n<ng-template #filterToolbar>\n <div class=\"filter-toobar\">\n <ng-container *ngIf=\"filtersBtnVisible$ | async\">\n <ng-container *ngIf=\"hasVisibleItemOrSorting\">\n <a\n mat-button\n class=\"filters-button\"\n [ngClass]=\"{\n 'mat-raised-button': config.button.style === 'raised' && config.button.label,\n 'mat-flat-button': config.button.style === 'flat' && config.button.label,\n 'mat-stroked-button': config.button.style === 'stroked' && config.button.label,\n 'mat-button': config.button.style === 'basic' && config.button.label,\n 'mat-icon-button': config.button.style === 'icon' || !config.button.label \n }\"\n (click)=\"changeVisibilityClick(!showFilterMenu, $event)\"\n [color]=\"config.button.color\">\n <mat-icon *ngIf=\"config.button.icon\">{{config.button.icon}}</mat-icon>\n {{ config.button.label }}\n </a>\n </ng-container>\n </ng-container>\n <a \n mat-icon-button\n (click)=\"reload($event)\"\n class=\"reload\"\n *ngIf=\"config.reload\">\n <mat-icon>refresh</mat-icon>\n </a>\n </div>\n</ng-template>", styles: [".fs-filter{margin-bottom:20px;display:block}.fs-filter.has-keyword .filter-status-container.has-status{margin-top:4px}.fs-filter:not(.has-keyword) .filter-status-container:not(.has-status)+fs-filter-chips{margin-top:0}.fs-filter:not(.has-keyword) .filter-inner-container{display:flex}.fs-filter:not(.has-keyword) .filter-toobar{justify-content:flex-end}.fs-filter .filter-status-container{flex-grow:1;display:flex;justify-content:center;flex-direction:column;align-self:flex-end}.fs-filter .filter-status-container .filter-status{overflow:hidden;text-overflow:ellipsis;line-height:17px}.fs-filter .filter-container{width:100%}.fs-filter .filter-inner-container{flex-direction:row;box-sizing:border-box;display:flex;position:relative;align-items:center}.fs-filter .filter-inner-container .filter-keyword{flex-direction:row;box-sizing:border-box;display:flex;align-items:center;min-width:0}.fs-filter .filter-inner-container .filter-keyword mat-form-field{max-width:100%;min-width:100px;margin-right:6px}.fs-filter .filter-inner-container .filter-keyword mat-form-field .mat-form-field-wrapper{margin-bottom:0}.fs-filter .filter-inner-container .filter-keyword mat-form-field .mat-form-field-prefix .mat-icon{font-size:22px;color:#626262}.fs-filter .filter-inner-container .filter-keyword mat-form-field .mat-form-field-infix{width:250px}.fs-filter .filter-inner-container .filter-keyword mat-form-field .mat-form-field-prefix,.fs-filter .filter-inner-container .filter-keyword mat-form-field .mat-form-field-suffix{top:.45em}.fs-filter .filter-inner-container .filter-keyword .mat-form-field-suffix{display:flex}.fs-filter .filter-inner-container .filter-keyword .mat-form-field-suffix .mat-icon-button{height:24px;width:24px}.fs-filter .filter-actions{display:flex;align-items:center}.fs-filter .filter-toobar{flex:1;white-space:nowrap;display:flex;align-items:center}.fs-filter .filter-toobar .reload{margin-left:-6px}.fs-filter .results{min-height:90px;position:relative;overflow-x:auto;overflow-y:hidden}.fs-filter fs-filter-chips{margin-top:4px;display:block}@media screen and (min-width: 599px){.filter-actions{margin-left:10px}.filters-button+fs-filter-actions:not(:empty){margin-left:5px}}@media screen and (max-width: 600px){.filter-actions{margin-left:5px}.filter-actions .filters-button{font-size:0;padding:0;min-width:unset;width:36px;height:36px;border-radius:50%;box-shadow:unset!important}}@media screen and (min-width: 1200px){body.fs-filter-open{margin-right:350px}.fs-filter-backdrop{display:none}}body.fs-filter-open::-webkit-scrollbar{width:0;background:transparent}\n"], components: [{ type: FsFilterChipsComponent, selector: "fs-filter-chips", inputs: ["filters"] }, { type: i1$3.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i8.FsClearComponent, selector: "[fsClear]", inputs: ["ngModel", "fsClear"], outputs: ["ngModelChange", "cleared"] }, { type: FsFilterActionsComponent, selector: "fs-filter-actions", inputs: ["kebabActions", "actions"] }, { type: i1$4.MatAnchor, selector: "a[mat-button], a[mat-raised-button], a[mat-icon-button], a[mat-fab], a[mat-mini-fab], a[mat-stroked-button], a[mat-flat-button]", inputs: ["disabled", "disableRipple", "color", "tabIndex"], exportAs: ["matButton", "matAnchor"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1$3.MatPrefix, selector: "[matPrefix]" }, { type: i3$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i7.FsFormNoFsValidatorsDirective, selector: "[ngModel]:not([required]):not([fsFormRequired]):not([fsFormCompare]):not([fsFormDateRange]):not([fsFormEmail]):not([fsFormEmails]):not([fsFormFunction]):not([fsFormGreater]):not([fsFormInteger]):not([fsFormLesser]):not([fsFormMax]):not([fsFormMaxLength]):not([fsFormMin]):not([fsFormMinLength]):not([fsFormNumeric]):not([fsFormPattern]):not([fsFormPhone]):not([fsFormUrl]):not([validate])" }, { type: i7.FsButtonDirective, selector: "[mat-raised-button],[mat-button],[mat-flat-button],[mat-stroked-button]", inputs: ["name", "dirtySubmit", "form"] }], pipes: { "async": i3.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
4148
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FilterComponent, decorators: [{
4149
+ type: Component,
4150
+ args: [{ selector: 'fs-filter', encapsulation: ViewEncapsulation.None, providers: [
4151
+ FsFilterOverlayService,
4152
+ ExternalParamsController,
4153
+ PersistanceParamsController,
4154
+ QueryParamsController,
4155
+ FocusControllerService,
4156
+ FsFilterItemsStore,
4157
+ SavedFiltersController,
4158
+ ActionsController,
4159
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"filter-container\">\n <div class=\"filter-inner-container\">\n <ng-container *ngIf=\"!hasKeyword; else filterKeyword\">\n <div>\n <ng-container *ngTemplateOutlet=\"filterStatusBarChips\"></ng-container> \n </div>\n </ng-container>\n \n <ng-container [ngTemplateOutlet]=\"filterToolbar\"></ng-container>\n <ng-container [ngTemplateOutlet]=\"filterActions\"></ng-container>\n </div>\n\n <ng-container *ngIf=\"hasKeyword\">\n <ng-container *ngTemplateOutlet=\"filterStatusBarChips\"></ng-container>\n </ng-container>\n</div>\n\n<ng-template #filterStatusBarChips>\n <ng-container *ngIf=\"statusBar\">\n <div class=\"filter-status-container\" [ngClass]=\"{ 'has-status': !!filterStatus.textContent }\">\n <div class=\"filter-status\" #filterStatus>\n <ng-container *ngTemplateOutlet=\"statusBar.templateRef\"></ng-container>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"config.chips && hasFilterChips$ | async\">\n <fs-filter-chips \n class=\"filter-chips\"\n [filters]=\"items\">\n </fs-filter-chips>\n </ng-container>\n</ng-template>\n\n<ng-template #filterKeyword>\n <div class=\"filter-keyword\">\n <ng-container *ngIf=\"keywordVisible$ | async\">\n <mat-form-field \n [floatLabel]=\"'never'\" \n class=\"form-field-padless\" \n [ngClass]=\"search\"\n appearance=\"outline\">\n <span matPrefix>\n <mat-icon matPrefix>search</mat-icon>\n </span>\n <input\n #keywordMatInput\n matInput\n [(ngModel)]=\"keyword\"\n (ngModelChange)=\"keywordChange($event)\"\n name=\"filter-input\"\n [fsClear]=\"true\"\n [placeholder]=\"searchPlaceholder\">\n </mat-form-field>\n </ng-container>\n </div>\n</ng-template>\n\n<ng-template #filterActions>\n <div class=\"filter-actions\">\n <fs-filter-actions\n *ngIf=\"actionsVisible$ | async\"\n [actions]=\"actions$ | async\"\n [kebabActions]=\"menuActions$ | async\">\n </fs-filter-actions>\n </div>\n</ng-template>\n\n<ng-template #filterToolbar>\n <div class=\"filter-toobar\">\n <ng-container *ngIf=\"filtersBtnVisible$ | async\">\n <ng-container *ngIf=\"hasVisibleItemOrSorting\">\n <a\n mat-button\n class=\"filters-button\"\n [ngClass]=\"{\n 'mat-raised-button': config.button.style === 'raised' && config.button.label,\n 'mat-flat-button': config.button.style === 'flat' && config.button.label,\n 'mat-stroked-button': config.button.style === 'stroked' && config.button.label,\n 'mat-button': config.button.style === 'basic' && config.button.label,\n 'mat-icon-button': config.button.style === 'icon' || !config.button.label \n }\"\n (click)=\"changeVisibilityClick(!showFilterMenu, $event)\"\n [color]=\"config.button.color\">\n <mat-icon *ngIf=\"config.button.icon\">{{config.button.icon}}</mat-icon>\n {{ config.button.label }}\n </a>\n </ng-container>\n </ng-container>\n <a \n mat-icon-button\n (click)=\"reload($event)\"\n class=\"reload\"\n *ngIf=\"config.reload\">\n <mat-icon>refresh</mat-icon>\n </a>\n </div>\n</ng-template>", styles: [".fs-filter{margin-bottom:20px;display:block}.fs-filter.has-keyword .filter-status-container.has-status{margin-top:4px}.fs-filter:not(.has-keyword) .filter-status-container:not(.has-status)+fs-filter-chips{margin-top:0}.fs-filter:not(.has-keyword) .filter-inner-container{display:flex}.fs-filter:not(.has-keyword) .filter-toobar{justify-content:flex-end}.fs-filter .filter-status-container{flex-grow:1;display:flex;justify-content:center;flex-direction:column;align-self:flex-end}.fs-filter .filter-status-container .filter-status{overflow:hidden;text-overflow:ellipsis;line-height:17px}.fs-filter .filter-container{width:100%}.fs-filter .filter-inner-container{flex-direction:row;box-sizing:border-box;display:flex;position:relative;align-items:center}.fs-filter .filter-inner-container .filter-keyword{flex-direction:row;box-sizing:border-box;display:flex;align-items:center;min-width:0}.fs-filter .filter-inner-container .filter-keyword mat-form-field{max-width:100%;min-width:100px;margin-right:6px}.fs-filter .filter-inner-container .filter-keyword mat-form-field .mat-form-field-wrapper{margin-bottom:0}.fs-filter .filter-inner-container .filter-keyword mat-form-field .mat-form-field-prefix .mat-icon{font-size:22px;color:#626262}.fs-filter .filter-inner-container .filter-keyword mat-form-field .mat-form-field-infix{width:250px}.fs-filter .filter-inner-container .filter-keyword mat-form-field .mat-form-field-prefix,.fs-filter .filter-inner-container .filter-keyword mat-form-field .mat-form-field-suffix{top:.45em}.fs-filter .filter-inner-container .filter-keyword .mat-form-field-suffix{display:flex}.fs-filter .filter-inner-container .filter-keyword .mat-form-field-suffix .mat-icon-button{height:24px;width:24px}.fs-filter .filter-actions{display:flex;align-items:center}.fs-filter .filter-toobar{flex:1;white-space:nowrap;display:flex;align-items:center}.fs-filter .filter-toobar .reload{margin-left:-6px}.fs-filter .results{min-height:90px;position:relative;overflow-x:auto;overflow-y:hidden}.fs-filter fs-filter-chips{margin-top:4px;display:block}@media screen and (min-width: 599px){.filter-actions{margin-left:10px}.filters-button+fs-filter-actions:not(:empty){margin-left:5px}}@media screen and (max-width: 600px){.filter-actions{margin-left:5px}.filter-actions .filters-button{font-size:0;padding:0;min-width:unset;width:36px;height:36px;border-radius:50%;box-shadow:unset!important}}@media screen and (min-width: 1200px){body.fs-filter-open{margin-right:350px}.fs-filter-backdrop{display:none}}body.fs-filter-open::-webkit-scrollbar{width:0;background:transparent}\n"] }]
4160
+ }], ctorParameters: function () { return [{ type: FsFilterConfig, decorators: [{
4161
+ type: Optional
4162
+ }, {
4163
+ type: Inject,
4164
+ args: [FS_FILTER_CONFIG]
4165
+ }] }, { type: FsFilterOverlayService }, { type: i0.NgZone }, { type: ExternalParamsController }, { type: FsFilterItemsStore }, { type: ActionsController }]; }, propDecorators: { setConfig: [{
4166
+ type: Input,
4167
+ args: ['config']
4168
+ }], setFilter: [{
4169
+ type: Input,
4170
+ args: ['filter']
4171
+ }], showSortBy: [{
4172
+ type: Input
4173
+ }], showFilterInput: [{
4174
+ type: Input
4175
+ }], closed: [{
4176
+ type: Output
4177
+ }], opened: [{
4178
+ type: Output
4179
+ }], ready: [{
4180
+ type: Output
4181
+ }], statusBar: [{
4182
+ type: ContentChild,
4183
+ args: [FilterStatusBarDirective]
4184
+ }], keywordMatInput: [{
4185
+ type: ViewChild,
4186
+ args: ['keywordMatInput', { read: MatInput }]
4187
+ }], showFilterMenu: [{
4188
+ type: HostBinding,
4189
+ args: ['class.filters-open']
4190
+ }], windowDesktop: [{
4191
+ type: HostBinding,
4192
+ args: ['class.window-desktop']
4193
+ }], fsFilterClass: [{
4194
+ type: HostBinding,
4195
+ args: ['class.fs-filter']
4196
+ }], hasKeyword: [{
4197
+ type: HostBinding,
4198
+ args: ['class.has-keyword']
4199
+ }] } });
4200
+
4201
+ class SelectBackdropComponent {
4202
+ constructor() { }
4203
+ }
4204
+ SelectBackdropComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SelectBackdropComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4205
+ SelectBackdropComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: SelectBackdropComponent, selector: "filter-item-select-backdrop", ngImport: i0, template: "", styles: [":host{position:absolute;z-index:1002;inset:0}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
4206
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SelectBackdropComponent, decorators: [{
4207
+ type: Component,
4208
+ args: [{ selector: 'filter-item-select-backdrop', changeDetection: ChangeDetectionStrategy.OnPush, template: "", styles: [":host{position:absolute;z-index:1002;inset:0}\n"] }]
4209
+ }], ctorParameters: function () { return []; } });
4210
+
4211
+ class FsSavedFiltersMenuComponent {
4212
+ constructor(_itemsStore, _externalParams, _savedFilters) {
4213
+ this._itemsStore = _itemsStore;
4214
+ this._externalParams = _externalParams;
4215
+ this._savedFilters = _savedFilters;
4216
+ this.select = new EventEmitter();
4217
+ this.clear = new EventEmitter();
4218
+ this.manage = new EventEmitter();
4219
+ }
4220
+ get filters$() {
4221
+ return this._savedFilters.savedFilters$;
4222
+ }
4223
+ get activeFilter$() {
4224
+ return this._savedFilters.activeFilter$;
4225
+ }
4226
+ selectFilter(savedFilter) {
4227
+ this._externalParams.setActiveSavedFilter(savedFilter);
4228
+ this.select.emit(savedFilter);
4229
+ }
4230
+ removeActiveFilter() {
4231
+ this._itemsStore.filtersClear();
4232
+ this._externalParams.setActiveSavedFilter(null);
4233
+ this.clear.emit();
4234
+ }
4235
+ manageFilters() {
4236
+ this.manage.emit();
4237
+ }
4238
+ }
4239
+ FsSavedFiltersMenuComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsSavedFiltersMenuComponent, deps: [{ token: FsFilterItemsStore }, { token: ExternalParamsController }, { token: SavedFiltersController }], target: i0.ɵɵFactoryTarget.Component });
4240
+ FsSavedFiltersMenuComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: FsSavedFiltersMenuComponent, selector: "fs-filter-saved-filters-menu", outputs: { select: "select", clear: "clear", manage: "manage" }, ngImport: i0, template: "<a [fsMenuTriggerFor]=\"menu\" class=\"selector\">{{ (activeFilter$ | async)?.name || 'Not selected' }}</a>\n\n<fs-menu #menu>\n <ng-container *ngIf=\"activeFilter$ | async\">\n <ng-template fs-menu-item (click)=\"removeActiveFilter()\">\n None\n </ng-template>\n </ng-container>\n <ng-container *ngFor=\"let filter of filters$ | async\">\n <ng-template fs-menu-item (click)=\"selectFilter(filter)\">\n {{ filter.name }}\n </ng-template>\n </ng-container>\n <ng-template fs-menu-item class=\"saved-filter-last-item\" (click)=\"manageFilters()\">\n Manage\n </ng-template>\n</fs-menu>\n", styles: [":host ::ng-deep .selector{cursor:pointer}\n"], components: [{ type: i3$3.FsMenuComponent, selector: "fs-menu", inputs: ["class", "buttonClass", "buttonType", "buttonColor"], outputs: ["opened", "closed"] }], directives: [{ type: i3$3.FsMenuTriggerDirective, selector: "[fsMenuTriggerFor]", inputs: ["fsMenuTriggerFor"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3$3.FsMenuItemDirective, selector: "fs-menu-group,[fs-menu-item]" }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i3.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
4241
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsSavedFiltersMenuComponent, decorators: [{
4242
+ type: Component,
4243
+ args: [{ selector: 'fs-filter-saved-filters-menu', changeDetection: ChangeDetectionStrategy.OnPush, template: "<a [fsMenuTriggerFor]=\"menu\" class=\"selector\">{{ (activeFilter$ | async)?.name || 'Not selected' }}</a>\n\n<fs-menu #menu>\n <ng-container *ngIf=\"activeFilter$ | async\">\n <ng-template fs-menu-item (click)=\"removeActiveFilter()\">\n None\n </ng-template>\n </ng-container>\n <ng-container *ngFor=\"let filter of filters$ | async\">\n <ng-template fs-menu-item (click)=\"selectFilter(filter)\">\n {{ filter.name }}\n </ng-template>\n </ng-container>\n <ng-template fs-menu-item class=\"saved-filter-last-item\" (click)=\"manageFilters()\">\n Manage\n </ng-template>\n</fs-menu>\n", styles: [":host ::ng-deep .selector{cursor:pointer}\n"] }]
4244
+ }], ctorParameters: function () { return [{ type: FsFilterItemsStore }, { type: ExternalParamsController }, { type: SavedFiltersController }]; }, propDecorators: { select: [{
4245
+ type: Output
4246
+ }], clear: [{
4247
+ type: Output
4248
+ }], manage: [{
4249
+ type: Output
4250
+ }] } });
4251
+
4252
+ class FsFilterModule {
4253
+ static forRoot(config = {}) {
4254
+ return {
4255
+ ngModule: FsFilterModule,
4256
+ providers: [
4257
+ {
4258
+ provide: FS_FILTER_CONFIG,
4259
+ useValue: {
4260
+ button: {
4261
+ label: '',
4262
+ },
4263
+ ...config,
4264
+ },
4265
+ },
4266
+ ],
4267
+ };
4268
+ }
4269
+ }
4270
+ FsFilterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFilterModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4271
+ FsFilterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFilterModule, declarations: [BaseItemComponent,
4272
+ FilterComponent,
4273
+ FilterItemComponent,
4274
+ FsFilterChipsComponent,
4275
+ SelectComponent,
4276
+ SelectGroupsComponent,
4277
+ SelectSimpleComponent,
4278
+ SelectMultipleComponent,
4279
+ ChipsComponent,
4280
+ TextComponent,
4281
+ WeekComponent,
4282
+ RangeComponent,
4283
+ AutocompleteComponent,
4284
+ AutocompletechipsComponent,
4285
+ DateComponent,
4286
+ DateRangeComponent,
4287
+ CheckboxComponent,
4288
+ FilterDrawerComponent,
4289
+ SelectBackdropComponent,
4290
+ FsFilterChipComponent,
4291
+ FsFilterChipContentComponent,
4292
+ FsFilterDrawerActionsComponent,
4293
+ FsFilterSavedFilterEditComponent,
4294
+ FsSavedFiltersMenuComponent,
4295
+ FsFilterActionsComponent,
4296
+ FsFilterActionButtonComponent,
4297
+ FsFilterActionKebabActionsComponent,
4298
+ FilterStatusBarDirective,
4299
+ FocusToItemDirective,
4300
+ // Pipes
4301
+ FsFilterIsolateValues], imports: [CommonModule,
4302
+ RouterModule,
4303
+ FormsModule,
4304
+ ReactiveFormsModule,
4305
+ MatIconModule,
4306
+ MatInputModule,
4307
+ MatSelectModule,
4308
+ MatChipsModule,
4309
+ MatCheckboxModule,
4310
+ MatAutocompleteModule,
4311
+ MatButtonModule,
4312
+ MatDialogModule,
4313
+ FsChipModule,
4314
+ FsCommonModule,
4315
+ FsStoreModule,
4316
+ FsDatePickerModule,
4317
+ FsLabelModule,
4318
+ FsAutocompleteModule,
4319
+ FsAutocompleteChipsModule,
4320
+ FsScrollModule,
4321
+ FsMenuModule,
4322
+ FsSkeletonModule,
4323
+ FsFormModule,
4324
+ FsFileModule,
4325
+ FsClearModule,
4326
+ FsPopoverModule,
4327
+ PortalModule], exports: [FilterComponent,
4328
+ FilterStatusBarDirective,
4329
+ FsSavedFiltersMenuComponent] });
4330
+ FsFilterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFilterModule, providers: [
4331
+ FsStore,
4332
+ ], imports: [[
4333
+ CommonModule,
4334
+ RouterModule,
4335
+ FormsModule,
4336
+ ReactiveFormsModule,
4337
+ MatIconModule,
4338
+ MatInputModule,
4339
+ MatSelectModule,
4340
+ MatChipsModule,
4341
+ MatCheckboxModule,
4342
+ MatAutocompleteModule,
4343
+ MatButtonModule,
4344
+ MatDialogModule,
4345
+ FsChipModule,
4346
+ FsCommonModule,
4347
+ FsStoreModule,
4348
+ FsDatePickerModule,
4349
+ FsLabelModule,
4350
+ FsAutocompleteModule,
4351
+ FsAutocompleteChipsModule,
4352
+ FsScrollModule,
4353
+ FsMenuModule,
4354
+ FsSkeletonModule,
4355
+ FsFormModule,
4356
+ FsFileModule,
4357
+ FsClearModule,
4358
+ FsPopoverModule,
4359
+ PortalModule,
4360
+ ]] });
4361
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFilterModule, decorators: [{
4362
+ type: NgModule,
4363
+ args: [{
4364
+ imports: [
4365
+ CommonModule,
4366
+ RouterModule,
4367
+ FormsModule,
4368
+ ReactiveFormsModule,
4369
+ MatIconModule,
4370
+ MatInputModule,
4371
+ MatSelectModule,
4372
+ MatChipsModule,
4373
+ MatCheckboxModule,
4374
+ MatAutocompleteModule,
4375
+ MatButtonModule,
4376
+ MatDialogModule,
4377
+ FsChipModule,
4378
+ FsCommonModule,
4379
+ FsStoreModule,
4380
+ FsDatePickerModule,
4381
+ FsLabelModule,
4382
+ FsAutocompleteModule,
4383
+ FsAutocompleteChipsModule,
4384
+ FsScrollModule,
4385
+ FsMenuModule,
4386
+ FsSkeletonModule,
4387
+ FsFormModule,
4388
+ FsFileModule,
4389
+ FsClearModule,
4390
+ FsPopoverModule,
4391
+ PortalModule,
4392
+ ],
4393
+ declarations: [
4394
+ BaseItemComponent,
4395
+ FilterComponent,
4396
+ FilterItemComponent,
4397
+ FsFilterChipsComponent,
4398
+ SelectComponent,
4399
+ SelectGroupsComponent,
4400
+ SelectSimpleComponent,
4401
+ SelectMultipleComponent,
4402
+ ChipsComponent,
4403
+ TextComponent,
4404
+ WeekComponent,
4405
+ RangeComponent,
4406
+ AutocompleteComponent,
4407
+ AutocompletechipsComponent,
4408
+ DateComponent,
4409
+ DateRangeComponent,
4410
+ CheckboxComponent,
4411
+ FilterDrawerComponent,
4412
+ SelectBackdropComponent,
4413
+ FsFilterChipComponent,
4414
+ FsFilterChipContentComponent,
4415
+ FsFilterDrawerActionsComponent,
4416
+ FsFilterSavedFilterEditComponent,
4417
+ FsSavedFiltersMenuComponent,
4418
+ FsFilterActionsComponent,
4419
+ FsFilterActionButtonComponent,
4420
+ FsFilterActionKebabActionsComponent,
4421
+ FilterStatusBarDirective,
4422
+ FocusToItemDirective,
4423
+ // Pipes
4424
+ FsFilterIsolateValues,
4425
+ ],
4426
+ providers: [
4427
+ FsStore,
4428
+ ],
4429
+ exports: [
4430
+ FilterComponent,
4431
+ FilterStatusBarDirective,
4432
+ FsSavedFiltersMenuComponent,
4433
+ ],
4434
+ }]
4435
+ }] });
4436
+
4437
+ // Controllers
4438
+
4439
+ /**
4440
+ * Generated bundle index. Do not edit.
4441
+ */
4442
+
4443
+ export { ActionMode, ActionType, AutocompleteChipsItem, AutocompleteItem, BaseItem, ButtonStyle, CheckboxItem, ChipsItem, DateItem, DateRangeItem, DateTimeItem, DateTimeRangeItem, ExternalParamsController, FS_FILTER_CONFIG, FilterComponent, FilterItemComponent, FilterStatusBarDirective, FsFilterModule, FsSavedFiltersMenuComponent, ItemDateMode, ItemType, QUERY_PARAM_DELIMITER, RangeItem, SavedFiltersController, SelectItem, TextItem, buildQueryParams, filterFromQueryParam, filterToQueryParam };
4444
+ //# sourceMappingURL=firestitch-filter.mjs.map