@firestitch/filter 9.10.0 → 12.0.2

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 (240) hide show
  1. package/app/classes/actions-controller.d.ts +3 -0
  2. package/app/components/action-button/action-button.component.d.ts +3 -0
  3. package/app/components/action-kebab-actions/action-kebab-actions.component.d.ts +3 -0
  4. package/app/components/actions/actions.component.d.ts +3 -0
  5. package/app/components/filter/filter.component.d.ts +4 -0
  6. package/app/components/filter-chip/filter-chip.component.d.ts +3 -0
  7. package/app/components/filter-chip-content/filter-chip-content.component.d.ts +3 -0
  8. package/app/components/filter-chips/filter-chips.component.d.ts +3 -0
  9. package/app/components/filter-drawer/filter-drawer.component.d.ts +3 -0
  10. package/app/components/filter-drawer-actions/filter-drawer-actions.component.d.ts +3 -0
  11. package/app/components/filters-item/autocomplete/autocomplete.component.d.ts +3 -0
  12. package/app/components/filters-item/autocompletechips/autocompletechips.component.d.ts +3 -0
  13. package/app/components/filters-item/base-item/base-item.component.d.ts +3 -0
  14. package/app/components/filters-item/checkbox/checkbox.component.d.ts +3 -0
  15. package/app/components/filters-item/chips/chips.component.d.ts +3 -0
  16. package/app/components/filters-item/date/date.component.d.ts +3 -0
  17. package/app/components/filters-item/date-range/date-range.component.d.ts +3 -0
  18. package/app/components/filters-item/filter-item.component.d.ts +3 -0
  19. package/app/components/filters-item/range/range.component.d.ts +3 -0
  20. package/app/components/filters-item/select/backdrop/backdrop.component.d.ts +3 -0
  21. package/app/components/filters-item/select/groups/groups.component.d.ts +3 -0
  22. package/app/components/filters-item/select/multiple/multiple.component.d.ts +3 -0
  23. package/app/components/filters-item/select/select.component.d.ts +3 -0
  24. package/app/components/filters-item/select/simple/simple.component.d.ts +3 -0
  25. package/app/components/filters-item/text/text.component.d.ts +3 -0
  26. package/app/components/saved-filter-edit/saved-filter-edit.component.d.ts +3 -0
  27. package/app/components/saved-filters-menu/saved-filters-menu.component.d.ts +3 -0
  28. package/app/directives/focus-to-item/focus-to-item.directive.d.ts +3 -0
  29. package/app/directives/status-bar/status-bar.directive.d.ts +3 -0
  30. package/app/fs-filter.module.d.ts +59 -0
  31. package/app/pipes/remove-isolate-value.pipe.d.ts +3 -0
  32. package/app/services/external-params/persistance-params-controller.service.d.ts +3 -0
  33. package/app/services/external-params/query-params-controller.service.d.ts +3 -0
  34. package/app/services/external-params/saved-filters-controller.service.d.ts +3 -0
  35. package/app/services/external-params-controller.service.d.ts +4 -0
  36. package/app/services/filter-overlay.service.d.ts +7 -1
  37. package/app/services/focus-controller.service.d.ts +4 -3
  38. package/app/services/items-store.service.d.ts +3 -0
  39. package/bundles/firestitch-filter.umd.js +2436 -2328
  40. package/bundles/firestitch-filter.umd.js.map +1 -1
  41. package/esm2015/app/classes/actions-controller.js +10 -12
  42. package/esm2015/app/components/action-button/action-button.component.js +23 -19
  43. package/esm2015/app/components/action-kebab-actions/action-kebab-actions.component.js +22 -17
  44. package/esm2015/app/components/actions/actions.component.js +27 -21
  45. package/esm2015/app/components/filter/filter.component.js +89 -91
  46. package/esm2015/app/components/filter-chip/filter-chip.component.js +22 -24
  47. package/esm2015/app/components/filter-chip-content/filter-chip-content.component.js +20 -26
  48. package/esm2015/app/components/filter-chips/filter-chips.component.js +21 -17
  49. package/esm2015/app/components/filter-drawer/filter-drawer.component.js +35 -37
  50. package/esm2015/app/components/filter-drawer-actions/filter-drawer-actions.component.js +22 -23
  51. package/esm2015/app/components/filters-item/autocomplete/autocomplete.component.js +17 -18
  52. package/esm2015/app/components/filters-item/autocompletechips/autocompletechips.component.js +17 -18
  53. package/esm2015/app/components/filters-item/base-item/base-item.component.js +19 -28
  54. package/esm2015/app/components/filters-item/checkbox/checkbox.component.js +18 -19
  55. package/esm2015/app/components/filters-item/chips/chips.component.js +19 -19
  56. package/esm2015/app/components/filters-item/date/date.component.js +21 -19
  57. package/esm2015/app/components/filters-item/date-range/date-range.component.js +20 -19
  58. package/esm2015/app/components/filters-item/filter-item.component.js +27 -21
  59. package/esm2015/app/components/filters-item/range/range.component.js +29 -28
  60. package/esm2015/app/components/filters-item/select/backdrop/backdrop.component.js +15 -14
  61. package/esm2015/app/components/filters-item/select/groups/groups.component.js +27 -25
  62. package/esm2015/app/components/filters-item/select/multiple/multiple.component.js +30 -26
  63. package/esm2015/app/components/filters-item/select/select.component.js +24 -23
  64. package/esm2015/app/components/filters-item/select/simple/simple.component.js +29 -25
  65. package/esm2015/app/components/filters-item/text/text.component.js +21 -20
  66. package/esm2015/app/components/saved-filter-edit/saved-filter-edit.component.js +25 -17
  67. package/esm2015/app/components/saved-filters-menu/saved-filters-menu.component.js +28 -33
  68. package/esm2015/app/consts/query-param-delimiter.js +1 -1
  69. package/esm2015/app/directives/focus-to-item/focus-to-item.directive.js +53 -47
  70. package/esm2015/app/directives/status-bar/status-bar.directive.js +12 -10
  71. package/esm2015/app/enums/action-mode.enum.js +1 -1
  72. package/esm2015/app/enums/action-type.enum.js +1 -1
  73. package/esm2015/app/enums/item-date-mode.enum.js +1 -1
  74. package/esm2015/app/enums/item-type.enum.js +1 -1
  75. package/esm2015/app/fs-filter.module.js +145 -56
  76. package/esm2015/app/helpers/build-query-params.js +1 -1
  77. package/esm2015/app/helpers/compare.js +1 -1
  78. package/esm2015/app/helpers/create-filter-item.js +1 -1
  79. package/esm2015/app/helpers/find-value.js +1 -1
  80. package/esm2015/app/helpers/get-range-name.js +1 -1
  81. package/esm2015/app/helpers/parse-item-value-from-stored.js +1 -1
  82. package/esm2015/app/helpers/query-param-transformers.js +1 -1
  83. package/esm2015/app/helpers/restore-items.js +1 -1
  84. package/esm2015/app/helpers/try-convert-to-number.js +1 -1
  85. package/esm2015/app/injectors/filter-config.js +1 -1
  86. package/esm2015/app/injectors/filter-drawer-data.js +1 -1
  87. package/esm2015/app/injectors/filter-drawer-overlay.js +1 -1
  88. package/esm2015/app/interfaces/action.interface.js +2 -1
  89. package/esm2015/app/interfaces/config.interface.js +2 -1
  90. package/esm2015/app/interfaces/external-params.interface.js +2 -1
  91. package/esm2015/app/interfaces/filter.interface.js +2 -1
  92. package/esm2015/app/interfaces/items/autocomplete-chips.interface.js +2 -1
  93. package/esm2015/app/interfaces/items/autocomplete.interface.js +2 -1
  94. package/esm2015/app/interfaces/items/base.interface.js +2 -1
  95. package/esm2015/app/interfaces/items/checkbox.interface.js +2 -1
  96. package/esm2015/app/interfaces/items/chips.interface.js +2 -1
  97. package/esm2015/app/interfaces/items/date-range.interface.js +2 -1
  98. package/esm2015/app/interfaces/items/date.interface.js +2 -1
  99. package/esm2015/app/interfaces/items/range.interface.js +2 -1
  100. package/esm2015/app/interfaces/items/select.interface.js +2 -1
  101. package/esm2015/app/interfaces/items/text.interface.js +2 -1
  102. package/esm2015/app/interfaces/saved-filters.interface.js +2 -1
  103. package/esm2015/app/interfaces/update-filter-item.interface.js +2 -1
  104. package/esm2015/app/models/action-menu-item.model.js +1 -1
  105. package/esm2015/app/models/action.model.js +1 -1
  106. package/esm2015/app/models/filter-config.js +1 -1
  107. package/esm2015/app/models/items/autocomplete/base-autocomplete-item.js +1 -1
  108. package/esm2015/app/models/items/autocomplete-chips-item.js +1 -1
  109. package/esm2015/app/models/items/autocomplete-item.js +1 -1
  110. package/esm2015/app/models/items/base-item.js +1 -1
  111. package/esm2015/app/models/items/checkbox-item.js +1 -1
  112. package/esm2015/app/models/items/chips-item.js +1 -1
  113. package/esm2015/app/models/items/date/base-date-item.js +1 -1
  114. package/esm2015/app/models/items/date-item.js +1 -1
  115. package/esm2015/app/models/items/date-range/base-date-range-item.js +1 -1
  116. package/esm2015/app/models/items/date-range-item.js +1 -1
  117. package/esm2015/app/models/items/date-time-item.js +1 -1
  118. package/esm2015/app/models/items/date-time-range-item.js +1 -1
  119. package/esm2015/app/models/items/range-item.js +1 -1
  120. package/esm2015/app/models/items/select/base-select-item.js +1 -1
  121. package/esm2015/app/models/items/select/multiple-select-item.js +1 -1
  122. package/esm2015/app/models/items/select/simple-select-item.js +1 -1
  123. package/esm2015/app/models/items/select-item.js +1 -1
  124. package/esm2015/app/models/items/text-item.js +1 -1
  125. package/esm2015/app/pipes/remove-isolate-value.pipe.js +12 -10
  126. package/esm2015/app/providers/filter-meta.js +1 -1
  127. package/esm2015/app/services/external-params/persistance-params-controller.service.js +19 -24
  128. package/esm2015/app/services/external-params/query-params-controller.service.js +11 -16
  129. package/esm2015/app/services/external-params/saved-filters-controller.service.js +11 -14
  130. package/esm2015/app/services/external-params-controller.service.js +18 -20
  131. package/esm2015/app/services/filter-overlay.service.js +30 -19
  132. package/esm2015/app/services/focus-controller.service.js +10 -18
  133. package/esm2015/app/services/items-store.service.js +9 -9
  134. package/esm2015/firestitch-filter.js +1 -40
  135. package/esm2015/public_api.js +2 -1
  136. package/fesm2015/firestitch-filter.js +1993 -1986
  137. package/fesm2015/firestitch-filter.js.map +1 -1
  138. package/firestitch-filter.d.ts +1 -39
  139. package/package.json +18 -21
  140. package/public_api.d.ts +1 -0
  141. package/bundles/firestitch-filter.umd.min.js +0 -16
  142. package/bundles/firestitch-filter.umd.min.js.map +0 -1
  143. package/esm5/app/classes/actions-controller.js +0 -151
  144. package/esm5/app/components/action-button/action-button.component.js +0 -24
  145. package/esm5/app/components/action-kebab-actions/action-kebab-actions.component.js +0 -21
  146. package/esm5/app/components/actions/actions.component.js +0 -27
  147. package/esm5/app/components/filter/filter.component.js +0 -701
  148. package/esm5/app/components/filter-chip/filter-chip.component.js +0 -99
  149. package/esm5/app/components/filter-chip-content/filter-chip-content.component.js +0 -92
  150. package/esm5/app/components/filter-chips/filter-chips.component.js +0 -22
  151. package/esm5/app/components/filter-drawer/filter-drawer.component.js +0 -91
  152. package/esm5/app/components/filter-drawer-actions/filter-drawer-actions.component.js +0 -49
  153. package/esm5/app/components/filters-item/autocomplete/autocomplete.component.js +0 -34
  154. package/esm5/app/components/filters-item/autocompletechips/autocompletechips.component.js +0 -56
  155. package/esm5/app/components/filters-item/base-item/base-item.component.js +0 -74
  156. package/esm5/app/components/filters-item/checkbox/checkbox.component.js +0 -29
  157. package/esm5/app/components/filters-item/chips/chips.component.js +0 -35
  158. package/esm5/app/components/filters-item/date/date.component.js +0 -46
  159. package/esm5/app/components/filters-item/date-range/date-range.component.js +0 -38
  160. package/esm5/app/components/filters-item/filter-item.component.js +0 -43
  161. package/esm5/app/components/filters-item/range/range.component.js +0 -54
  162. package/esm5/app/components/filters-item/select/backdrop/backdrop.component.js +0 -18
  163. package/esm5/app/components/filters-item/select/groups/groups.component.js +0 -33
  164. package/esm5/app/components/filters-item/select/multiple/multiple.component.js +0 -58
  165. package/esm5/app/components/filters-item/select/select.component.js +0 -46
  166. package/esm5/app/components/filters-item/select/simple/simple.component.js +0 -45
  167. package/esm5/app/components/filters-item/text/text.component.js +0 -58
  168. package/esm5/app/components/saved-filter-edit/saved-filter-edit.component.js +0 -49
  169. package/esm5/app/components/saved-filters-menu/saved-filters-menu.component.js +0 -72
  170. package/esm5/app/consts/query-param-delimiter.js +0 -2
  171. package/esm5/app/directives/focus-to-item/focus-to-item.directive.js +0 -126
  172. package/esm5/app/directives/status-bar/status-bar.directive.js +0 -14
  173. package/esm5/app/enums/action-mode.enum.js +0 -7
  174. package/esm5/app/enums/action-type.enum.js +0 -9
  175. package/esm5/app/enums/item-date-mode.enum.js +0 -7
  176. package/esm5/app/enums/item-type.enum.js +0 -16
  177. package/esm5/app/fs-filter.module.js +0 -152
  178. package/esm5/app/helpers/build-query-params.js +0 -32
  179. package/esm5/app/helpers/compare.js +0 -50
  180. package/esm5/app/helpers/create-filter-item.js +0 -51
  181. package/esm5/app/helpers/find-value.js +0 -13
  182. package/esm5/app/helpers/get-range-name.js +0 -9
  183. package/esm5/app/helpers/parse-item-value-from-stored.js +0 -77
  184. package/esm5/app/helpers/query-param-transformers.js +0 -9
  185. package/esm5/app/helpers/restore-items.js +0 -43
  186. package/esm5/app/helpers/try-convert-to-number.js +0 -6
  187. package/esm5/app/injectors/filter-config.js +0 -3
  188. package/esm5/app/injectors/filter-drawer-data.js +0 -3
  189. package/esm5/app/injectors/filter-drawer-overlay.js +0 -3
  190. package/esm5/app/interfaces/action.interface.js +0 -1
  191. package/esm5/app/interfaces/config.interface.js +0 -1
  192. package/esm5/app/interfaces/external-params.interface.js +0 -1
  193. package/esm5/app/interfaces/filter.interface.js +0 -1
  194. package/esm5/app/interfaces/items/autocomplete-chips.interface.js +0 -1
  195. package/esm5/app/interfaces/items/autocomplete.interface.js +0 -1
  196. package/esm5/app/interfaces/items/base.interface.js +0 -1
  197. package/esm5/app/interfaces/items/checkbox.interface.js +0 -1
  198. package/esm5/app/interfaces/items/chips.interface.js +0 -1
  199. package/esm5/app/interfaces/items/date-range.interface.js +0 -1
  200. package/esm5/app/interfaces/items/date.interface.js +0 -1
  201. package/esm5/app/interfaces/items/range.interface.js +0 -1
  202. package/esm5/app/interfaces/items/select.interface.js +0 -1
  203. package/esm5/app/interfaces/items/text.interface.js +0 -1
  204. package/esm5/app/interfaces/saved-filters.interface.js +0 -1
  205. package/esm5/app/interfaces/update-filter-item.interface.js +0 -1
  206. package/esm5/app/models/action-menu-item.model.js +0 -91
  207. package/esm5/app/models/action.model.js +0 -122
  208. package/esm5/app/models/filter-config.js +0 -139
  209. package/esm5/app/models/items/autocomplete/base-autocomplete-item.js +0 -25
  210. package/esm5/app/models/items/autocomplete-chips-item.js +0 -82
  211. package/esm5/app/models/items/autocomplete-item.js +0 -48
  212. package/esm5/app/models/items/base-item.js +0 -353
  213. package/esm5/app/models/items/checkbox-item.js +0 -73
  214. package/esm5/app/models/items/chips-item.js +0 -114
  215. package/esm5/app/models/items/date/base-date-item.js +0 -68
  216. package/esm5/app/models/items/date-item.js +0 -28
  217. package/esm5/app/models/items/date-range/base-date-range-item.js +0 -173
  218. package/esm5/app/models/items/date-range-item.js +0 -14
  219. package/esm5/app/models/items/date-time-item.js +0 -18
  220. package/esm5/app/models/items/date-time-range-item.js +0 -14
  221. package/esm5/app/models/items/range-item.js +0 -110
  222. package/esm5/app/models/items/select/base-select-item.js +0 -43
  223. package/esm5/app/models/items/select/multiple-select-item.js +0 -82
  224. package/esm5/app/models/items/select/simple-select-item.js +0 -79
  225. package/esm5/app/models/items/select-item.js +0 -17
  226. package/esm5/app/models/items/text-item.js +0 -46
  227. package/esm5/app/pipes/remove-isolate-value.pipe.js +0 -24
  228. package/esm5/app/providers/filter-meta.js +0 -10
  229. package/esm5/app/services/external-params/persistance-params-controller.service.js +0 -65
  230. package/esm5/app/services/external-params/query-params-controller.service.js +0 -66
  231. package/esm5/app/services/external-params/saved-filters-controller.service.js +0 -199
  232. package/esm5/app/services/external-params-controller.service.js +0 -193
  233. package/esm5/app/services/filter-overlay.service.js +0 -111
  234. package/esm5/app/services/focus-controller.service.js +0 -47
  235. package/esm5/app/services/items-store.service.js +0 -342
  236. package/esm5/firestitch-filter.js +0 -44
  237. package/esm5/public_api.js +0 -35
  238. package/fesm5/firestitch-filter.js +0 -5119
  239. package/fesm5/firestitch-filter.js.map +0 -1
  240. package/firestitch-filter.metadata.json +0 -1
@@ -1,39 +1,65 @@
1
- import { __decorate, __metadata, __param } from 'tslib';
2
- import { Injectable, Optional, Inject, Component, ChangeDetectionStrategy, InjectionToken, ChangeDetectorRef, HostListener, Input, Injector, Directive, EventEmitter, NgZone, Output, ContentChild, TemplateRef, ViewChild, ElementRef, HostBinding, ViewEncapsulation, KeyValueDiffers, Pipe, Self, NgModule } from '@angular/core';
3
- import { ActivatedRoute, Router, RouterModule } from '@angular/router';
4
- import { BehaviorSubject, Subject, isObservable, forkJoin, of, fromEvent, combineLatest, merge, timer } from 'rxjs';
5
- import { tap, finalize, take, takeUntil, debounceTime, filter as filter$1, distinctUntilChanged, switchMap, skip, map, mapTo, startWith, delay } from 'rxjs/operators';
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, Optional, Component, ChangeDetectionStrategy, Inject, InjectionToken, Input, Directive, Self, Pipe, ViewChild, EventEmitter, Output, HostListener, TemplateRef, ViewEncapsulation, ContentChild, HostBinding, NgModule } from '@angular/core';
3
+ import * as i1$1 from '@angular/router';
4
+ import { RouterModule } from '@angular/router';
5
+ import { BehaviorSubject, Subject, isObservable, forkJoin, of, fromEvent, merge, timer, combineLatest } from 'rxjs';
6
+ import { tap, finalize, take, takeUntil, debounceTime, filter as filter$1, distinctUntilChanged, switchMap, delay, skip, mapTo, startWith, map } from 'rxjs/operators';
6
7
  import { isFunction, clone, isObject, isString, toString, pickBy } from 'lodash-es';
8
+ import { __decorate, __metadata } from 'tslib';
7
9
  import { Model, Alias } from 'tsmodels';
8
10
  import { filter, isEmpty, getNormalizedPath, list, remove, FsCommonModule } from '@firestitch/common';
9
11
  import { simpleFormat, format } from '@firestitch/date';
10
12
  import { parseISO, isValid, isDate, isEqual } from 'date-fns';
11
- import { Location, CommonModule } from '@angular/common';
12
- import { MatDialogRef, MAT_DIALOG_DATA, MatDialog, MatDialogModule } from '@angular/material/dialog';
13
- import { DrawerRef } from '@firestitch/drawer';
14
- import { FsPersistanceStore, FsStore, FsStoreModule } from '@firestitch/store';
13
+ import * as i3 from '@angular/common';
14
+ import { CommonModule } from '@angular/common';
15
+ import * as i1$2 from '@angular/material/dialog';
16
+ import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
17
+ import * as i6 from '@firestitch/drawer';
18
+ import * as i1 from '@firestitch/store';
19
+ import { FsPersistanceStore, FsStoreModule, FsStore } from '@firestitch/store';
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 i5 from '@angular/forms';
15
27
  import { FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
28
+ import * as i7 from '@firestitch/form';
29
+ import { FsFormModule } from '@firestitch/form';
30
+ import * as i4 from '@angular/material/input';
31
+ import { MatInput, MatInputModule } from '@angular/material/input';
16
32
  import { MatAutocompleteModule } from '@angular/material/autocomplete';
17
- import { MatButtonModule } from '@angular/material/button';
33
+ import * as i4$2 from '@angular/material/checkbox';
18
34
  import { MatCheckboxModule } from '@angular/material/checkbox';
19
35
  import { MatChipsModule } from '@angular/material/chips';
36
+ import * as i2$3 from '@angular/material/icon';
20
37
  import { MatIconModule } from '@angular/material/icon';
21
- import { MatInput, MatInputModule } from '@angular/material/input';
22
- import { MatSelect, MatSelectModule } from '@angular/material/select';
23
38
  import { ComponentPortal, PortalInjector, PortalModule } from '@angular/cdk/portal';
24
39
  import { FlexLayoutModule } from '@angular/flex-layout';
25
- import { FsDatePickerComponent, FsDateScrollPickerComponent, DateRangePickerFromComponent, DateRangePickerToComponent, FsDatePickerModule } from '@firestitch/datepicker';
40
+ import * as i3$2 from '@firestitch/datepicker';
41
+ import { FsDatePickerModule } from '@firestitch/datepicker';
42
+ import * as i2$1 from '@firestitch/chip';
26
43
  import { FsChipModule } from '@firestitch/chip';
44
+ import * as i1$5 from '@firestitch/label';
27
45
  import { FsLabelModule } from '@firestitch/label';
28
46
  import { FsScrollModule } from '@firestitch/scroll';
29
- import { FsAutocompleteComponent, FsAutocompleteModule } from '@firestitch/autocomplete';
30
- import { FsAutocompleteChipsComponent, FsAutocompleteChipsModule } from '@firestitch/autocomplete-chips';
47
+ import * as i4$1 from '@firestitch/autocomplete';
48
+ import { FsAutocompleteModule } from '@firestitch/autocomplete';
49
+ import * as i5$1 from '@firestitch/autocomplete-chips';
50
+ import { FsAutocompleteChipsModule } from '@firestitch/autocomplete-chips';
51
+ import * as i6$2 from '@firestitch/mask';
31
52
  import { FsMaskModule } from '@firestitch/mask';
53
+ import * as i3$3 from '@firestitch/menu';
32
54
  import { FsMenuModule } from '@firestitch/menu';
55
+ import * as i6$3 from '@firestitch/skeleton';
33
56
  import { FsSkeletonModule } from '@firestitch/skeleton';
34
- import { FsFormModule } from '@firestitch/form';
35
- import { OverlayRef, OverlayConfig, Overlay } from '@angular/cdk/overlay';
36
- import { BreakpointObserver } from '@angular/cdk/layout';
57
+ import * as i1$6 from '@angular/cdk/overlay';
58
+ import { OverlayConfig } from '@angular/cdk/overlay';
59
+ import * as i6$1 from '@angular/flex-layout/extended';
60
+ import * as i2$2 from '@angular/flex-layout/flex';
61
+ import * as i1$7 from '@angular/cdk/layout';
62
+ import * as i4$3 from '@firestitch/file';
37
63
  import { FsFileModule } from '@firestitch/file';
38
64
 
39
65
  var ItemType;
@@ -1207,7 +1233,7 @@ function createFilterItem(item, config) {
1207
1233
  }
1208
1234
  }
1209
1235
 
1210
- let FsFilterItemsStore = class FsFilterItemsStore {
1236
+ class FsFilterItemsStore {
1211
1237
  constructor() {
1212
1238
  this.sortByItem = null;
1213
1239
  this.sortDirectionItem = null;
@@ -1500,11 +1526,12 @@ let FsFilterItemsStore = class FsFilterItemsStore {
1500
1526
  .items
1501
1527
  .find((item) => item.isTypeKeyword);
1502
1528
  }
1503
- };
1504
- FsFilterItemsStore = __decorate([
1505
- Injectable(),
1506
- __metadata("design:paramtypes", [])
1507
- ], FsFilterItemsStore);
1529
+ }
1530
+ FsFilterItemsStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFilterItemsStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1531
+ FsFilterItemsStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFilterItemsStore });
1532
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFilterItemsStore, decorators: [{
1533
+ type: Injectable
1534
+ }], ctorParameters: function () { return []; } });
1508
1535
 
1509
1536
  const QUERY_PARAM_DELIMITER = ':';
1510
1537
 
@@ -1633,7 +1660,7 @@ function findItemWidthName(items, name) {
1633
1660
  }
1634
1661
 
1635
1662
  const FILTER_STORE_KEY = 'fs-filter-persist';
1636
- let PersistanceParamsController = class PersistanceParamsController extends FsPersistanceStore {
1663
+ class PersistanceParamsController extends FsPersistanceStore {
1637
1664
  constructor(_store, _route, _location, _itemsStore, _dialogRef, _drawerRef) {
1638
1665
  super(_store, _route);
1639
1666
  this._location = _location;
@@ -1657,28 +1684,18 @@ let PersistanceParamsController = class PersistanceParamsController extends FsPe
1657
1684
  this._value.data = restoreItems(this._value.data, this._itemsStore.items, this._paramsCase);
1658
1685
  }
1659
1686
  }
1660
- };
1661
- PersistanceParamsController.ctorParameters = () => [
1662
- { type: FsStore },
1663
- { type: ActivatedRoute },
1664
- { type: Location },
1665
- { type: FsFilterItemsStore },
1666
- { type: MatDialogRef, decorators: [{ type: Optional }] },
1667
- { type: DrawerRef, decorators: [{ type: Optional }] }
1668
- ];
1669
- PersistanceParamsController = __decorate([
1670
- Injectable(),
1671
- __param(4, Optional()),
1672
- __param(5, Optional()),
1673
- __metadata("design:paramtypes", [FsStore,
1674
- ActivatedRoute,
1675
- Location,
1676
- FsFilterItemsStore,
1677
- MatDialogRef,
1678
- DrawerRef])
1679
- ], PersistanceParamsController);
1687
+ }
1688
+ PersistanceParamsController.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", 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 });
1689
+ PersistanceParamsController.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PersistanceParamsController });
1690
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PersistanceParamsController, decorators: [{
1691
+ type: Injectable
1692
+ }], ctorParameters: function () { return [{ type: i1.FsStore }, { type: i1$1.ActivatedRoute }, { type: i3.Location }, { type: FsFilterItemsStore }, { type: i1$2.MatDialogRef, decorators: [{
1693
+ type: Optional
1694
+ }] }, { type: i6.DrawerRef, decorators: [{
1695
+ type: Optional
1696
+ }] }]; } });
1680
1697
 
1681
- let QueryParamsController = class QueryParamsController {
1698
+ class QueryParamsController {
1682
1699
  constructor(_router, _route, _itemsStore) {
1683
1700
  this._router = _router;
1684
1701
  this._route = _route;
@@ -1716,20 +1733,14 @@ let QueryParamsController = class QueryParamsController {
1716
1733
  fetchFromQueryParams() {
1717
1734
  this._fetchedParams = restoreItems(this._route.snapshot.queryParams, this._itemsStore.items, this._paramsCase);
1718
1735
  }
1719
- };
1720
- QueryParamsController.ctorParameters = () => [
1721
- { type: Router },
1722
- { type: ActivatedRoute },
1723
- { type: FsFilterItemsStore }
1724
- ];
1725
- QueryParamsController = __decorate([
1726
- Injectable(),
1727
- __metadata("design:paramtypes", [Router,
1728
- ActivatedRoute,
1729
- FsFilterItemsStore])
1730
- ], QueryParamsController);
1736
+ }
1737
+ QueryParamsController.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: QueryParamsController, deps: [{ token: i1$1.Router }, { token: i1$1.ActivatedRoute }, { token: FsFilterItemsStore }], target: i0.ɵɵFactoryTarget.Injectable });
1738
+ QueryParamsController.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: QueryParamsController });
1739
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: QueryParamsController, decorators: [{
1740
+ type: Injectable
1741
+ }], ctorParameters: function () { return [{ type: i1$1.Router }, { type: i1$1.ActivatedRoute }, { type: FsFilterItemsStore }]; } });
1731
1742
 
1732
- let FsFilterSavedFilterEditComponent = class FsFilterSavedFilterEditComponent {
1743
+ class FsFilterSavedFilterEditComponent {
1733
1744
  constructor(data, _dialogRef) {
1734
1745
  this.data = data;
1735
1746
  this._dialogRef = _dialogRef;
@@ -1756,19 +1767,19 @@ let FsFilterSavedFilterEditComponent = class FsFilterSavedFilterEditComponent {
1756
1767
  this.savedFilters = this.data.savedFilters;
1757
1768
  this._saveCallback = this.data.saveCallback;
1758
1769
  }
1759
- };
1760
- FsFilterSavedFilterEditComponent.ctorParameters = () => [
1761
- { type: undefined, decorators: [{ type: Inject, args: [MAT_DIALOG_DATA,] }] },
1762
- { type: MatDialogRef }
1763
- ];
1764
- FsFilterSavedFilterEditComponent = __decorate([
1765
- Component({
1766
- 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",
1767
- changeDetection: ChangeDetectionStrategy.OnPush
1768
- }),
1769
- __param(0, Inject(MAT_DIALOG_DATA)),
1770
- __metadata("design:paramtypes", [Object, MatDialogRef])
1771
- ], FsFilterSavedFilterEditComponent);
1770
+ }
1771
+ FsFilterSavedFilterEditComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFilterSavedFilterEditComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1$2.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
1772
+ FsFilterSavedFilterEditComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], 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: i5.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i5.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i5.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"], outputs: ["fsForm", "invalid", "valid", "submitted", "reseted", "cleared"] }, { 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: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i5.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: i5.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.FsSubmitButtonDirective, selector: "button[type=\"submit\"]", inputs: ["name", "dirtySubmit"] }, { type: i1$2.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["type", "mat-dialog-close", "aria-label", "matDialogClose"], exportAs: ["matDialogClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1773
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFilterSavedFilterEditComponent, decorators: [{
1774
+ type: Component,
1775
+ args: [{
1776
+ templateUrl: './saved-filter-edit.component.html',
1777
+ changeDetection: ChangeDetectionStrategy.OnPush,
1778
+ }]
1779
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1780
+ type: Inject,
1781
+ args: [MAT_DIALOG_DATA]
1782
+ }] }, { type: i1$2.MatDialogRef }]; } });
1772
1783
 
1773
1784
  function buildQueryParams(flattenedParams, items) {
1774
1785
  items.forEach(filterItem => {
@@ -1797,7 +1808,7 @@ function buildQueryParams(flattenedParams, items) {
1797
1808
  return flattenedParams;
1798
1809
  }
1799
1810
 
1800
- let SavedFiltersController = class SavedFiltersController {
1811
+ class SavedFiltersController {
1801
1812
  constructor(_itemsStore, _dialog) {
1802
1813
  this._itemsStore = _itemsStore;
1803
1814
  this._dialog = _dialog;
@@ -1944,18 +1955,14 @@ let SavedFiltersController = class SavedFiltersController {
1944
1955
  _setEnabledStatus(value) {
1945
1956
  this._enabled$.next(value);
1946
1957
  }
1947
- };
1948
- SavedFiltersController.ctorParameters = () => [
1949
- { type: FsFilterItemsStore },
1950
- { type: MatDialog }
1951
- ];
1952
- SavedFiltersController = __decorate([
1953
- Injectable(),
1954
- __metadata("design:paramtypes", [FsFilterItemsStore,
1955
- MatDialog])
1956
- ], SavedFiltersController);
1958
+ }
1959
+ SavedFiltersController.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SavedFiltersController, deps: [{ token: FsFilterItemsStore }, { token: i1$2.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
1960
+ SavedFiltersController.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SavedFiltersController });
1961
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SavedFiltersController, decorators: [{
1962
+ type: Injectable
1963
+ }], ctorParameters: function () { return [{ type: FsFilterItemsStore }, { type: i1$2.MatDialog }]; } });
1957
1964
 
1958
- let ExternalParamsController = class ExternalParamsController {
1965
+ class ExternalParamsController {
1959
1966
  constructor(_itemsStore, _persistanceStore, _queryParams, _savedFilters, _route) {
1960
1967
  this._itemsStore = _itemsStore;
1961
1968
  this._persistanceStore = _persistanceStore;
@@ -2039,6 +2046,10 @@ let ExternalParamsController = class ExternalParamsController {
2039
2046
  this._saveQueryParams();
2040
2047
  this._savePersistedParams();
2041
2048
  }
2049
+ fetchQueryParams() {
2050
+ this._initQueryParams();
2051
+ this._itemsStore.updateItemsWithValues(this.params);
2052
+ }
2042
2053
  _initPersistance() {
2043
2054
  this._persistanceStore.init(this._config.persist, this._config.namespace, this._config.case);
2044
2055
  }
@@ -2095,22 +2106,12 @@ let ExternalParamsController = class ExternalParamsController {
2095
2106
  }), targetItems);
2096
2107
  this._persistanceStore.save(params);
2097
2108
  }
2098
- };
2099
- ExternalParamsController.ctorParameters = () => [
2100
- { type: FsFilterItemsStore },
2101
- { type: PersistanceParamsController },
2102
- { type: QueryParamsController },
2103
- { type: SavedFiltersController },
2104
- { type: ActivatedRoute }
2105
- ];
2106
- ExternalParamsController = __decorate([
2107
- Injectable(),
2108
- __metadata("design:paramtypes", [FsFilterItemsStore,
2109
- PersistanceParamsController,
2110
- QueryParamsController,
2111
- SavedFiltersController,
2112
- ActivatedRoute])
2113
- ], ExternalParamsController);
2109
+ }
2110
+ ExternalParamsController.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ExternalParamsController, deps: [{ token: FsFilterItemsStore }, { token: PersistanceParamsController }, { token: QueryParamsController }, { token: SavedFiltersController }, { token: i1$1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Injectable });
2111
+ ExternalParamsController.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ExternalParamsController });
2112
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ExternalParamsController, decorators: [{
2113
+ type: Injectable
2114
+ }], ctorParameters: function () { return [{ type: FsFilterItemsStore }, { type: PersistanceParamsController }, { type: QueryParamsController }, { type: SavedFiltersController }, { type: i1$1.ActivatedRoute }]; } });
2114
2115
 
2115
2116
  const FS_FILTER_CONFIG = new InjectionToken('fs.filter-config');
2116
2117
 
@@ -2155,199 +2156,69 @@ const FILTER_DRAWER_DATA = new InjectionToken('fs.filter-drawer-data');
2155
2156
 
2156
2157
  const FILTER_DRAWER_OVERLAY = new InjectionToken('fs.filter-drawer-overlay');
2157
2158
 
2158
- let FilterDrawerComponent = class FilterDrawerComponent {
2159
- constructor(externalParams, _cd, _itemsStore, overlayRef, data) {
2160
- this.externalParams = externalParams;
2159
+ class BaseItemComponent {
2160
+ constructor(_kvDiffers, _cd) {
2161
+ this._kvDiffers = _kvDiffers;
2161
2162
  this._cd = _cd;
2162
- this._itemsStore = _itemsStore;
2163
- this.overlayRef = overlayRef;
2164
- this.data = data;
2165
2163
  this.inline = false;
2166
- this.windowDesktop = false;
2167
- this._itemsStore.prepareItems();
2168
- this._clear = data.clear;
2169
- this._done = data.done;
2170
- this.updateWindowWidth();
2171
- }
2172
- updateWindowWidth() {
2173
- this.windowDesktop = window.innerWidth > 1200;
2174
- }
2175
- get items$() {
2176
- return this._itemsStore.visibleItems$;
2177
- }
2178
- get sortItem() {
2179
- return this._itemsStore.sortByItem;
2180
- }
2181
- get sortDirectionItem() {
2182
- return this._itemsStore.sortDirectionItem;
2183
- }
2184
- clear() {
2185
- this._clear();
2186
- // this.overlayRef.detach();
2187
- }
2188
- done() {
2189
- this._done();
2190
- this.overlayRef.detach();
2191
- }
2192
- backdropClick() {
2193
- this.done();
2194
- }
2195
- };
2196
- FilterDrawerComponent.ctorParameters = () => [
2197
- { type: ExternalParamsController },
2198
- { type: ChangeDetectorRef },
2199
- { type: FsFilterItemsStore },
2200
- { type: OverlayRef, decorators: [{ type: Inject, args: [FILTER_DRAWER_OVERLAY,] }] },
2201
- { type: undefined, decorators: [{ type: Inject, args: [FILTER_DRAWER_DATA,] }] }
2202
- ];
2203
- __decorate([
2204
- HostListener('window:resize'),
2205
- __metadata("design:type", Function),
2206
- __metadata("design:paramtypes", []),
2207
- __metadata("design:returntype", void 0)
2208
- ], FilterDrawerComponent.prototype, "updateWindowWidth", null);
2209
- __decorate([
2210
- Input(),
2211
- __metadata("design:type", Object)
2212
- ], FilterDrawerComponent.prototype, "inline", void 0);
2213
- FilterDrawerComponent = __decorate([
2214
- Component({
2215
- 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 *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 class=\"filter-group sort\"\n [item]=\"sortItem\">\n </filter-item>\n <filter-item 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 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",
2216
- // Commented out because filter items are not updating with a delayed observable. Need to figure this out.
2217
- changeDetection: ChangeDetectionStrategy.OnPush,
2218
- 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 rgba(0,0,0,.2),0 4px 5px 0 rgba(0,0,0,.14),0 1px 10px 0 rgba(0,0,0,.12);width:85vw;max-width:350px;display:flex;flex-direction:column;height:100%}.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:rgba(0,0,0,.54)}.filters .filter .interface.interface-range,.filters .filter .interface.interface-range .mat-input-wrapper,.filters .filter .interface.interface-range input{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;top:0;bottom:0;left:0;right:0;z-index:900;outline:0}"]
2219
- }),
2220
- __param(3, Inject(FILTER_DRAWER_OVERLAY)),
2221
- __param(4, Inject(FILTER_DRAWER_DATA)),
2222
- __metadata("design:paramtypes", [ExternalParamsController,
2223
- ChangeDetectorRef,
2224
- FsFilterItemsStore,
2225
- OverlayRef, Object])
2226
- ], FilterDrawerComponent);
2227
-
2228
- const FS_FILTER_META = new InjectionToken('fs.filter.meta', {
2229
- providedIn: 'root',
2230
- factory: () => {
2231
- return {
2232
- openedFilters: 0,
2233
- };
2234
- }
2235
- });
2236
-
2237
- let FsFilterOverlayService = class FsFilterOverlayService {
2238
- constructor(_injector, _filterMeta, _overlay) {
2239
- this._injector = _injector;
2240
- this._filterMeta = _filterMeta;
2241
- this._overlay = _overlay;
2242
- this.detach$ = new Subject();
2243
- this.attach$ = new Subject();
2244
2164
  this._destroy$ = new Subject();
2165
+ this._debouncer$ = new Subject();
2166
+ this._kvDiffer = this._kvDiffers.find(this.item || {}).create();
2167
+ this.listenWithDebounce();
2245
2168
  }
2246
- get isOpened() {
2247
- return !!this._overlayRef;
2248
- }
2249
- setClearFn(fn) {
2250
- this._clearFn = fn;
2169
+ set item(value) {
2170
+ this._item = value;
2251
2171
  }
2252
- setDoneFn(fn) {
2253
- this._doneFn = fn;
2172
+ ;
2173
+ get item() {
2174
+ return this._item;
2254
2175
  }
2255
- close() {
2256
- if (this._overlayRef) {
2257
- this._overlayRef.detach();
2258
- this._overlayRef = null;
2259
- this.removeFilterClass();
2176
+ ngDoCheck() {
2177
+ if (this._kvDiffer) {
2178
+ const changes = this._kvDiffer.diff(this.item);
2179
+ if (changes) {
2180
+ this._cd.detectChanges();
2181
+ }
2260
2182
  }
2261
2183
  }
2262
- open() {
2263
- this._overlayRef = this._createOverlay();
2264
- this._overlayRef.backdropClick()
2265
- .pipe(takeUntil(this._destroy$))
2266
- .subscribe(() => {
2267
- this._overlayRef.detach();
2268
- });
2269
- this._overlayRef.detachments()
2270
- .pipe(takeUntil(this._destroy$))
2271
- .subscribe(() => {
2272
- this.detach$.next();
2273
- });
2274
- this._overlayRef.attachments()
2275
- .pipe(takeUntil(this._destroy$))
2276
- .subscribe(() => {
2277
- this.attach$.next();
2278
- });
2279
- this.addFilterClass();
2280
- return this.openPortalPreview();
2281
- }
2282
2184
  ngOnDestroy() {
2283
2185
  this._destroy$.next();
2284
2186
  this._destroy$.complete();
2285
2187
  }
2286
- _createOverlay() {
2287
- const overlayConfig = new OverlayConfig({
2288
- hasBackdrop: true,
2289
- backdropClass: 'fs-filter-backdrop'
2188
+ listenWithDebounce() {
2189
+ this._debouncer$
2190
+ .pipe(debounceTime(150), takeUntil(this._destroy$))
2191
+ .subscribe(() => {
2192
+ this.item.valueChanged();
2290
2193
  });
2291
- return this._overlay.create(overlayConfig);
2292
- }
2293
- openPortalPreview() {
2294
- const data = { done: this._doneFn, clear: this._clearFn };
2295
- const injector = this._createInjector(this._injector, data, this._overlayRef);
2296
- const containerPortal = new ComponentPortal(FilterDrawerComponent, undefined, injector);
2297
- const containerRef = this._overlayRef.attach(containerPortal);
2298
- return containerRef.instance;
2299
- }
2300
- _createInjector(parentInjector, data, overlayRef) {
2301
- const injectionTokens = new WeakMap([
2302
- [FILTER_DRAWER_DATA, data],
2303
- [FILTER_DRAWER_OVERLAY, overlayRef],
2304
- ]);
2305
- return new PortalInjector(parentInjector, injectionTokens);
2306
- }
2307
- removeFilterClass() {
2308
- this._filterMeta.openedFilters--;
2309
- if (this._filterMeta.openedFilters === 0) {
2310
- window.document.body.classList.remove('fs-filter-open');
2311
- }
2312
2194
  }
2313
- addFilterClass() {
2314
- this._filterMeta.openedFilters++;
2315
- if (this._filterMeta.openedFilters === 1) {
2316
- window.document.body.classList.add('fs-filter-open');
2317
- }
2195
+ itemChange() {
2196
+ this._debouncer$.next();
2318
2197
  }
2319
- };
2320
- FsFilterOverlayService.ctorParameters = () => [
2321
- { type: Injector },
2322
- { type: undefined, decorators: [{ type: Inject, args: [FS_FILTER_META,] }] },
2323
- { type: Overlay }
2324
- ];
2325
- FsFilterOverlayService = __decorate([
2326
- Injectable(),
2327
- __param(1, Inject(FS_FILTER_META)),
2328
- __metadata("design:paramtypes", [Injector, Object, Overlay])
2329
- ], FsFilterOverlayService);
2330
-
2331
- let FilterStatusBarDirective = class FilterStatusBarDirective {
2332
- };
2333
- FilterStatusBarDirective = __decorate([
2334
- Directive({
2335
- selector: '[fsFilterStatusBar]',
2336
- })
2337
- ], FilterStatusBarDirective);
2198
+ }
2199
+ BaseItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BaseItemComponent, deps: [{ token: i0.KeyValueDiffers }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2200
+ BaseItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: BaseItemComponent, selector: "base-item", inputs: { item: "item", inline: "inline" }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
2201
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BaseItemComponent, decorators: [{
2202
+ type: Component,
2203
+ args: [{
2204
+ selector: 'base-item',
2205
+ template: '',
2206
+ changeDetection: ChangeDetectionStrategy.OnPush,
2207
+ }]
2208
+ }], ctorParameters: function () { return [{ type: i0.KeyValueDiffers }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { item: [{
2209
+ type: Input
2210
+ }], inline: [{
2211
+ type: Input
2212
+ }] } });
2338
2213
 
2339
- let FocusControllerService = class FocusControllerService {
2340
- constructor(_filterOverlay) {
2341
- this._filterOverlay = _filterOverlay;
2214
+ class FocusControllerService {
2215
+ constructor() {
2342
2216
  this._focusOn = new BehaviorSubject(null);
2343
2217
  }
2344
2218
  get focusOn$() {
2345
2219
  return this._focusOn.asObservable();
2346
2220
  }
2347
2221
  click(item, type = null) {
2348
- if (!this._filterOverlay.isOpened) {
2349
- this._filterOverlay.open();
2350
- }
2351
2222
  this._focusOn.next({ item, type });
2352
2223
  }
2353
2224
  listenFocusFor$(targetItem, targetType = null) {
@@ -2359,1821 +2230,1931 @@ let FocusControllerService = class FocusControllerService {
2359
2230
  clearFocus() {
2360
2231
  this._focusOn.next(null);
2361
2232
  }
2362
- };
2363
- FocusControllerService.ctorParameters = () => [
2364
- { type: FsFilterOverlayService }
2365
- ];
2366
- FocusControllerService = __decorate([
2367
- Injectable(),
2368
- __metadata("design:paramtypes", [FsFilterOverlayService])
2369
- ], FocusControllerService);
2370
-
2371
- var ActionType;
2372
- (function (ActionType) {
2373
- ActionType["Basic"] = "basic";
2374
- ActionType["Raised"] = "raised";
2375
- ActionType["Icon"] = "icon";
2376
- ActionType["Fab"] = "fab";
2377
- ActionType["MiniFab"] = "mini-fab";
2378
- })(ActionType || (ActionType = {}));
2379
-
2380
- var ActionMode;
2381
- (function (ActionMode) {
2382
- ActionMode["Button"] = "button";
2383
- ActionMode["Menu"] = "menu";
2384
- ActionMode["File"] = "file";
2385
- })(ActionMode || (ActionMode = {}));
2233
+ }
2234
+ FocusControllerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FocusControllerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2235
+ FocusControllerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FocusControllerService });
2236
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FocusControllerService, decorators: [{
2237
+ type: Injectable
2238
+ }], ctorParameters: function () { return []; } });
2386
2239
 
2387
- class ActionMenuItem {
2388
- constructor(config = {}, _parent) {
2389
- this._parent = _parent;
2390
- this.items = [];
2391
- this._isGroup = false;
2392
- this._visible$ = new BehaviorSubject(true);
2393
- this._disabled$ = new BehaviorSubject(false);
2394
- this._init(config);
2240
+ class FocusToItemDirective {
2241
+ constructor(_el, _focusController, _targetSelect, _targetDate, _targetDateScroll, _targetDateRangeFrom, _targetDateRangeTo, _targetAutocomplete, _targetAutocompleteChips) {
2242
+ this._el = _el;
2243
+ this._focusController = _focusController;
2244
+ this._targetSelect = _targetSelect;
2245
+ this._targetDate = _targetDate;
2246
+ this._targetDateScroll = _targetDateScroll;
2247
+ this._targetDateRangeFrom = _targetDateRangeFrom;
2248
+ this._targetDateRangeTo = _targetDateRangeTo;
2249
+ this._targetAutocomplete = _targetAutocomplete;
2250
+ this._targetAutocompleteChips = _targetAutocompleteChips;
2251
+ this._destroy$ = new Subject();
2395
2252
  }
2396
- get isGroup() {
2397
- return this._isGroup;
2253
+ ngOnInit() {
2254
+ this._focusController
2255
+ .listenFocusFor$(this._item, this._focusTargetType)
2256
+ .pipe(delay(500), takeUntil(this._destroy$))
2257
+ .subscribe(() => {
2258
+ this._focus();
2259
+ });
2398
2260
  }
2399
- get visible() {
2400
- return this._visible$.getValue();
2261
+ ngOnDestroy() {
2262
+ this._destroy$.next();
2263
+ this._destroy$.complete();
2401
2264
  }
2402
- get visible$() {
2403
- return this._visible$.asObservable();
2265
+ _focus() {
2266
+ switch (this._item.type) {
2267
+ case ItemType.Select:
2268
+ {
2269
+ this._targetSelect.open();
2270
+ }
2271
+ break;
2272
+ case ItemType.Text:
2273
+ case ItemType.Range:
2274
+ {
2275
+ this._el.nativeElement.focus();
2276
+ }
2277
+ break;
2278
+ case ItemType.Date:
2279
+ {
2280
+ if (this._item.mode === ItemDateMode.Calendar) {
2281
+ this._targetDate.open();
2282
+ }
2283
+ else {
2284
+ this._targetDateScroll.open();
2285
+ }
2286
+ }
2287
+ break;
2288
+ case ItemType.DateRange:
2289
+ {
2290
+ if (this._focusTargetType === 'from') {
2291
+ this._targetDateRangeFrom.open();
2292
+ }
2293
+ else {
2294
+ this._targetDateRangeTo.open();
2295
+ }
2296
+ }
2297
+ break;
2298
+ case ItemType.AutoComplete:
2299
+ {
2300
+ this._targetAutocomplete.focus();
2301
+ }
2302
+ break;
2303
+ case ItemType.AutoCompleteChips:
2304
+ {
2305
+ this._targetAutocompleteChips.focus();
2306
+ }
2307
+ break;
2308
+ }
2404
2309
  }
2405
- set disabled(value) {
2406
- this._disabled$.next(value);
2310
+ }
2311
+ FocusToItemDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FocusToItemDirective, deps: [{ token: i0.ElementRef }, { token: FocusControllerService }, { token: i2.MatSelect, optional: true, self: true }, { token: i3$2.FsDatePickerComponent, optional: true, self: true }, { token: i3$2.FsDateScrollPickerComponent, optional: true, self: true }, { token: i3$2.DateRangePickerFromComponent, optional: true, self: true }, { token: i3$2.DateRangePickerToComponent, optional: true, self: true }, { token: i4$1.FsAutocompleteComponent, optional: true, self: true }, { token: i5$1.FsAutocompleteChipsComponent, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Directive });
2312
+ FocusToItemDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FocusToItemDirective, selector: "[fsFilterFocusTrigger]", inputs: { _item: ["fsFilterFocusTrigger", "_item"], _focusTargetType: ["focusTargetType", "_focusTargetType"] }, ngImport: i0 });
2313
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FocusToItemDirective, decorators: [{
2314
+ type: Directive,
2315
+ args: [{
2316
+ selector: '[fsFilterFocusTrigger]',
2317
+ }]
2318
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: FocusControllerService }, { type: i2.MatSelect, decorators: [{
2319
+ type: Optional
2320
+ }, {
2321
+ type: Self
2322
+ }] }, { type: i3$2.FsDatePickerComponent, decorators: [{
2323
+ type: Optional
2324
+ }, {
2325
+ type: Self
2326
+ }] }, { type: i3$2.FsDateScrollPickerComponent, decorators: [{
2327
+ type: Optional
2328
+ }, {
2329
+ type: Self
2330
+ }] }, { type: i3$2.DateRangePickerFromComponent, decorators: [{
2331
+ type: Optional
2332
+ }, {
2333
+ type: Self
2334
+ }] }, { type: i3$2.DateRangePickerToComponent, decorators: [{
2335
+ type: Optional
2336
+ }, {
2337
+ type: Self
2338
+ }] }, { type: i4$1.FsAutocompleteComponent, decorators: [{
2339
+ type: Optional
2340
+ }, {
2341
+ type: Self
2342
+ }] }, { type: i5$1.FsAutocompleteChipsComponent, decorators: [{
2343
+ type: Optional
2344
+ }, {
2345
+ type: Self
2346
+ }] }]; }, propDecorators: { _item: [{
2347
+ type: Input,
2348
+ args: ['fsFilterFocusTrigger']
2349
+ }], _focusTargetType: [{
2350
+ type: Input,
2351
+ args: ['focusTargetType']
2352
+ }] } });
2353
+
2354
+ class TextComponent extends BaseItemComponent {
2355
+ constructor(_kvDiffers, _cd) {
2356
+ super(_kvDiffers, _cd);
2357
+ this._kvDiffers = _kvDiffers;
2358
+ this._cd = _cd;
2359
+ this.textControl = new FormControl();
2360
+ this.destroy$ = new Subject();
2407
2361
  }
2408
- get disabled() {
2409
- return this._disabled$.getValue();
2362
+ ngOnInit() {
2363
+ this._listenControlValueChanges();
2364
+ this._listenModelChanges();
2410
2365
  }
2411
- get disabled$() {
2412
- return this._disabled$.asObservable();
2366
+ ngOnDestroy() {
2367
+ this.destroy$.next();
2368
+ this.destroy$.complete();
2413
2369
  }
2414
- updateVisibility() {
2415
- const visible = !!this._showFn ? this._showFn() : true;
2416
- if (!visible || !this.isGroup) {
2417
- this._visible$.next(visible);
2418
- return;
2419
- }
2420
- const numberOfVisibleChildren = this.items
2421
- .reduce((acc, item) => {
2422
- item.updateVisibility();
2423
- if (item.visible) {
2424
- acc++;
2425
- }
2426
- return acc;
2427
- }, 0);
2428
- this._visible$.next(!!numberOfVisibleChildren);
2370
+ _listenControlValueChanges() {
2371
+ this.textControl.valueChanges
2372
+ .pipe(distinctUntilChanged(), debounceTime(200), takeUntil(this.destroy$))
2373
+ .subscribe((value) => {
2374
+ this.item.model = value;
2375
+ });
2429
2376
  }
2430
- _init(config) {
2431
- this.label = config.label;
2432
- this.icon = config.icon;
2433
- this._showFn = config.show;
2434
- if ('items' in config) {
2435
- this._isGroup = true;
2436
- if (Array.isArray(config.items)) {
2437
- this.items = config
2438
- .items
2439
- .map((item) => new ActionMenuItem(item, this));
2440
- }
2441
- this.updateVisibility();
2377
+ _listenModelChanges() {
2378
+ this._item.value$
2379
+ .pipe(takeUntil(this.destroy$))
2380
+ .subscribe(() => {
2381
+ this.textControl.setValue(this.item.model, { emitEvent: false });
2382
+ });
2383
+ }
2384
+ }
2385
+ TextComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TextComponent, deps: [{ token: i0.KeyValueDiffers }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2386
+ TextComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], 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: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i5.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: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5.FormControlDirective, selector: "[formControl]", inputs: ["disabled", "formControl", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: FocusToItemDirective, selector: "[fsFilterFocusTrigger]", inputs: ["fsFilterFocusTrigger", "focusTargetType"] }, { type: i1$3.MatSuffix, selector: "[matSuffix]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2387
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TextComponent, decorators: [{
2388
+ type: Component,
2389
+ args: [{
2390
+ selector: 'filter-item-text',
2391
+ templateUrl: './text.component.html',
2392
+ styleUrls: ['./text.component.scss'],
2393
+ changeDetection: ChangeDetectionStrategy.OnPush,
2394
+ }]
2395
+ }], ctorParameters: function () { return [{ type: i0.KeyValueDiffers }, { type: i0.ChangeDetectorRef }]; } });
2396
+
2397
+ class FsFilterIsolateValues {
2398
+ transform(values, isolate) {
2399
+ if (!isolate) {
2400
+ return values;
2442
2401
  }
2443
2402
  else {
2444
- this.click = config.click;
2445
- this.routerLink = config.link;
2446
- if (!this._parent) {
2447
- this.updateVisibility();
2448
- }
2403
+ return values.filter((value) => {
2404
+ return value.value !== isolate.value;
2405
+ });
2449
2406
  }
2450
2407
  }
2451
2408
  }
2409
+ FsFilterIsolateValues.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFilterIsolateValues, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
2410
+ FsFilterIsolateValues.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFilterIsolateValues, name: "fsFilterIsolateValues" });
2411
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFilterIsolateValues, decorators: [{
2412
+ type: Pipe,
2413
+ args: [{
2414
+ name: 'fsFilterIsolateValues'
2415
+ }]
2416
+ }] });
2452
2417
 
2453
- class Action {
2454
- constructor(config = {}) {
2455
- this.primary = true;
2456
- this.isReorderAction = false;
2457
- this.classArray = [];
2458
- this.items = [];
2459
- this._visible$ = new BehaviorSubject(true);
2460
- this._disabled$ = new BehaviorSubject(false);
2461
- this._init(config);
2462
- }
2463
- get visible() {
2464
- return this._visible$.getValue();
2465
- }
2466
- get visible$() {
2467
- return this._visible$.asObservable();
2468
- }
2469
- set disabled(value) {
2470
- this._disabled$.next(value);
2418
+ class SelectMultipleComponent {
2419
+ constructor(cd) {
2420
+ this.cd = cd;
2471
2421
  }
2472
- get disabled() {
2473
- return this._disabled$.getValue();
2422
+ changed() {
2423
+ if (this.item.isolate) {
2424
+ this.item.isolate.enabled = false;
2425
+ if (this.item.multiple && Array.isArray(this.item.model)) {
2426
+ const index = this.item.model.indexOf(this.item.isolate.value);
2427
+ if (index > -1) {
2428
+ this.item.model.splice(index, 1);
2429
+ }
2430
+ }
2431
+ }
2474
2432
  }
2475
- get disabled$() {
2476
- return this._disabled$.asObservable();
2433
+ close() {
2434
+ this.select.close();
2477
2435
  }
2478
- updateVisibility() {
2479
- const visible = !!this._showFn ? this._showFn() : true;
2480
- if (!visible || this.mode !== ActionMode.Menu) {
2481
- this._visible$.next(visible);
2482
- return;
2436
+ isolateChange(filter) {
2437
+ if (filter.isolate.enabled) {
2438
+ filter.model = filter.multiple ? [filter.isolate.value] : filter.isolate.value;
2483
2439
  }
2484
- const hasVisibleChildren = this.items.some((item) => item.visible);
2485
- this._visible$.next(hasVisibleChildren);
2486
- }
2487
- updateDisabledState() {
2488
- if (this._disabledFn) {
2489
- this.disabled = this._disabledFn();
2440
+ else {
2441
+ if (filter.multiple) {
2442
+ filter.model = filter.defaultValue ? filter.defaultValue : [];
2443
+ }
2444
+ else {
2445
+ filter.model = filter.defaultValue ? filter.defaultValue : null;
2446
+ }
2490
2447
  }
2491
2448
  }
2492
- _init(config) {
2493
- var _a, _b, _c, _d, _e, _f;
2494
- config.mode = (_a = config.mode) !== null && _a !== void 0 ? _a : ActionMode.Button;
2495
- this.primary = (_b = config.primary) !== null && _b !== void 0 ? _b : true;
2496
- this.color = config.color;
2497
- this.type = (_c = config.type) !== null && _c !== void 0 ? _c : ActionType.Raised;
2498
- this.label = config.label;
2499
- this.mode = config.mode;
2500
- this.icon = config.icon;
2501
- this.iconPlacement = config.iconPlacement;
2502
- this._showFn = config.show;
2503
- this.tabIndex = (_d = config.tabIndex) !== null && _d !== void 0 ? _d : 0;
2504
- if (config.multiple !== undefined) {
2505
- this.multiple = config.multiple;
2506
- }
2507
- if (config.className) {
2508
- this.className = config.className;
2509
- this.classArray = this.className
2510
- .split(' ');
2449
+ }
2450
+ SelectMultipleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SelectMultipleComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2451
+ SelectMultipleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], 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$2.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "id", "labelPosition", "name", "required", "checked", "disabled", "indeterminate", "aria-describedby", "value"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }], directives: [{ type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6$1.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { type: i1$3.MatLabel, selector: "mat-label" }, { type: FocusToItemDirective, selector: "[fsFilterFocusTrigger]", inputs: ["fsFilterFocusTrigger", "focusTargetType"] }, { type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { 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 });
2452
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SelectMultipleComponent, decorators: [{
2453
+ type: Component,
2454
+ args: [{
2455
+ selector: 'filter-item-select-multiple',
2456
+ templateUrl: './multiple.component.html',
2457
+ styleUrls: ['./multiple.component.scss'],
2458
+ changeDetection: ChangeDetectionStrategy.OnPush,
2459
+ }]
2460
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { item: [{
2461
+ type: Input
2462
+ }], select: [{
2463
+ type: ViewChild,
2464
+ args: ['select', { static: true }]
2465
+ }] } });
2466
+
2467
+ class SelectSimpleComponent {
2468
+ constructor(cd) {
2469
+ this.cd = cd;
2470
+ }
2471
+ changed() {
2472
+ if (this.item.isolate) {
2473
+ this.item.isolate.enabled = false;
2511
2474
  }
2512
- if (this.primary) {
2513
- this.color = 'primary';
2475
+ }
2476
+ isolateChange(filter) {
2477
+ if (filter.isolate.enabled) {
2478
+ filter.model = filter.isolate.value;
2514
2479
  }
2515
- switch (config.mode) {
2516
- case ActionMode.Button:
2517
- {
2518
- this.menu = config.menu;
2519
- this.customize = config.customize;
2520
- this.click = (_e = config.click) !== null && _e !== void 0 ? _e : (() => { });
2521
- this._disabledFn = config.disabled;
2522
- this.updateDisabledState();
2523
- }
2524
- break;
2525
- case ActionMode.Menu:
2526
- {
2527
- if (config.items && Array.isArray(config.items)) {
2528
- this.items = config.items.map((item) => new ActionMenuItem(item));
2529
- }
2530
- }
2531
- break;
2532
- case ActionMode.File:
2533
- {
2534
- this.fileSelected = config.select;
2535
- this.fileError = config.error;
2536
- this.accept = config.accept;
2537
- this.imageQuality = config.imageQuality;
2538
- this.minWidth = config.minWidth;
2539
- this.minHeight = config.minHeight;
2540
- this.maxWidth = config.maxWidth;
2541
- this.maxHeight = config.maxHeight;
2542
- this.click = (_f = config.click) !== null && _f !== void 0 ? _f : (() => { });
2543
- this._disabledFn = config.disabled;
2544
- this.updateDisabledState();
2545
- }
2546
- break;
2480
+ else {
2481
+ filter.model = null;
2547
2482
  }
2548
- this.updateVisibility();
2549
2483
  }
2550
2484
  }
2485
+ SelectSimpleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SelectSimpleComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2486
+ SelectSimpleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], 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$2.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "id", "labelPosition", "name", "required", "checked", "disabled", "indeterminate", "aria-describedby", "value"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }], directives: [{ type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6$1.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { type: i1$3.MatLabel, selector: "mat-label" }, { type: FocusToItemDirective, selector: "[fsFilterFocusTrigger]", inputs: ["fsFilterFocusTrigger", "focusTargetType"] }, { type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { 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 });
2487
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SelectSimpleComponent, decorators: [{
2488
+ type: Component,
2489
+ args: [{
2490
+ selector: 'filter-item-select-simple',
2491
+ templateUrl: './simple.component.html',
2492
+ styleUrls: ['./simple.component.scss'],
2493
+ changeDetection: ChangeDetectionStrategy.OnPush,
2494
+ }]
2495
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { item: [{
2496
+ type: Input
2497
+ }], select: [{
2498
+ type: ViewChild,
2499
+ args: ['select', { static: true }]
2500
+ }] } });
2551
2501
 
2552
- let ActionsController = class ActionsController {
2553
- constructor(_breakpointObserver) {
2554
- this._breakpointObserver = _breakpointObserver;
2555
- this._visible$ = new BehaviorSubject(false);
2556
- this._actions$ = new BehaviorSubject([]);
2557
- this._menuActions$ = new BehaviorSubject([]);
2558
- this._destroy$ = new Subject();
2559
- this._mobileMedia = '(max-width: 799px)';
2560
- this._allActions = [];
2561
- this._listenMobileMedia();
2562
- }
2563
- get menuActions() {
2564
- return this._menuActions$.value;
2502
+ class SelectGroupsComponent {
2503
+ constructor(cd) {
2504
+ this.cd = cd;
2565
2505
  }
2566
- get actions() {
2567
- return this._actions$.value;
2506
+ compare(o1, o2) {
2507
+ return o1 == o2;
2568
2508
  }
2569
- get actions$() {
2570
- return this._actions$.asObservable();
2509
+ }
2510
+ SelectGroupsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SelectGroupsComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2511
+ SelectGroupsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], 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: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { 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"] }, { type: i6$1.DefaultStyleDirective, selector: " [ngStyle], [ngStyle.xs], [ngStyle.sm], [ngStyle.md], [ngStyle.lg], [ngStyle.xl], [ngStyle.lt-sm], [ngStyle.lt-md], [ngStyle.lt-lg], [ngStyle.lt-xl], [ngStyle.gt-xs], [ngStyle.gt-sm], [ngStyle.gt-md], [ngStyle.gt-lg]", inputs: ["ngStyle", "ngStyle.xs", "ngStyle.sm", "ngStyle.md", "ngStyle.lg", "ngStyle.xl", "ngStyle.lt-sm", "ngStyle.lt-md", "ngStyle.lt-lg", "ngStyle.lt-xl", "ngStyle.gt-xs", "ngStyle.gt-sm", "ngStyle.gt-md", "ngStyle.gt-lg"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2512
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SelectGroupsComponent, decorators: [{
2513
+ type: Component,
2514
+ args: [{
2515
+ selector: 'filter-item-select-groups',
2516
+ templateUrl: './groups.component.html',
2517
+ changeDetection: ChangeDetectionStrategy.OnPush,
2518
+ }]
2519
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { select: [{
2520
+ type: ViewChild,
2521
+ args: ['select', { static: true }]
2522
+ }], item: [{
2523
+ type: Input
2524
+ }] } });
2525
+
2526
+ class SelectComponent extends BaseItemComponent {
2527
+ constructor(_kvDiffers, _cd) {
2528
+ super(_kvDiffers, _cd);
2529
+ this._kvDiffers = _kvDiffers;
2530
+ this._cd = _cd;
2531
+ // For case when we have multiple selection with __all option
2532
+ // If _all has been selected than we must disable all other items
2533
+ this.allItemsOptionSelected = false;
2571
2534
  }
2572
- get menuActions$() {
2573
- return this._menuActions$.asObservable();
2535
+ ngDoCheck() {
2536
+ if (this._kvDiffer) {
2537
+ const changes = this._kvDiffer.diff(this.item);
2538
+ if (changes) {
2539
+ this._cd.markForCheck();
2540
+ if (this.selectedItem) {
2541
+ this.selectedItem.cd.markForCheck();
2542
+ }
2543
+ }
2544
+ }
2574
2545
  }
2575
- get visible$() {
2576
- return this._visible$.asObservable();
2546
+ }
2547
+ SelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SelectComponent, deps: [{ token: i0.KeyValueDiffers }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2548
+ SelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SelectComponent, selector: "filter-item-select", viewQueries: [{ propertyName: "selectedItem", first: true, predicate: ["selectItem"], descendants: true }], usesInheritance: 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=\"(item.values$ | async)?.length\">\n <ng-container *ngIf=\"item.multiple && !item.children\">\n <filter-item-select-multiple\n [item]=\"item\"\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]=\"item\"\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", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], 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 });
2549
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SelectComponent, decorators: [{
2550
+ type: Component,
2551
+ args: [{
2552
+ selector: 'filter-item-select',
2553
+ templateUrl: './select.component.html',
2554
+ changeDetection: ChangeDetectionStrategy.OnPush,
2555
+ }]
2556
+ }], ctorParameters: function () { return [{ type: i0.KeyValueDiffers }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { selectedItem: [{
2557
+ type: ViewChild,
2558
+ args: ['selectItem']
2559
+ }] } });
2560
+
2561
+ class ChipsComponent extends BaseItemComponent {
2562
+ constructor(_kvDiffers, _cd) {
2563
+ super(_kvDiffers, _cd);
2564
+ this._kvDiffers = _kvDiffers;
2565
+ this._cd = _cd;
2577
2566
  }
2578
- get mobileMode() {
2579
- return this._breakpointObserver.isMatched(this._mobileMedia);
2567
+ modelChange() {
2568
+ this.itemChange();
2580
2569
  }
2581
- ngOnDestroy() {
2582
- this._destroy$.next();
2583
- this._destroy$.complete();
2570
+ compareFn(modelValue, chipValue) {
2571
+ return modelValue.value === chipValue.value;
2584
2572
  }
2585
- initActions(rawActions) {
2586
- if (!rawActions || !Array.isArray(rawActions)) {
2587
- return;
2588
- }
2589
- this.show();
2590
- this._allActions = rawActions
2591
- .map((action) => new Action(action));
2592
- if (this._reorderAction) {
2593
- this._allActions.unshift(this._reorderAction);
2594
- }
2595
- this._classifyActions();
2573
+ }
2574
+ ChipsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ChipsComponent, deps: [{ token: i0.KeyValueDiffers }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2575
+ ChipsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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$1.FsChipsComponent, selector: "fs-chips", inputs: ["compare", "multiple"] }, { type: i2$1.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: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2576
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ChipsComponent, decorators: [{
2577
+ type: Component,
2578
+ args: [{
2579
+ selector: 'filter-item-chips',
2580
+ templateUrl: './chips.component.html',
2581
+ styleUrls: ['./chips.component.scss'],
2582
+ changeDetection: ChangeDetectionStrategy.OnPush,
2583
+ }]
2584
+ }], ctorParameters: function () { return [{ type: i0.KeyValueDiffers }, { type: i0.ChangeDetectorRef }]; } });
2585
+
2586
+ class RangeComponent extends BaseItemComponent {
2587
+ constructor(_kvDiffers, _cd) {
2588
+ super(_kvDiffers, _cd);
2589
+ this._kvDiffers = _kvDiffers;
2590
+ this._cd = _cd;
2596
2591
  }
2597
- show() {
2598
- this._visible$.next(true);
2592
+ ngOnInit() {
2593
+ this.listenChanges();
2599
2594
  }
2600
- hide() {
2601
- this._visible$.next(false);
2595
+ listenChanges() {
2596
+ const fromListener = fromEvent(this.from.nativeElement, 'keyup')
2597
+ .pipe(distinctUntilChanged());
2598
+ const toListener = fromEvent(this.to.nativeElement, 'keyup')
2599
+ .pipe(distinctUntilChanged());
2600
+ merge(fromListener, toListener)
2601
+ .pipe(takeUntil(this._destroy$))
2602
+ .subscribe(() => {
2603
+ this.itemChange();
2604
+ });
2602
2605
  }
2603
- addReorderAction(action) {
2604
- this._allActions.unshift(action);
2605
- action.isReorderAction = true;
2606
- this._classifyAction(action);
2607
- this._reorderAction = action;
2606
+ }
2607
+ RangeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: RangeComponent, deps: [{ token: i0.KeyValueDiffers }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2608
+ RangeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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: "<span fxLayout=\"row\">\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 matInput\n [fsFilterFocusTrigger]=\"item\"\n [focusTargetType]=\"'from'\"\n type=\"text\"\n inputmode=\"decimal\"\n [(ngModel)]=\"item.model.min\"\n fsMaskNumber\n [scale]=\"item.options?.scale || 2\"\n #from\n >\n <span matSuffix *ngIf=\"item.suffix\" [innerHtml]=\"item.suffix\"></span>\n </mat-form-field>\n <div class=\"spacer\"></div>\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 matInput\n [fsFilterFocusTrigger]=\"item\"\n [focusTargetType]=\"'to'\"\n type=\"text\"\n inputmode=\"decimal\"\n [(ngModel)]=\"item.model.max\"\n fsMaskNumber\n [scale]=\"item.options?.scale || 2\"\n #to\n >\n <span matSuffix *ngIf=\"item.suffix\" [innerHtml]=\"item.suffix\"></span>\n </mat-form-field>\n</span>\n", styles: [".spacer{width:15px}mat-form-field{min-width:initial;display:flex;width:auto}mat-form-field ::ng-deep .mat-form-field-infix{width:auto}\n"], components: [{ type: i1$3.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }], directives: [{ type: i2$2.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { type: i1$3.MatLabel, selector: "mat-label" }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1$3.MatPrefix, selector: "[matPrefix]" }, { type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i5.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: i6$2.FsMaskNumberDirective, selector: "[fsMaskNumber]" }, { type: FocusToItemDirective, selector: "[fsFilterFocusTrigger]", inputs: ["fsFilterFocusTrigger", "focusTargetType"] }, { type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i1$3.MatSuffix, selector: "[matSuffix]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2609
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: RangeComponent, decorators: [{
2610
+ type: Component,
2611
+ args: [{
2612
+ selector: 'filter-item-range',
2613
+ templateUrl: './range.component.html',
2614
+ styleUrls: ['./range.component.scss'],
2615
+ changeDetection: ChangeDetectionStrategy.OnPush,
2616
+ }]
2617
+ }], ctorParameters: function () { return [{ type: i0.KeyValueDiffers }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { from: [{
2618
+ type: ViewChild,
2619
+ args: ['from', { static: true }]
2620
+ }], to: [{
2621
+ type: ViewChild,
2622
+ args: ['to', { static: true }]
2623
+ }] } });
2624
+
2625
+ class AutocompleteComponent extends BaseItemComponent {
2626
+ constructor(_kvDiffers, _cd) {
2627
+ super(_kvDiffers, _cd);
2628
+ this._kvDiffers = _kvDiffers;
2629
+ this._cd = _cd;
2630
+ this.displayWith = (data) => {
2631
+ return data ? data.name : data;
2632
+ };
2633
+ this.fetch = (keyword) => {
2634
+ return this.item.valuesFn(keyword);
2635
+ };
2608
2636
  }
2609
- clearActions() {
2610
- this._allActions = [];
2611
- this._setActions([]);
2612
- this._setKebabActions([]);
2637
+ }
2638
+ AutocompleteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: AutocompleteComponent, deps: [{ token: i0.KeyValueDiffers }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2639
+ AutocompleteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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]=\"item.label\"\n [fetchOnFocus]=\"item.fetchOnFocus\"\n [showClear]=\"item.clearAllowed\"\n name=\"item.name\">\n <ng-template fsAutocompleteTemplate let-data=\"data\">\n {{data.name}}\n </ng-template>\n</fs-autocomplete>\n", components: [{ type: i4$1.FsAutocompleteComponent, selector: "fs-autocomplete", inputs: ["fetch", "placeholder", "displayWith", "fetchOnFocus", "readonly", "required", "disabled", "hint", "panelWidth", "panelClass", "showClear"], outputs: ["cleared"] }], directives: [{ type: FocusToItemDirective, selector: "[fsFilterFocusTrigger]", inputs: ["fsFilterFocusTrigger", "focusTargetType"] }, { type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i4$1.FsAutocompleteTemplateDirective, selector: "[fsAutocompleteTemplate]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2640
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: AutocompleteComponent, decorators: [{
2641
+ type: Component,
2642
+ args: [{
2643
+ selector: 'filter-item-autocomplete',
2644
+ templateUrl: './autocomplete.component.html',
2645
+ changeDetection: ChangeDetectionStrategy.OnPush,
2646
+ }]
2647
+ }], ctorParameters: function () { return [{ type: i0.KeyValueDiffers }, { type: i0.ChangeDetectorRef }]; } });
2648
+
2649
+ class AutocompletechipsComponent extends BaseItemComponent {
2650
+ constructor(_kvDiffers, _cd) {
2651
+ super(_kvDiffers, _cd);
2652
+ this._kvDiffers = _kvDiffers;
2653
+ this._cd = _cd;
2654
+ this.fetch = (keyword) => {
2655
+ return this.item.valuesFn(keyword);
2656
+ };
2613
2657
  }
2614
- updateActionsVisibility() {
2615
- this._allActions.forEach((action) => action.updateVisibility());
2616
- this._classifyActions();
2658
+ // SP-T1747
2659
+ clicked() {
2660
+ this.chipBackground = this.item.chipBackground;
2661
+ this.chipColor = this.item.chipColor;
2662
+ this.chipIcon = this.item.chipIcon;
2663
+ this._cd.markForCheck();
2617
2664
  }
2618
- updateDisabledState() {
2619
- this.actions.forEach((action) => action.updateDisabledState());
2665
+ addAutocompleteChipItem(event) {
2666
+ if (event.data && this.item.model.indexOf(event.data.value) === -1) {
2667
+ this.item.model.push(event.data);
2668
+ this.itemChange();
2669
+ }
2620
2670
  }
2621
- _setKebabActions(actions) {
2622
- this._menuActions$.next(actions);
2671
+ removeAutocompleteChipItem(event) {
2672
+ remove(this.item.model, { value: event.data.value });
2673
+ this.itemChange();
2623
2674
  }
2624
- _setActions(actions) {
2625
- this._actions$.next(actions);
2675
+ clearAutocompleteChipItem() {
2676
+ this.item.clear();
2677
+ this.itemChange();
2626
2678
  }
2627
- _classifyActions() {
2628
- const kebabActions = [];
2629
- const actions = [];
2630
- const mobileMode = this.mobileMode;
2631
- this._allActions
2632
- .filter((action) => {
2633
- return action.visible;
2634
- })
2635
- .forEach((action) => {
2636
- if (action.menu || mobileMode) {
2637
- kebabActions.push(action);
2638
- }
2639
- else {
2640
- actions.push(action);
2641
- }
2642
- });
2643
- this._setKebabActions(kebabActions);
2644
- this._setActions(actions);
2679
+ compareItems(item1, item2) {
2680
+ return (item1 === null || item1 === void 0 ? void 0 : item1.value) === (item2 === null || item2 === void 0 ? void 0 : item2.value);
2645
2681
  }
2646
- _classifyAction(action) {
2647
- if (action.menu) {
2648
- this._setKebabActions([...this.menuActions, action]);
2682
+ }
2683
+ AutocompletechipsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: AutocompletechipsComponent, deps: [{ token: i0.KeyValueDiffers }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2684
+ AutocompletechipsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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 (click)=\"clicked()\"\n [allowText]=\"false\"\n [fetchOnFocus]=\"item.fetchOnFocus\"\n [placeholder]=\"item.label\"\n [chipImage]=\"item.chipImage\"\n [chipColor]=\"chipColor\"\n [chipIconColor]=\"chipIcon\"\n [chipBackground]=\"chipBackground\"\n [chipIcon]=\"item.chipIcon\"\n [chipClass]=\"item.chipClass\"\n [allowClear]=\"item.clearAllowed\"\n [removable]=\"item.clearAllowed\"\n [compareWith]=\"compareItems\"\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$1.FsAutocompleteChipsComponent, selector: "fs-autocomplete-chips", inputs: ["fetch", "readonly", "size", "placeholder", "chipImage", "chipBackground", "chipColor", "chipIcon", "chipIconColor", "chipClass", "hint", "allowText", "allowObject", "delay", "validateText", "invalidTextMessage", "removable", "allowClear", "color", "background", "orderable", "limit", "initOnClick", "fetchOnFocus", "multiple", "panelClass", "compareWith", "disabled", "panelWidth"], outputs: ["selected", "removed", "reordered", "clear"] }], directives: [{ type: FocusToItemDirective, selector: "[fsFilterFocusTrigger]", inputs: ["fsFilterFocusTrigger", "focusTargetType"] }, { type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i5$1.FsAutocompleteObjectDirective, selector: "[fsAutocompleteObject],[fsAutocompleteChipsTemplate]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2685
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: AutocompletechipsComponent, decorators: [{
2686
+ type: Component,
2687
+ args: [{
2688
+ selector: 'filter-item-autocompletechips',
2689
+ templateUrl: './autocompletechips.component.html',
2690
+ changeDetection: ChangeDetectionStrategy.OnPush,
2691
+ }]
2692
+ }], ctorParameters: function () { return [{ type: i0.KeyValueDiffers }, { type: i0.ChangeDetectorRef }]; } });
2693
+
2694
+ class DateComponent extends BaseItemComponent {
2695
+ constructor(_kvDiffers, _cd) {
2696
+ super(_kvDiffers, _cd);
2697
+ this._kvDiffers = _kvDiffers;
2698
+ this._cd = _cd;
2699
+ this.viewType = 'date';
2700
+ this.itemDateMode = ItemDateMode;
2701
+ this.showYear = true;
2702
+ this.showMonth = true;
2703
+ this.showDay = true;
2704
+ }
2705
+ ngOnInit() {
2706
+ if (this.item.type === ItemType.DateTime) {
2707
+ this.viewType = 'datetime';
2649
2708
  }
2650
2709
  else {
2651
- this._setActions([...this.actions, action]);
2710
+ this.viewType = 'date';
2711
+ }
2712
+ if (this.item.mode === ItemDateMode.ScrollMonthYear) {
2713
+ this.showDay = false;
2652
2714
  }
2653
2715
  }
2654
- _listenMobileMedia() {
2655
- this._breakpointObserver.observe(this._mobileMedia)
2656
- .pipe(skip(1), takeUntil(this._destroy$))
2657
- .subscribe(() => {
2658
- this._classifyActions();
2659
- });
2716
+ }
2717
+ DateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DateComponent, deps: [{ token: i0.KeyValueDiffers }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2718
+ DateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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.clearAllowed\"\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.clearAllowed\"\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", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i3$2.FsDatePickerComponent, selector: "[fsDatePicker]", inputs: ["minYear", "maxYear", "minDate", "maxDate", "startOfDay", "view", "minutes", "format"], outputs: ["change"] }, { type: i3$2.FsDateScrollPickerComponent, selector: "[fsDateScrollPicker]", inputs: ["minYear", "maxYear", "showMonth", "showYear", "showDay", "maxDate"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1$3.MatLabel, selector: "mat-label" }, { type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i5.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: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i1$3.MatPlaceholder, selector: "mat-placeholder" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2719
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DateComponent, decorators: [{
2720
+ type: Component,
2721
+ args: [{
2722
+ selector: 'filter-item-date',
2723
+ templateUrl: './date.component.html',
2724
+ changeDetection: ChangeDetectionStrategy.OnPush,
2725
+ }]
2726
+ }], ctorParameters: function () { return [{ type: i0.KeyValueDiffers }, { type: i0.ChangeDetectorRef }]; } });
2727
+
2728
+ class DateRangeComponent extends BaseItemComponent {
2729
+ constructor(_kvDiffers, _cd) {
2730
+ super(_kvDiffers, _cd);
2731
+ this._kvDiffers = _kvDiffers;
2732
+ this._cd = _cd;
2733
+ this.viewType = 'date';
2734
+ }
2735
+ ngOnInit() {
2736
+ if (this.item.type === ItemType.DateTimeRange) {
2737
+ this.viewType = 'datetime';
2738
+ }
2739
+ else {
2740
+ this.viewType = 'date';
2741
+ }
2660
2742
  }
2661
- };
2662
- ActionsController.ctorParameters = () => [
2663
- { type: BreakpointObserver }
2664
- ];
2665
- ActionsController = __decorate([
2666
- Injectable(),
2667
- __metadata("design:paramtypes", [BreakpointObserver])
2668
- ], ActionsController);
2743
+ }
2744
+ DateRangeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DateRangeComponent, deps: [{ token: i0.KeyValueDiffers }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2745
+ DateRangeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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.clearAllowed\"\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.clearAllowed\"\n [view]=\"viewType\"\n name=\"date_to\">\n</mat-form-field>\n", components: [{ type: i1$3.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i3$2.DateRangePickerFromComponent, selector: "[fsDateRangeFrom],[fsDateRangeFromPicker]", inputs: ["fsDateRangeFrom", "fsDateRangeFromPicker"] }, { type: i3$2.DateRangePickerToComponent, selector: "[fsDateRangeTo],[fsDateRangeToPicker]", inputs: ["fsDateRangeTo", "fsDateRangeToPicker"] }], directives: [{ type: i1$3.MatLabel, selector: "mat-label" }, { type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i5.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: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2746
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DateRangeComponent, decorators: [{
2747
+ type: Component,
2748
+ args: [{
2749
+ selector: 'filter-item-date-range',
2750
+ templateUrl: './date-range.component.html',
2751
+ changeDetection: ChangeDetectionStrategy.OnPush,
2752
+ }]
2753
+ }], ctorParameters: function () { return [{ type: i0.KeyValueDiffers }, { type: i0.ChangeDetectorRef }]; } });
2669
2754
 
2670
- let FilterComponent = class FilterComponent {
2671
- constructor(_filterOverlay, _zone, _externalParams, _filterItems, _actions, _defaultConfig) {
2672
- this._filterOverlay = _filterOverlay;
2673
- this._zone = _zone;
2674
- this._externalParams = _externalParams;
2675
- this._filterItems = _filterItems;
2676
- this._actions = _actions;
2677
- this._defaultConfig = _defaultConfig;
2678
- this.showSortBy = true;
2679
- this.showFilterInput = true;
2680
- this.closed = new EventEmitter();
2681
- this.opened = new EventEmitter();
2682
- this.ready = new EventEmitter();
2683
- this.showFilterMenu = false;
2684
- this.windowDesktop = false;
2685
- this.fsFilterClass = true;
2686
- this.searchText = new FormControl();
2687
- this.searchPlaceholder = 'Search';
2688
- this._config = null;
2689
- this._filtersBtnVisible$ = new BehaviorSubject(true);
2690
- this._keywordVisible$ = new BehaviorSubject(true);
2691
- this._hasFilterChips$ = new BehaviorSubject(false);
2755
+ class CheckboxComponent extends BaseItemComponent {
2756
+ constructor(_kvDiffers, _cd) {
2757
+ super(_kvDiffers, _cd);
2758
+ this._kvDiffers = _kvDiffers;
2759
+ this._cd = _cd;
2760
+ }
2761
+ }
2762
+ CheckboxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: CheckboxComponent, deps: [{ token: i0.KeyValueDiffers }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2763
+ CheckboxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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$2.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "id", "labelPosition", "name", "required", "checked", "disabled", "indeterminate", "aria-describedby", "value"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }], directives: [{ type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2764
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: CheckboxComponent, decorators: [{
2765
+ type: Component,
2766
+ args: [{
2767
+ selector: 'filter-item-checkbox',
2768
+ templateUrl: './checkbox.component.html',
2769
+ styleUrls: ['checkbox.component.scss'],
2770
+ changeDetection: ChangeDetectionStrategy.OnPush,
2771
+ }]
2772
+ }], ctorParameters: function () { return [{ type: i0.KeyValueDiffers }, { type: i0.ChangeDetectorRef }]; } });
2773
+
2774
+ class FilterItemComponent {
2775
+ constructor(_cdRef) {
2776
+ this._cdRef = _cdRef;
2692
2777
  this._destroy$ = new Subject();
2693
- this._listenWhenFilterReady();
2694
- this._updateWindowWidth();
2695
- this._filterOverlay.attach$
2696
- .pipe(takeUntil(this._destroy$))
2697
- .subscribe(() => {
2698
- this.showFilterMenu = true;
2699
- });
2700
- this._filterOverlay.detach$
2778
+ this.itemType = ItemType;
2779
+ }
2780
+ ngOnInit() {
2781
+ this.item.value$
2701
2782
  .pipe(takeUntil(this._destroy$))
2702
2783
  .subscribe(() => {
2703
- this.showFilterMenu = false;
2784
+ this._cdRef.markForCheck();
2704
2785
  });
2705
- this._listenWindowResize();
2706
2786
  }
2707
- set setConfig(config) {
2708
- this._initFilterWithConfig(config);
2787
+ ngOnDestroy() {
2788
+ this._destroy$.next();
2789
+ this._destroy$.complete();
2709
2790
  }
2710
- set setFilter(config) {
2711
- this._initFilterWithConfig(config);
2791
+ }
2792
+ FilterItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterItemComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2793
+ FilterItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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 class=\"interface\"\n *ngSwitchCase=\"itemType.Text\"\n [item]=\"item\">\n </filter-item-text>\n\n <filter-item-select class=\"interface\"\n *ngSwitchCase=\"itemType.Select\"\n [item]=\"item\">\n </filter-item-select>\n\n <filter-item-chips class=\"interface\"\n *ngSwitchCase=\"itemType.Chips\"\n [item]=\"item\">\n </filter-item-chips>\n\n <filter-item-range class=\"interface interface-range\"\n *ngSwitchCase=\"itemType.Range\"\n [item]=\"item\">\n </filter-item-range>\n\n <filter-item-autocomplete class=\"interface\"\n *ngSwitchCase=\"itemType.AutoComplete\"\n [item]=\"item\">\n </filter-item-autocomplete>\n\n <filter-item-autocompletechips class=\"interface\"\n *ngSwitchCase=\"itemType.AutoCompleteChips\"\n [item]=\"item\">\n </filter-item-autocompletechips>\n\n <filter-item-date class=\"interface interface-date\"\n *ngSwitchCase=\"itemType.Date\"\n [item]=\"item\">\n </filter-item-date>\n\n <filter-item-date class=\"interface interface-date\"\n *ngSwitchCase=\"itemType.DateTime\"\n [item]=\"item\">\n </filter-item-date>\n\n <filter-item-date-range class=\"interface interface-date\"\n *ngSwitchCase=\"itemType.DateRange\"\n [item]=\"item\">\n </filter-item-date-range>\n\n <filter-item-date-range class=\"interface interface-date\"\n *ngSwitchCase=\"itemType.DateTimeRange\"\n [item]=\"item\">\n </filter-item-date-range>\n\n <filter-item-checkbox class=\"interface interface-checkbox\"\n *ngSwitchCase=\"itemType.Checkbox\"\n [item]=\"item\">\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: CheckboxComponent, selector: "filter-item-checkbox" }], directives: [{ type: i3.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i3.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2794
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterItemComponent, decorators: [{
2795
+ type: Component,
2796
+ args: [{
2797
+ selector: 'filter-item',
2798
+ templateUrl: './filter-item.component.html',
2799
+ changeDetection: ChangeDetectionStrategy.OnPush,
2800
+ }]
2801
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { item: [{
2802
+ type: Input
2803
+ }] } });
2804
+
2805
+ class FsFilterDrawerActionsComponent {
2806
+ constructor(externalParams) {
2807
+ this.externalParams = externalParams;
2808
+ this._clear = new EventEmitter();
2809
+ this._done = new EventEmitter();
2712
2810
  }
2713
- get config() {
2714
- return this._config;
2811
+ get savedFilters() {
2812
+ return this.externalParams.savedFiltersController;
2715
2813
  }
2716
- get filterParams() {
2717
- return this._filterItems.values();
2814
+ done() {
2815
+ this._done.emit();
2718
2816
  }
2719
- get filterParamsQuery() {
2720
- return this._filterItems.valuesAsQuery();
2817
+ clear() {
2818
+ this._clear.emit();
2721
2819
  }
2722
- get items() {
2723
- return this._filterItems.items;
2820
+ saveFilters() {
2821
+ this.externalParams
2822
+ .savedFiltersController
2823
+ .openSavedFilterEditDialog();
2724
2824
  }
2725
- get visibleItems() {
2726
- return this._filterItems.visibleItems;
2825
+ }
2826
+ FsFilterDrawerActionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFilterDrawerActionsComponent, deps: [{ token: ExternalParamsController }], target: i0.ɵɵFactoryTarget.Component });
2827
+ FsFilterDrawerActionsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i3.AsyncPipe } });
2828
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFilterDrawerActionsComponent, decorators: [{
2829
+ type: Component,
2830
+ args: [{
2831
+ selector: 'fs-filter-drawer-actions',
2832
+ templateUrl: './filter-drawer-actions.component.html',
2833
+ }]
2834
+ }], ctorParameters: function () { return [{ type: ExternalParamsController }]; }, propDecorators: { _clear: [{
2835
+ type: Output,
2836
+ args: ['clear']
2837
+ }], _done: [{
2838
+ type: Output,
2839
+ args: ['done']
2840
+ }] } });
2841
+
2842
+ class FilterDrawerComponent {
2843
+ constructor(externalParams, _cd, _itemsStore, overlayRef, data) {
2844
+ this.externalParams = externalParams;
2845
+ this._cd = _cd;
2846
+ this._itemsStore = _itemsStore;
2847
+ this.overlayRef = overlayRef;
2848
+ this.data = data;
2849
+ this.inline = false;
2850
+ this.windowDesktop = false;
2851
+ this._itemsStore.prepareItems();
2852
+ this._clear = data.clear;
2853
+ this._done = data.done;
2854
+ this.updateWindowWidth();
2727
2855
  }
2728
- get itemsReady$() {
2729
- return this._filterItems.ready$;
2856
+ updateWindowWidth() {
2857
+ this.windowDesktop = window.innerWidth > 1200;
2730
2858
  }
2731
- get hasFilterChips$() {
2732
- return this._hasFilterChips$.asObservable();
2859
+ get items$() {
2860
+ return this._itemsStore.visibleItems$;
2733
2861
  }
2734
- get hasVisibleItemOrSorting() {
2735
- return this.visibleItems.length > 0 || !!this._filterItems.sortByItem;
2862
+ get sortItem() {
2863
+ return this._itemsStore.sortByItem;
2736
2864
  }
2737
- get hasKeyword() {
2738
- return this._filterItems.hasKeyword;
2865
+ get sortDirectionItem() {
2866
+ return this._itemsStore.sortDirectionItem;
2739
2867
  }
2740
- get filtersBtnVisible$() {
2741
- return this._filtersBtnVisible$.asObservable();
2868
+ clear() {
2869
+ this._clear();
2870
+ // this.overlayRef.detach();
2742
2871
  }
2743
- get keywordVisible$() {
2744
- return this._keywordVisible$.asObservable();
2872
+ done() {
2873
+ this._done();
2874
+ this.overlayRef.detach();
2745
2875
  }
2746
- get actionsVisible$() {
2747
- return this._actions.visible$;
2876
+ backdropClick() {
2877
+ this.done();
2748
2878
  }
2749
- get actions$() {
2750
- return this._actions.actions$;
2879
+ }
2880
+ FilterDrawerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterDrawerComponent, deps: [{ token: ExternalParamsController }, { token: i0.ChangeDetectorRef }, { token: FsFilterItemsStore }, { token: FILTER_DRAWER_OVERLAY }, { token: FILTER_DRAWER_DATA }], target: i0.ɵɵFactoryTarget.Component });
2881
+ FilterDrawerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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 *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 class=\"filter-group sort\"\n [item]=\"sortItem\">\n </filter-item>\n <filter-item 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 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%}.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{text-align:center}.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;top:0;bottom:0;left:0;right:0;z-index:900;outline:none}\n"], components: [{ type: i2$3.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$3.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 });
2882
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterDrawerComponent, decorators: [{
2883
+ type: Component,
2884
+ args: [{
2885
+ templateUrl: './filter-drawer.component.html',
2886
+ styleUrls: ['filter-drawer.component.scss'],
2887
+ // Commented out because filter items are not updating with a delayed observable. Need to figure this out.
2888
+ changeDetection: ChangeDetectionStrategy.OnPush,
2889
+ }]
2890
+ }], ctorParameters: function () { return [{ type: ExternalParamsController }, { type: i0.ChangeDetectorRef }, { type: FsFilterItemsStore }, { type: i1$6.OverlayRef, decorators: [{
2891
+ type: Inject,
2892
+ args: [FILTER_DRAWER_OVERLAY]
2893
+ }] }, { type: undefined, decorators: [{
2894
+ type: Inject,
2895
+ args: [FILTER_DRAWER_DATA]
2896
+ }] }]; }, propDecorators: { updateWindowWidth: [{
2897
+ type: HostListener,
2898
+ args: ['window:resize']
2899
+ }], inline: [{
2900
+ type: Input
2901
+ }] } });
2902
+
2903
+ const FS_FILTER_META = new InjectionToken('fs.filter.meta', {
2904
+ providedIn: 'root',
2905
+ factory: () => {
2906
+ return {
2907
+ openedFilters: 0,
2908
+ };
2751
2909
  }
2752
- get menuActions$() {
2753
- return this._actions.menuActions$;
2910
+ });
2911
+
2912
+ class FsFilterOverlayService {
2913
+ constructor(_injector, _filterMeta, _overlay, _focusController) {
2914
+ this._injector = _injector;
2915
+ this._filterMeta = _filterMeta;
2916
+ this._overlay = _overlay;
2917
+ this._focusController = _focusController;
2918
+ this.detach$ = new Subject();
2919
+ this.attach$ = new Subject();
2920
+ this._destroy$ = new Subject();
2921
+ this._openWhenChipClicked();
2754
2922
  }
2755
- ngOnInit() {
2756
- // Avoid ngChanges error
2757
- setTimeout(() => {
2758
- if (this.config.autofocus) {
2759
- this.focus();
2760
- }
2761
- });
2762
- this._listenInternalItemsChange();
2763
- this._initOverlay();
2923
+ get isOpened() {
2924
+ return !!this._overlayRef;
2764
2925
  }
2765
- ngAfterViewInit() {
2766
- this._listenInputKeyEvents();
2767
- // FIXME prevent fire change after init
2768
- setTimeout(() => {
2769
- this._listenInputChanges();
2926
+ setClearFn(fn) {
2927
+ this._clearFn = fn;
2928
+ }
2929
+ setDoneFn(fn) {
2930
+ this._doneFn = fn;
2931
+ }
2932
+ close() {
2933
+ if (this._overlayRef) {
2934
+ this._overlayRef.detach();
2935
+ this._overlayRef = null;
2936
+ this.removeFilterClass();
2937
+ }
2938
+ }
2939
+ open() {
2940
+ this._overlayRef = this._createOverlay();
2941
+ this._overlayRef.backdropClick()
2942
+ .pipe(takeUntil(this._destroy$))
2943
+ .subscribe(() => {
2944
+ this._overlayRef.detach();
2945
+ });
2946
+ this._overlayRef.detachments()
2947
+ .pipe(takeUntil(this._destroy$))
2948
+ .subscribe(() => {
2949
+ this.detach$.next();
2950
+ });
2951
+ this._overlayRef.attachments()
2952
+ .pipe(takeUntil(this._destroy$))
2953
+ .subscribe(() => {
2954
+ this.attach$.next();
2770
2955
  });
2956
+ this.addFilterClass();
2957
+ return this.openPortalPreview();
2771
2958
  }
2772
2959
  ngOnDestroy() {
2773
- this._destroyFilterDrawer();
2774
2960
  this._destroy$.next();
2775
2961
  this._destroy$.complete();
2776
2962
  }
2777
- focus() {
2778
- if (this.searchTextMatInput) {
2779
- this.searchTextMatInput.focus();
2780
- }
2781
- }
2782
- updateSort(sort) {
2783
- this._filterItems.updateSort(sort);
2784
- }
2785
- /**
2786
- *
2787
- * Do update value of some field
2788
- *
2789
- * @param values - values for update
2790
- *
2791
- * To update text value just pass new text value
2792
- *
2793
- * public updateSelectValue(val) {
2794
- * this.filterEl.updateValues({ keyword: val });
2795
- * }
2796
- *
2797
- * To update select or observable select you could pass suitable value
2798
- *
2799
- * public updateSelectValue(val: number) {
2800
- * this.filterEl.updateValues({ simple_select: val }, { observable_select: val });
2801
- * }
2802
- *
2803
- * To update checkbox value just pass true/false as value
2804
- *
2805
- * public updateCheckox(val: boolean) {
2806
- * this.filterEl.updateValues({ checkbox: val });
2807
- * }
2808
- *
2809
- * To update range value just pass object with min&max object or just with one of targets
2810
- *
2811
- * Ex.: { min: 10, max 15 }, { min: 5 }, { max 5 }
2812
- *
2813
- * public updateRange(val) {
2814
- * this.filterEl.updateValues({ range: val });
2815
- * }
2816
- *
2817
- * To update autocomplete just pass object with name/value fields
2818
- *
2819
- * Ex.: { name: 'John Doe', value: 1 }
2820
- *
2821
- * public updateAutocomplete(val) {
2822
- * this.filterEl.updateValues({ autocomplete_user_id: val });
2823
- * }
2824
- *
2825
- * To update autocompletechips just pass:
2826
- *
2827
- * 1) object with name/value fields - will be appended to existing set of values
2828
- *
2829
- * { name: 'John Doe', value: 1 }
2830
- *
2831
- * 2) array of objects - will be appended to existing set of values
2832
- *
2833
- * [{ name: 'John Doe', value: 1 }, { name: 'Darya Filipova', value: 2 }]
2834
- *
2835
- * 3) null - clear existing set of values
2836
- *
2837
- * public updateAutocomplete(val) {
2838
- * this.filterEl.updateValues({ autocompletechips_user_id: val });
2839
- * }
2840
- *
2841
- */
2842
- updateValues(values) {
2843
- Object.keys(values).forEach((key) => {
2844
- const filterItem = this.items
2845
- .find((item) => item.name === key);
2846
- if (!filterItem) {
2847
- return;
2848
- }
2849
- filterItem.model = values[key];
2963
+ _createOverlay() {
2964
+ const overlayConfig = new OverlayConfig({
2965
+ hasBackdrop: true,
2966
+ backdropClass: 'fs-filter-backdrop'
2850
2967
  });
2968
+ return this._overlay.create(overlayConfig);
2851
2969
  }
2852
- hide() {
2853
- this.changeVisibility(false);
2970
+ openPortalPreview() {
2971
+ const data = { done: this._doneFn, clear: this._clearFn };
2972
+ const injector = this._createInjector(this._injector, data, this._overlayRef);
2973
+ const containerPortal = new ComponentPortal(FilterDrawerComponent, undefined, injector);
2974
+ const containerRef = this._overlayRef.attach(containerPortal);
2975
+ return containerRef.instance;
2854
2976
  }
2855
- show() {
2856
- this.changeVisibility(true);
2977
+ _createInjector(parentInjector, data, overlayRef) {
2978
+ const injectionTokens = new WeakMap([
2979
+ [FILTER_DRAWER_DATA, data],
2980
+ [FILTER_DRAWER_OVERLAY, overlayRef],
2981
+ ]);
2982
+ return new PortalInjector(parentInjector, injectionTokens);
2857
2983
  }
2858
- changeVisibilityClick(value, event = null) {
2859
- if (event) {
2860
- event.stopPropagation();
2984
+ removeFilterClass() {
2985
+ this._filterMeta.openedFilters--;
2986
+ if (this._filterMeta.openedFilters === 0) {
2987
+ window.document.body.classList.remove('fs-filter-open');
2861
2988
  }
2862
- this.changeVisibility(value);
2863
2989
  }
2864
- filterInputEvent(event) {
2865
- if (!this.windowDesktop) {
2866
- return;
2990
+ addFilterClass() {
2991
+ this._filterMeta.openedFilters++;
2992
+ if (this._filterMeta.openedFilters === 1) {
2993
+ window.document.body.classList.add('fs-filter-open');
2867
2994
  }
2868
- if (['Enter', 'NumpadEnter', 'Escape'].indexOf(event.code) >= 0) {
2869
- this.changeVisibility(false);
2870
- if (this.searchTextInput) {
2871
- this.searchTextInput.nativeElement.blur();
2995
+ }
2996
+ _openWhenChipClicked() {
2997
+ this._focusController.focusOn$
2998
+ .pipe(filter$1((v) => !!v), takeUntil(this._destroy$))
2999
+ .subscribe(() => {
3000
+ if (!this.isOpened) {
3001
+ this.open();
2872
3002
  }
2873
- }
3003
+ });
2874
3004
  }
2875
- getItemValue(name) {
2876
- const item = this.items
2877
- .find((item) => item.name === name);
2878
- if (item) {
2879
- return item.model;
2880
- }
2881
- else {
2882
- return null;
2883
- }
3005
+ }
3006
+ FsFilterOverlayService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFilterOverlayService, deps: [{ token: i0.Injector }, { token: FS_FILTER_META }, { token: i1$6.Overlay }, { token: FocusControllerService }], target: i0.ɵɵFactoryTarget.Injectable });
3007
+ FsFilterOverlayService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFilterOverlayService });
3008
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFilterOverlayService, decorators: [{
3009
+ type: Injectable
3010
+ }], ctorParameters: function () { return [{ type: i0.Injector }, { type: undefined, decorators: [{
3011
+ type: Inject,
3012
+ args: [FS_FILTER_META]
3013
+ }] }, { type: i1$6.Overlay }, { type: FocusControllerService }]; } });
3014
+
3015
+ class FilterStatusBarDirective {
3016
+ }
3017
+ FilterStatusBarDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterStatusBarDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
3018
+ FilterStatusBarDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FilterStatusBarDirective, selector: "[fsFilterStatusBar]", ngImport: i0 });
3019
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterStatusBarDirective, decorators: [{
3020
+ type: Directive,
3021
+ args: [{
3022
+ selector: '[fsFilterStatusBar]',
3023
+ }]
3024
+ }] });
3025
+
3026
+ var ActionType;
3027
+ (function (ActionType) {
3028
+ ActionType["Basic"] = "basic";
3029
+ ActionType["Raised"] = "raised";
3030
+ ActionType["Icon"] = "icon";
3031
+ ActionType["Fab"] = "fab";
3032
+ ActionType["MiniFab"] = "mini-fab";
3033
+ })(ActionType || (ActionType = {}));
3034
+
3035
+ var ActionMode;
3036
+ (function (ActionMode) {
3037
+ ActionMode["Button"] = "button";
3038
+ ActionMode["Menu"] = "menu";
3039
+ ActionMode["File"] = "file";
3040
+ })(ActionMode || (ActionMode = {}));
3041
+
3042
+ class ActionMenuItem {
3043
+ constructor(config = {}, _parent) {
3044
+ this._parent = _parent;
3045
+ this.items = [];
3046
+ this._isGroup = false;
3047
+ this._visible$ = new BehaviorSubject(true);
3048
+ this._disabled$ = new BehaviorSubject(false);
3049
+ this._init(config);
2884
3050
  }
2885
- showItem(name) {
2886
- const item = this.getItem(name);
2887
- if (item) {
2888
- item.hide = false;
2889
- this._filterItems.updateVisibleItems();
2890
- }
3051
+ get isGroup() {
3052
+ return this._isGroup;
2891
3053
  }
2892
- hideItem(name) {
2893
- const item = this.getItem(name);
2894
- if (!item) {
2895
- return;
2896
- }
2897
- item.hide = true;
2898
- this._filterItems.updateVisibleItems();
3054
+ get visible() {
3055
+ return this._visible$.getValue();
2899
3056
  }
2900
- clearItem(name) {
2901
- const item = this.getItem(name);
2902
- if (!item) {
2903
- return;
2904
- }
2905
- item.clear();
3057
+ get visible$() {
3058
+ return this._visible$.asObservable();
2906
3059
  }
2907
- updateItemConfig(name, params) {
2908
- var _a, _b;
2909
- const item = this.getItem(name);
2910
- if (!item) {
3060
+ set disabled(value) {
3061
+ this._disabled$.next(value);
3062
+ }
3063
+ get disabled() {
3064
+ return this._disabled$.getValue();
3065
+ }
3066
+ get disabled$() {
3067
+ return this._disabled$.asObservable();
3068
+ }
3069
+ updateVisibility() {
3070
+ const visible = !!this._showFn ? this._showFn() : true;
3071
+ if (!visible || !this.isGroup) {
3072
+ this._visible$.next(visible);
2911
3073
  return;
2912
3074
  }
2913
- item.label = (_a = params.label) !== null && _a !== void 0 ? _a : item.label;
2914
- item.chipLabel = (_b = params.chipLabel) !== null && _b !== void 0 ? _b : item.chipLabel;
2915
- this._filterItems.updateVisibleItems();
3075
+ const numberOfVisibleChildren = this.items
3076
+ .reduce((acc, item) => {
3077
+ item.updateVisibility();
3078
+ if (item.visible) {
3079
+ acc++;
3080
+ }
3081
+ return acc;
3082
+ }, 0);
3083
+ this._visible$.next(!!numberOfVisibleChildren);
2916
3084
  }
2917
- getItemValueChange$(name) {
2918
- const item = this.items.find((i) => i.name === name);
2919
- if (item) {
2920
- return item.value$
2921
- .pipe(map(() => {
2922
- return item.model;
2923
- }));
3085
+ _init(config) {
3086
+ this.label = config.label;
3087
+ this.icon = config.icon;
3088
+ this._showFn = config.show;
3089
+ if ('items' in config) {
3090
+ this._isGroup = true;
3091
+ if (Array.isArray(config.items)) {
3092
+ this.items = config
3093
+ .items
3094
+ .map((item) => new ActionMenuItem(item, this));
3095
+ }
3096
+ this.updateVisibility();
2924
3097
  }
2925
3098
  else {
2926
- return null;
3099
+ this.click = config.click;
3100
+ this.routerLink = config.link;
3101
+ if (!this._parent) {
3102
+ this.updateVisibility();
3103
+ }
2927
3104
  }
2928
3105
  }
2929
- changeVisibility(state) {
2930
- if (state === this.showFilterMenu) {
2931
- return;
2932
- }
2933
- if (!state) {
2934
- this.closed.emit();
2935
- return this._destroyFilterDrawer();
2936
- }
2937
- if (!this.hasVisibleItemOrSorting) {
2938
- return;
2939
- }
2940
- this._listenEscButton();
2941
- this.opened.emit();
2942
- this._filterOverlay.open();
3106
+ }
3107
+
3108
+ class Action {
3109
+ constructor(config = {}) {
3110
+ this.primary = true;
3111
+ this.isReorderAction = false;
3112
+ this.classArray = [];
3113
+ this.items = [];
3114
+ this._visible$ = new BehaviorSubject(true);
3115
+ this._disabled$ = new BehaviorSubject(false);
3116
+ this._init(config);
2943
3117
  }
2944
- clearSearchText(event) {
2945
- event.stopPropagation();
2946
- this._filterItems.keywordItem.clear();
2947
- this.searchTextInput.nativeElement.focus();
3118
+ get visible() {
3119
+ return this._visible$.getValue();
2948
3120
  }
2949
- init() {
2950
- const data = this._filterItems.valuesAsQuery();
2951
- this._sort = this._filterItems.getSort();
2952
- this.config.init(data, this._sort);
2953
- this._updateChipsVisibility();
3121
+ get visible$() {
3122
+ return this._visible$.asObservable();
2954
3123
  }
2955
- clear(event = null) {
2956
- if (event) {
2957
- event.stopPropagation();
2958
- }
2959
- this._filterItems.filtersClear();
2960
- if (this.config.clear) {
2961
- this.config.clear();
2962
- }
3124
+ set disabled(value) {
3125
+ this._disabled$.next(value);
2963
3126
  }
2964
- /**
2965
- * Close filter window and do change callback
2966
- */
2967
- search(event) {
2968
- this.changeVisibilityClick(false, event);
3127
+ get disabled() {
3128
+ return this._disabled$.getValue();
2969
3129
  }
2970
- reload(event = null) {
2971
- if (event) {
2972
- event.preventDefault();
2973
- event.stopPropagation();
2974
- }
2975
- const data = this._filterItems.valuesAsQuery();
2976
- if (this.config.reload) {
2977
- this.config.reload(data, this._filterItems.getSort());
3130
+ get disabled$() {
3131
+ return this._disabled$.asObservable();
3132
+ }
3133
+ updateVisibility() {
3134
+ const visible = !!this._showFn ? this._showFn() : true;
3135
+ if (!visible || this.mode !== ActionMode.Menu) {
3136
+ this._visible$.next(visible);
3137
+ return;
2978
3138
  }
3139
+ const hasVisibleChildren = this.items.some((item) => item.visible);
3140
+ this._visible$.next(hasVisibleChildren);
2979
3141
  }
2980
- getItem(name) {
2981
- return this.items
2982
- .find((item) => item.name === name);
3142
+ updateDisabledState() {
3143
+ if (this._disabledFn) {
3144
+ this.disabled = this._disabledFn();
3145
+ }
2983
3146
  }
2984
- /**
2985
- * Call change callback and apply new filter values
2986
- */
2987
- change() {
2988
- const data = this._filterItems.valuesAsQuery();
2989
- const sort = this._filterItems.getSort();
2990
- const sortingChanged = ((!sort || !this._sort) && sort !== this._sort)
2991
- || (sort && this._sort && !objectsAreEquals(this._sort, sort));
2992
- if (sortingChanged) {
2993
- this._sort = sort;
2994
- if (this.config.sortChange) {
2995
- this.config.sortChange(data, sort);
2996
- }
3147
+ _init(config) {
3148
+ var _a, _b, _c, _d, _e, _f;
3149
+ config.mode = (_a = config.mode) !== null && _a !== void 0 ? _a : ActionMode.Button;
3150
+ this.primary = (_b = config.primary) !== null && _b !== void 0 ? _b : true;
3151
+ this.color = config.color;
3152
+ this.type = (_c = config.type) !== null && _c !== void 0 ? _c : ActionType.Raised;
3153
+ this.label = config.label;
3154
+ this.mode = config.mode;
3155
+ this.icon = config.icon;
3156
+ this.iconPlacement = config.iconPlacement;
3157
+ this._showFn = config.show;
3158
+ this.tabIndex = (_d = config.tabIndex) !== null && _d !== void 0 ? _d : 0;
3159
+ if (config.multiple !== undefined) {
3160
+ this.multiple = config.multiple;
2997
3161
  }
2998
- if (this.config.change) {
2999
- this.config.change(data, sort);
3162
+ if (config.className) {
3163
+ this.className = config.className;
3164
+ this.classArray = this.className
3165
+ .split(' ');
3000
3166
  }
3001
- this._updateChipsVisibility();
3167
+ if (this.primary) {
3168
+ this.color = 'primary';
3169
+ }
3170
+ switch (config.mode) {
3171
+ case ActionMode.Button:
3172
+ {
3173
+ this.menu = config.menu;
3174
+ this.customize = config.customize;
3175
+ this.click = (_e = config.click) !== null && _e !== void 0 ? _e : (() => { });
3176
+ this._disabledFn = config.disabled;
3177
+ this.updateDisabledState();
3178
+ }
3179
+ break;
3180
+ case ActionMode.Menu:
3181
+ {
3182
+ if (config.items && Array.isArray(config.items)) {
3183
+ this.items = config.items.map((item) => new ActionMenuItem(item));
3184
+ }
3185
+ }
3186
+ break;
3187
+ case ActionMode.File:
3188
+ {
3189
+ this.fileSelected = config.select;
3190
+ this.fileError = config.error;
3191
+ this.accept = config.accept;
3192
+ this.imageQuality = config.imageQuality;
3193
+ this.minWidth = config.minWidth;
3194
+ this.minHeight = config.minHeight;
3195
+ this.maxWidth = config.maxWidth;
3196
+ this.maxHeight = config.maxHeight;
3197
+ this.click = (_f = config.click) !== null && _f !== void 0 ? _f : (() => { });
3198
+ this._disabledFn = config.disabled;
3199
+ this.updateDisabledState();
3200
+ }
3201
+ break;
3202
+ }
3203
+ this.updateVisibility();
3002
3204
  }
3003
- /**
3004
- * Update filter actions config
3005
- * @param actions
3006
- */
3007
- updateActions(actions) {
3008
- this._actions.initActions(actions);
3205
+ }
3206
+
3207
+ class ActionsController {
3208
+ constructor(_breakpointObserver) {
3209
+ this._breakpointObserver = _breakpointObserver;
3210
+ this._visible$ = new BehaviorSubject(false);
3211
+ this._actions$ = new BehaviorSubject([]);
3212
+ this._menuActions$ = new BehaviorSubject([]);
3213
+ this._destroy$ = new Subject();
3214
+ this._mobileMedia = '(max-width: 799px)';
3215
+ this._allActions = [];
3216
+ this._listenMobileMedia();
3009
3217
  }
3010
- /**
3011
- * Show "Filters" button
3012
- */
3013
- showFiltersBtn() {
3014
- this._filtersBtnVisible$.next(true);
3218
+ get menuActions() {
3219
+ return this._menuActions$.value;
3015
3220
  }
3016
- /**
3017
- * Hide "Filters" button
3018
- */
3019
- hideFiltersBtn() {
3020
- this._filtersBtnVisible$.next(false);
3221
+ get actions() {
3222
+ return this._actions$.value;
3021
3223
  }
3022
- /**
3023
- * Show "Keyword" field if it present
3024
- */
3025
- showKeywordField() {
3026
- this._keywordVisible$.next(true);
3224
+ get actions$() {
3225
+ return this._actions$.asObservable();
3027
3226
  }
3028
- /**
3029
- * Hide "Keyword" field if it present
3030
- */
3031
- hideKeywordField() {
3032
- this._keywordVisible$.next(false);
3227
+ get menuActions$() {
3228
+ return this._menuActions$.asObservable();
3033
3229
  }
3034
- /**
3035
- * Go through actions and check show() callback and update visible actions
3036
- */
3037
- updateActionsVisibility() {
3038
- this._actions.updateActionsVisibility();
3230
+ get visible$() {
3231
+ return this._visible$.asObservable();
3039
3232
  }
3040
- /**
3041
- * Go through actions and check disabled() callback and update disabled state
3042
- */
3043
- updateDisabledState() {
3044
- this._actions.updateDisabledState();
3233
+ get mobileMode() {
3234
+ return this._breakpointObserver.isMatched(this._mobileMedia);
3045
3235
  }
3046
- setItems(items) {
3047
- this._filterItems.destroyItems();
3048
- this.config.items = items;
3049
- this._filterItems.setConfig(this._config);
3050
- this._externalParams.initItems();
3051
- this._syncSearchInputWithKeyword();
3052
- this._listenKeywordItemClear();
3236
+ ngOnDestroy() {
3237
+ this._destroy$.next();
3238
+ this._destroy$.complete();
3053
3239
  }
3054
- _initFilterWithConfig(config) {
3055
- if (this.config) {
3056
- this._filterItems.destroyItems();
3240
+ initActions(rawActions) {
3241
+ if (!rawActions || !Array.isArray(rawActions)) {
3242
+ return;
3057
3243
  }
3058
- config = Object.assign(Object.assign({}, (this._defaultConfig || {})), config);
3059
- this._config = new FsFilterConfig(config);
3060
- this._actions.initActions(this._config.actions);
3061
- this._filterItems.setConfig(this._config);
3062
- this._externalParams.setConfig(this._config);
3063
- this._syncSearchInputWithKeyword();
3064
- if (!!this.config.reloadWhenConfigChanged) {
3065
- this.change();
3244
+ this.show();
3245
+ this._allActions = rawActions
3246
+ .map((action) => new Action(action));
3247
+ if (this._reorderAction) {
3248
+ this._allActions.unshift(this._reorderAction);
3066
3249
  }
3067
- this._listenKeywordItemClear();
3250
+ this._classifyActions();
3068
3251
  }
3069
- _destroyFilterDrawer() {
3070
- this._filterOverlay.close();
3252
+ show() {
3253
+ this._visible$.next(true);
3071
3254
  }
3072
- _updateWindowWidth() {
3073
- this.windowDesktop = window.innerWidth > 1200;
3255
+ hide() {
3256
+ this._visible$.next(false);
3074
3257
  }
3075
- _listenEscButton() {
3076
- this._zone.runOutsideAngular(() => {
3077
- fromEvent(window, 'keyup')
3078
- .pipe(filter$1((event) => event.code === 'Escape'), takeUntil(this.closed), takeUntil(this._destroy$))
3079
- .subscribe(() => {
3080
- this._zone.run(() => {
3081
- this.changeVisibility(false);
3082
- });
3083
- });
3084
- });
3258
+ addReorderAction(action) {
3259
+ this._allActions.unshift(action);
3260
+ action.isReorderAction = true;
3261
+ this._classifyAction(action);
3262
+ this._reorderAction = action;
3085
3263
  }
3086
- _listenInputKeyEvents() {
3087
- if (!this.searchTextInput) {
3088
- return;
3089
- }
3090
- this._zone.runOutsideAngular(() => {
3091
- fromEvent(this.searchTextInput.nativeElement, 'keydown')
3092
- .pipe(debounceTime(500), filter$1((event) => {
3093
- return ['Enter', 'NumpadEnter', 'Escape'].indexOf(event.code) > -1;
3094
- }), takeUntil(this._destroy$))
3095
- .subscribe((event) => {
3096
- this._zone.run(() => {
3097
- this.filterInputEvent(event);
3098
- });
3099
- });
3100
- });
3264
+ clearActions() {
3265
+ this._allActions = [];
3266
+ this._setActions([]);
3267
+ this._setKebabActions([]);
3101
3268
  }
3102
- _listenWindowResize() {
3103
- this._zone.runOutsideAngular(() => {
3104
- fromEvent(window, 'resize')
3105
- .pipe(debounceTime(100), takeUntil(this._destroy$))
3106
- .subscribe(() => {
3107
- this._zone.run(() => {
3108
- this._updateWindowWidth();
3109
- });
3110
- });
3111
- });
3269
+ updateActionsVisibility() {
3270
+ this._allActions.forEach((action) => action.updateVisibility());
3271
+ this._classifyActions();
3112
3272
  }
3113
- _listenInputChanges() {
3114
- if (!this._filterItems.keywordItem) {
3115
- return;
3116
- }
3117
- this._zone.runOutsideAngular(() => {
3118
- this.searchText.valueChanges
3119
- .pipe(debounceTime(200), distinctUntilChanged(), filter$1((value) => {
3120
- var _a;
3121
- return value !== ((_a = this._filterItems.keywordItem) === null || _a === void 0 ? void 0 : _a.model);
3122
- }), takeUntil(this._destroy$))
3123
- .subscribe((value) => {
3124
- this._zone.run(() => {
3125
- const keywordItem = this._filterItems.keywordItem;
3126
- if (keywordItem && keywordItem.value !== value) {
3127
- keywordItem.model = value;
3128
- }
3129
- });
3130
- });
3131
- });
3273
+ updateDisabledState() {
3274
+ this.actions.forEach((action) => action.updateDisabledState());
3132
3275
  }
3133
- _syncSearchInputWithKeyword() {
3134
- const keywordItem = this._filterItems.keywordItem;
3135
- if (keywordItem) {
3136
- this.searchText.setValue(keywordItem.model);
3137
- this.searchPlaceholder = keywordItem.label || 'Search';
3138
- }
3276
+ _setKebabActions(actions) {
3277
+ this._menuActions$.next(actions);
3139
3278
  }
3140
- _listenKeywordItemClear() {
3141
- var _a;
3142
- (_a = this._filterItems
3143
- .keywordItem) === null || _a === void 0 ? void 0 : _a.clear$.pipe(takeUntil(this._filterItems.keywordItem.destroy$), takeUntil(this._destroy$)).subscribe(() => {
3144
- this.searchText.setValue('');
3145
- });
3279
+ _setActions(actions) {
3280
+ this._actions$.next(actions);
3146
3281
  }
3147
- _listenInternalItemsChange() {
3148
- this._filterItems
3149
- .itemsChange$
3150
- .pipe(takeUntil(this._destroy$))
3151
- .subscribe(() => {
3152
- this.change();
3282
+ _classifyActions() {
3283
+ const kebabActions = [];
3284
+ const actions = [];
3285
+ const mobileMode = this.mobileMode;
3286
+ this._allActions
3287
+ .filter((action) => {
3288
+ return action.visible;
3289
+ })
3290
+ .forEach((action) => {
3291
+ if (action.menu || mobileMode) {
3292
+ kebabActions.push(action);
3293
+ }
3294
+ else {
3295
+ actions.push(action);
3296
+ }
3153
3297
  });
3298
+ this._setKebabActions(kebabActions);
3299
+ this._setActions(actions);
3154
3300
  }
3155
- _initOverlay() {
3156
- this._filterOverlay.setClearFn(this.clear.bind(this));
3157
- this._filterOverlay.setDoneFn(this.hide.bind(this));
3301
+ _classifyAction(action) {
3302
+ if (action.menu) {
3303
+ this._setKebabActions([...this.menuActions, action]);
3304
+ }
3305
+ else {
3306
+ this._setActions([...this.actions, action]);
3307
+ }
3158
3308
  }
3159
- // We may need some time to recieve external params and after that ready can be emitted
3160
- _listenWhenFilterReady() {
3161
- combineLatest([
3162
- this._externalParams.pending$,
3163
- this.itemsReady$,
3164
- ])
3165
- .pipe(filter$1(([pendingParams, itemsReady]) => !pendingParams && itemsReady), takeUntil(this._destroy$))
3309
+ _listenMobileMedia() {
3310
+ this._breakpointObserver.observe(this._mobileMedia)
3311
+ .pipe(skip(1), takeUntil(this._destroy$))
3166
3312
  .subscribe(() => {
3167
- if (this.config.init) {
3168
- this.init();
3169
- }
3170
- this.ready.emit();
3313
+ this._classifyActions();
3171
3314
  });
3172
3315
  }
3173
- _updateChipsVisibility() {
3174
- const hasFilterChips = this._filterItems.items
3175
- .some((item) => {
3176
- return item.isChipVisible;
3177
- });
3178
- this._hasFilterChips$.next(hasFilterChips);
3316
+ }
3317
+ ActionsController.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ActionsController, deps: [{ token: i1$7.BreakpointObserver }], target: i0.ɵɵFactoryTarget.Injectable });
3318
+ ActionsController.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ActionsController });
3319
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ActionsController, decorators: [{
3320
+ type: Injectable
3321
+ }], ctorParameters: function () { return [{ type: i1$7.BreakpointObserver }]; } });
3322
+
3323
+ class FsFilterActionButtonComponent {
3324
+ }
3325
+ FsFilterActionButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFilterActionButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3326
+ FsFilterActionButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsFilterActionButtonComponent, selector: "fs-filter-action-button", inputs: { action: "action" }, host: { classAttribute: "action-button" }, ngImport: i0, template: "<ng-container [ngSwitch]=\"action.type\">\n <!-- Basic button -->\n <button type=\"button\"\n *ngSwitchCase=\"'basic'\"\n mat-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 >\n <ng-template [ngTemplateOutlet]=\"buttonContent\"></ng-template>\n </button>\n\n <!-- Raised button -->\n <button type=\"button\"\n *ngSwitchDefault\n mat-raised-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 >\n <ng-template [ngTemplateOutlet]=\"buttonContent\"></ng-template>\n </button>\n\n <!-- Icon button -->\n <button type=\"button\"\n *ngSwitchCase=\"'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 >\n <ng-template [ngTemplateOutlet]=\"buttonContent\"></ng-template>\n </button>\n\n <!-- Fab button -->\n <button type=\"button\"\n *ngSwitchCase=\"'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 >\n <ng-template [ngTemplateOutlet]=\"buttonContent\"></ng-template>\n </button>\n\n <!-- Mini Fab button -->\n <button type=\"button\"\n *ngSwitchCase=\"'mini-fab'\"\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 >\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$3.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: i6$1.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i3.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
3327
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFilterActionButtonComponent, decorators: [{
3328
+ type: Component,
3329
+ args: [{
3330
+ selector: 'fs-filter-action-button',
3331
+ templateUrl: './action-button.component.html',
3332
+ host: {
3333
+ class: 'action-button',
3334
+ },
3335
+ changeDetection: ChangeDetectionStrategy.OnPush,
3336
+ }]
3337
+ }], propDecorators: { action: [{
3338
+ type: Input
3339
+ }] } });
3340
+
3341
+ class FsFilterActionKebabActionsComponent {
3342
+ }
3343
+ FsFilterActionKebabActionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFilterActionKebabActionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3344
+ FsFilterActionKebabActionsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsFilterActionKebabActionsComponent, selector: "fs-filter-action-kebab-actions", inputs: { kebabActions: "kebabActions" }, ngImport: i0, template: "<button 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 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 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 fs-menu-item\n [fsClass]=\"action.classArray\"\n >\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 <mat-icon *ngIf=\"action.icon\">{{action.icon}}</mat-icon> {{action.label}}\n </fs-file>\n </ng-template>\n </ng-container>\n\n <ng-container *ngSwitchDefault>\n <ng-template fs-menu-item\n (click)=\"action.click($event)\"\n [fsClass]=\"action.classArray\"\n >\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$3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i3$3.FsMenuComponent, selector: "fs-menu", inputs: ["class", "buttonClass"], outputs: ["opened", "closed"] }, { type: i4$3.FsFileComponent, selector: "fs-file", inputs: ["minHeight", "minWidth", "multiple", "capture", "allowClick", "allowDrop", "accept", "disabled", "imageWidth", "imageHeight", "imageQuality"], outputs: ["select", "error", "clicked", "declined"] }], 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]", inputs: ["fsClass", "class", "id", "label", "hidden", "groupHidden", "dismissAfterClick", "link", "target", "queryParams"], outputs: ["click"] }, { type: i3$3.FsGroupMenuItemTemplateDirective, selector: "[fs-group-menu-item-template]" }, { type: i3.NgSwitchDefault, selector: "[ngSwitchDefault]" }], pipes: { "async": i3.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
3345
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFilterActionKebabActionsComponent, decorators: [{
3346
+ type: Component,
3347
+ args: [{
3348
+ selector: 'fs-filter-action-kebab-actions',
3349
+ styleUrls: ['./action-kebab-actions.component.scss'],
3350
+ templateUrl: './action-kebab-actions.component.html',
3351
+ changeDetection: ChangeDetectionStrategy.OnPush,
3352
+ }]
3353
+ }], propDecorators: { kebabActions: [{
3354
+ type: Input
3355
+ }] } });
3356
+
3357
+ class FsFilterActionsComponent {
3358
+ constructor() {
3359
+ this.kebabActions = [];
3360
+ this.actions = [];
3179
3361
  }
3180
- };
3181
- FilterComponent.ctorParameters = () => [
3182
- { type: FsFilterOverlayService },
3183
- { type: NgZone },
3184
- { type: ExternalParamsController },
3185
- { type: FsFilterItemsStore },
3186
- { type: ActionsController },
3187
- { type: FsFilterConfig, decorators: [{ type: Optional }, { type: Inject, args: [FS_FILTER_CONFIG,] }] }
3188
- ];
3189
- __decorate([
3190
- Input('config'),
3191
- __metadata("design:type", Object),
3192
- __metadata("design:paramtypes", [Object])
3193
- ], FilterComponent.prototype, "setConfig", null);
3194
- __decorate([
3195
- Input('filter'),
3196
- __metadata("design:type", Object),
3197
- __metadata("design:paramtypes", [Object])
3198
- ], FilterComponent.prototype, "setFilter", null);
3199
- __decorate([
3200
- Input(),
3201
- __metadata("design:type", Object)
3202
- ], FilterComponent.prototype, "showSortBy", void 0);
3203
- __decorate([
3204
- Input(),
3205
- __metadata("design:type", Object)
3206
- ], FilterComponent.prototype, "showFilterInput", void 0);
3207
- __decorate([
3208
- Output(),
3209
- __metadata("design:type", Object)
3210
- ], FilterComponent.prototype, "closed", void 0);
3211
- __decorate([
3212
- Output(),
3213
- __metadata("design:type", Object)
3214
- ], FilterComponent.prototype, "opened", void 0);
3215
- __decorate([
3216
- Output(),
3217
- __metadata("design:type", Object)
3218
- ], FilterComponent.prototype, "ready", void 0);
3219
- __decorate([
3220
- ContentChild(FilterStatusBarDirective, { read: TemplateRef }),
3221
- __metadata("design:type", Object)
3222
- ], FilterComponent.prototype, "statusBar", void 0);
3223
- __decorate([
3224
- ViewChild('searchTextInput'),
3225
- __metadata("design:type", ElementRef)
3226
- ], FilterComponent.prototype, "searchTextInput", void 0);
3227
- __decorate([
3228
- ViewChild('searchTextInput', { read: MatInput }),
3229
- __metadata("design:type", MatInput)
3230
- ], FilterComponent.prototype, "searchTextMatInput", void 0);
3231
- __decorate([
3232
- HostBinding('class.filters-open'),
3233
- __metadata("design:type", Object)
3234
- ], FilterComponent.prototype, "showFilterMenu", void 0);
3235
- __decorate([
3236
- HostBinding('class.window-desktop'),
3237
- __metadata("design:type", Object)
3238
- ], FilterComponent.prototype, "windowDesktop", void 0);
3239
- __decorate([
3240
- HostBinding('class.fs-filter'),
3241
- __metadata("design:type", Object)
3242
- ], FilterComponent.prototype, "fsFilterClass", void 0);
3243
- FilterComponent = __decorate([
3244
- Component({
3245
- selector: 'fs-filter',
3246
- template: "<ng-container *ngIf=\"hasKeyword; else noKeywordFilter\">\n <div class=\"filter-search-container\">\n <div class=\"filter-input-field\">\n <form autocomplete=\"off\" role=\"presentation\" *ngIf=\"keywordVisible$ | async\">\n <mat-form-field floatLabel=\"never\">\n <span matPrefix>\n <mat-icon matPrefix>search</mat-icon>\n </span>\n\n <input\n #searchTextInput\n matInput\n [formControl]=\"searchText\"\n [placeholder]=\"searchPlaceholder\"\n name=\"filter-input\"\n (click)=\"filterInputEvent($event)\"\n class=\"filter-input\">\n\n <a matSuffix\n *ngIf=\"searchText.value && showFilterInput && config.clear\"\n (click)=\"clearSearchText($event)\"\n href=\"javascript:void(0)\"\n class=\"clear\">\n <mat-icon>clear</mat-icon>\n </a>\n\n <a matSuffix\n (click)=\"reload($event)\"\n class=\"reload\"\n *ngIf=\"config.reload\">\n <mat-icon>refresh</mat-icon>\n </a>\n </mat-form-field>\n </form>\n </div>\n <ng-container *ngTemplateOutlet=\"filterActions\"></ng-container>\n </div>\n <div class=\"status-actions\" *ngIf=\"keywordVisible$ | async\">\n <ng-container *ngTemplateOutlet=\"statusBarContainer\"></ng-container>\n <ng-container *ngTemplateOutlet=\"filterChips\"></ng-container>\n </div>\n</ng-container>\n\n<ng-template #noKeywordFilter>\n <div class=\"filter-searchless-container\">\n <div class=\"status-actions\">\n <ng-container *ngTemplateOutlet=\"statusBarContainer\"></ng-container>\n <ng-container *ngTemplateOutlet=\"filterChips\"></ng-container>\n </div>\n <ng-container *ngTemplateOutlet=\"filterActions\"></ng-container>\n </div>\n</ng-template>\n\n\n<ng-template #filterActions>\n <div class=\"filter-actions\">\n <ng-container *ngIf=\"hasVisibleItemOrSorting && filtersBtnVisible$ | async\">\n <button\n mat-button\n class=\"filters-button\"\n [ngClass]=\"{\n 'mat-raised-button': config.button.style == 'raised',\n 'mat-button': config.button.style == 'basic',\n 'mat-icon-button': config.button.style == 'icon'\n }\"\n (click)=\"changeVisibilityClick(!showFilterMenu, $event)\"\n type=\"button\"\n [color]=\"config.button.color\">\n <mat-icon *ngIf=\"config.button.icon\">{{config.button.icon}}</mat-icon>\n {{ config.button.label }}\n </button>\n </ng-container>\n\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 #filterChips>\n <fs-filter-chips\n *ngIf=\"config.chips && hasFilterChips$ | async\"\n class=\"filter-chips\"\n [filters]=\"items\">\n </fs-filter-chips>\n</ng-template>\n\n<ng-template #statusBarContainer>\n <div class=\"status-bar\" *ngIf=\"statusBar\">\n <small><ng-container *ngTemplateOutlet=\"statusBar\"></ng-container></small>\n </div>\n</ng-template>\n",
3247
- encapsulation: ViewEncapsulation.None,
3248
- providers: [
3249
- FsFilterOverlayService,
3250
- ExternalParamsController,
3251
- PersistanceParamsController,
3252
- QueryParamsController,
3253
- FocusControllerService,
3254
- FsFilterItemsStore,
3255
- SavedFiltersController,
3256
- ActionsController,
3257
- ],
3258
- changeDetection: ChangeDetectionStrategy.OnPush,
3259
- styles: ["fs-filter{display:block}.fs-filter{margin-bottom:20px;display:block}.fs-filter .results{min-height:90px;position:relative;overflow-x:auto;overflow-y:hidden}.fs-filter .status-bar{overflow:hidden;text-overflow:ellipsis;line-height:17px;margin:4px 0}.fs-filter .filter-chips{display:block}.fs-filter .filter-searchless-container{display:flex}.fs-filter .filter-searchless-container .status-actions{flex-grow:1}.fs-filter .filter-searchless-container .status-actions>:first-child{margin-top:0}.fs-filter fs-filter-chips{margin:5px 0}.fs-filter .filter-search-container{flex-direction:row;box-sizing:border-box;display:flex;flex:1 1 0;position:relative}.fs-filter .filter-search-container .search{top:8px;position:absolute;margin-left:1px;left:0}.fs-filter .filter-search-container .search mat-icon{transform:scale(.9)}.fs-filter .filter-search-container form{width:100%;height:100%}.fs-filter .filter-search-container .filter-input-field{flex-direction:row;box-sizing:border-box;display:flex;align-items:center;flex:1}.fs-filter .filter-search-container .filter-input-field .mat-form-field{width:100%;height:100%;font-size:103%}.fs-filter .filter-search-container .filter-input-field .mat-form-field .mat-form-field-underline{bottom:auto}.fs-filter .filter-search-container .filter-input-field .mat-form-field .mat-form-field-infix{border-top:0}.fs-filter .filter-search-container .filter-input-field .mat-form-field .mat-form-field-wrapper{padding-bottom:0;height:100%}.fs-filter .filter-search-container .filter-input-field .mat-form-field .mat-form-field-flex{align-items:center;height:100%}.fs-filter .filter-search-container .filter-input-field .mat-form-field-prefix,.fs-filter .filter-search-container .filter-input-field .mat-form-field-suffix{-ms-grid-row-align:center;align-self:center;display:flex;align-items:center;white-space:nowrap}.fs-filter .filter-search-container .filter-input-field .mat-form-field-prefix a,.fs-filter .filter-search-container .filter-input-field .mat-form-field-prefix mat-icon,.fs-filter .filter-search-container .filter-input-field .mat-form-field-suffix a,.fs-filter .filter-search-container .filter-input-field .mat-form-field-suffix mat-icon{display:flex;cursor:pointer;color:initial}.fs-filter .filter-search-container .filter-input-field .mat-form-field-prefix a:hover,.fs-filter .filter-search-container .filter-input-field .mat-form-field-prefix mat-icon:hover,.fs-filter .filter-search-container .filter-input-field .mat-form-field-suffix a:hover,.fs-filter .filter-search-container .filter-input-field .mat-form-field-suffix mat-icon:hover{color:inherit}.fs-filter .filter-search-container .filter-input-field .mat-form-field-infix{width:auto}.fs-filter .filter-actions{display:flex;align-items:center}.fs-filter button.reload{margin-left:-40px;right:-9px}@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:0 0}"]
3260
- }),
3261
- __param(5, Optional()), __param(5, Inject(FS_FILTER_CONFIG)),
3262
- __metadata("design:paramtypes", [FsFilterOverlayService,
3263
- NgZone,
3264
- ExternalParamsController,
3265
- FsFilterItemsStore,
3266
- ActionsController,
3267
- FsFilterConfig])
3268
- ], FilterComponent);
3362
+ }
3363
+ FsFilterActionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFilterActionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3364
+ FsFilterActionsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsFilterActionsComponent, selector: "fs-filter-actions", inputs: { kebabActions: "kebabActions", actions: "actions" }, ngImport: i0, template: "<!-- Buttons -->\n<ng-container *ngFor=\"let action of actions\">\n\n <ng-container [ngSwitch]=\"action.mode\">\n <ng-container *ngSwitchCase=\"'button'\">\n <fs-filter-action-button [action]=\"action\"></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 </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 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 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 <fs-filter-action-button [action]=\"action\"></fs-filter-action-button>\n </fs-file>\n </ng-container>\n </ng-container>\n</ng-container>\n<!-- /Buttons -->\n\n<!-- menu -->\n<ng-container *ngIf=\"kebabActions?.length\">\n <fs-filter-action-kebab-actions [kebabActions]=\"kebabActions\"></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"], outputs: ["opened", "closed"] }, { type: i2$3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i4$3.FsFileComponent, selector: "fs-file", inputs: ["minHeight", "minWidth", "multiple", "capture", "allowClick", "allowDrop", "accept", "disabled", "imageWidth", "imageHeight", "imageQuality"], outputs: ["select", "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: 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]", inputs: ["fsClass", "class", "id", "label", "hidden", "groupHidden", "dismissAfterClick", "link", "target", "queryParams"], outputs: ["click"] }], pipes: { "async": i3.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
3365
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFilterActionsComponent, decorators: [{
3366
+ type: Component,
3367
+ args: [{
3368
+ selector: 'fs-filter-actions',
3369
+ templateUrl: './actions.component.html',
3370
+ styleUrls: [
3371
+ './actions.component.scss',
3372
+ ],
3373
+ changeDetection: ChangeDetectionStrategy.OnPush,
3374
+ }]
3375
+ }], propDecorators: { kebabActions: [{
3376
+ type: Input
3377
+ }], actions: [{
3378
+ type: Input
3379
+ }] } });
3269
3380
 
3270
- let FilterItemComponent = class FilterItemComponent {
3381
+ class FsFilterChipContentComponent {
3271
3382
  constructor(_cdRef) {
3272
3383
  this._cdRef = _cdRef;
3273
3384
  this._destroy$ = new Subject();
3274
- this.itemType = ItemType;
3275
3385
  }
3276
3386
  ngOnInit() {
3277
- this.item.value$
3278
- .pipe(takeUntil(this._destroy$))
3279
- .subscribe(() => {
3280
- this._cdRef.markForCheck();
3281
- });
3387
+ this.listenValueChangesForRanges();
3282
3388
  }
3283
3389
  ngOnDestroy() {
3284
3390
  this._destroy$.next();
3285
3391
  this._destroy$.complete();
3286
3392
  }
3287
- };
3288
- FilterItemComponent.ctorParameters = () => [
3289
- { type: ChangeDetectorRef }
3290
- ];
3291
- __decorate([
3292
- Input(),
3293
- __metadata("design:type", BaseItem)
3294
- ], FilterItemComponent.prototype, "item", void 0);
3295
- FilterItemComponent = __decorate([
3296
- Component({
3297
- selector: 'filter-item',
3298
- template: "<div class=\"filter filter-{{ item.type }}\">\n\n <ng-container [ngSwitch]=\"item.type\">\n <filter-item-text class=\"interface\"\n *ngSwitchCase=\"itemType.Text\"\n [item]=\"item\">\n </filter-item-text>\n\n <filter-item-select class=\"interface\"\n *ngSwitchCase=\"itemType.Select\"\n [item]=\"item\">\n </filter-item-select>\n\n <filter-item-chips class=\"interface\"\n *ngSwitchCase=\"itemType.Chips\"\n [item]=\"item\">\n </filter-item-chips>\n\n <filter-item-range class=\"interface interface-range\"\n *ngSwitchCase=\"itemType.Range\"\n [item]=\"item\">\n </filter-item-range>\n\n <filter-item-autocomplete class=\"interface\"\n *ngSwitchCase=\"itemType.AutoComplete\"\n [item]=\"item\">\n </filter-item-autocomplete>\n\n <filter-item-autocompletechips class=\"interface\"\n *ngSwitchCase=\"itemType.AutoCompleteChips\"\n [item]=\"item\">\n </filter-item-autocompletechips>\n\n <filter-item-date class=\"interface interface-date\"\n *ngSwitchCase=\"itemType.Date\"\n [item]=\"item\">\n </filter-item-date>\n\n <filter-item-date class=\"interface interface-date\"\n *ngSwitchCase=\"itemType.DateTime\"\n [item]=\"item\">\n </filter-item-date>\n\n <filter-item-date-range class=\"interface interface-date\"\n *ngSwitchCase=\"itemType.DateRange\"\n [item]=\"item\">\n </filter-item-date-range>\n\n <filter-item-date-range class=\"interface interface-date\"\n *ngSwitchCase=\"itemType.DateTimeRange\"\n [item]=\"item\">\n </filter-item-date-range>\n\n <filter-item-checkbox class=\"interface interface-checkbox\"\n *ngSwitchCase=\"itemType.Checkbox\"\n [item]=\"item\">\n </filter-item-checkbox>\n </ng-container>\n\n</div>\n",
3299
- changeDetection: ChangeDetectionStrategy.OnPush
3300
- }),
3301
- __metadata("design:paramtypes", [ChangeDetectorRef])
3302
- ], FilterItemComponent);
3303
-
3304
- let BaseItemComponent = class BaseItemComponent {
3305
- constructor(_kvDiffers, _cd) {
3306
- this._kvDiffers = _kvDiffers;
3307
- this._cd = _cd;
3308
- this.inline = false;
3309
- this._destroy$ = new Subject();
3310
- this._debouncer$ = new Subject();
3311
- this._kvDiffer = this._kvDiffers.find(this.item || {}).create();
3312
- this.listenWithDebounce();
3393
+ listenValueChangesForRanges() {
3394
+ this.item.value$
3395
+ .pipe(takeUntil(this._destroy$))
3396
+ .subscribe(() => {
3397
+ this.content = this._getContent();
3398
+ this._cdRef.detectChanges();
3399
+ });
3313
3400
  }
3314
- set item(value) {
3315
- this._item = value;
3401
+ _getContent() {
3402
+ const result = this.item.getChipsContent(this.type);
3403
+ if (this.item.chipLabel !== undefined) {
3404
+ if (this.item.chipLabel === '') {
3405
+ return `${result}`;
3406
+ }
3407
+ else {
3408
+ if (Array.isArray(this.item.chipLabel)) {
3409
+ const label = getLabelFromArray(this.item.chipLabel, this.type);
3410
+ return `${label}: ${result}`;
3411
+ }
3412
+ else {
3413
+ return `${this.item.chipLabel}: ${result}`;
3414
+ }
3415
+ }
3416
+ }
3417
+ else {
3418
+ if (Array.isArray(this.item.label)) {
3419
+ const label = getLabelFromArray(this.item.label, this.type);
3420
+ return `${label}: ${result}`;
3421
+ }
3422
+ else {
3423
+ if (this.item.isTypeCheckbox) {
3424
+ return result;
3425
+ }
3426
+ else {
3427
+ return `${this.item.label}: ${result}`;
3428
+ }
3429
+ }
3430
+ }
3316
3431
  }
3317
- ;
3318
- get item() {
3319
- return this._item;
3432
+ }
3433
+ FsFilterChipContentComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFilterChipContentComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
3434
+ FsFilterChipContentComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsFilterChipContentComponent, selector: "fs-filter-chip-content", inputs: { item: "item", type: "type" }, ngImport: i0, template: "{{ content }}\n", styles: [""], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3435
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFilterChipContentComponent, decorators: [{
3436
+ type: Component,
3437
+ args: [{
3438
+ selector: 'fs-filter-chip-content',
3439
+ templateUrl: './filter-chip-content.component.html',
3440
+ styleUrls: ['./filter-chip-content.component.scss'],
3441
+ changeDetection: ChangeDetectionStrategy.OnPush,
3442
+ }]
3443
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { item: [{
3444
+ type: Input
3445
+ }], type: [{
3446
+ type: Input
3447
+ }] } });
3448
+ function getLabelFromArray(labelArr, type) {
3449
+ if (type === 'from' && labelArr[0]) {
3450
+ return `${labelArr[0]}`;
3320
3451
  }
3321
- ngDoCheck() {
3322
- if (this._kvDiffer) {
3323
- const changes = this._kvDiffer.diff(this.item);
3324
- if (changes) {
3325
- this._cd.detectChanges();
3326
- }
3452
+ else if (type === 'to' && labelArr[1]) {
3453
+ return `${labelArr[1]}`;
3454
+ }
3455
+ else {
3456
+ return '';
3457
+ }
3458
+ }
3459
+
3460
+ class FsFilterChipComponent {
3461
+ constructor(_cdRef, _focusController) {
3462
+ this._cdRef = _cdRef;
3463
+ this._focusController = _focusController;
3464
+ this._chipRenderTimer$ = timer(500)
3465
+ .pipe(mapTo(true));
3466
+ this._destroy$ = new Subject();
3467
+ }
3468
+ ngOnInit() {
3469
+ this.rangeItem = this.item.isTypeDateRange
3470
+ || this.item.isTypeRange
3471
+ || this.item.isTypeDateTimeRange;
3472
+ this.listenValueChangesForRanges();
3473
+ this._updateVisibility();
3474
+ if (this.item.hasPendingValues) {
3475
+ this.item.loadAsyncValues(false);
3476
+ this.item.values$
3477
+ .pipe(take(2), takeUntil(this._destroy$))
3478
+ .subscribe(() => {
3479
+ this._updateVisibility();
3480
+ this._cdRef.markForCheck();
3481
+ });
3482
+ this._initDelayRender();
3327
3483
  }
3328
3484
  }
3329
3485
  ngOnDestroy() {
3330
3486
  this._destroy$.next();
3331
3487
  this._destroy$.complete();
3332
3488
  }
3333
- listenWithDebounce() {
3334
- this._debouncer$
3335
- .pipe(debounceTime(150), takeUntil(this._destroy$))
3489
+ focusOnItem(type = null) {
3490
+ this._focusController.click(this.item, type);
3491
+ }
3492
+ removeItem(event, type = null) {
3493
+ if (this.item instanceof RangeItem) {
3494
+ this.item.clearRange(type);
3495
+ }
3496
+ else if (this.item instanceof DateRangeItem || this.item instanceof DateTimeRangeItem) {
3497
+ this.item.clearDateRange(type);
3498
+ }
3499
+ else {
3500
+ this.item.clear();
3501
+ }
3502
+ }
3503
+ listenValueChangesForRanges() {
3504
+ this.item.value$
3505
+ .pipe(distinctUntilChanged(), takeUntil(this._destroy$))
3336
3506
  .subscribe(() => {
3337
- this.item.valueChanged();
3507
+ this._updateVisibility();
3508
+ this._cdRef.markForCheck();
3338
3509
  });
3339
3510
  }
3340
- itemChange() {
3341
- this._debouncer$.next();
3342
- }
3343
- };
3344
- BaseItemComponent.ctorParameters = () => [
3345
- { type: KeyValueDiffers },
3346
- { type: ChangeDetectorRef }
3347
- ];
3348
- __decorate([
3349
- Input(),
3350
- __metadata("design:type", Object),
3351
- __metadata("design:paramtypes", [Object])
3352
- ], BaseItemComponent.prototype, "item", null);
3353
- __decorate([
3354
- Input(),
3355
- __metadata("design:type", Object)
3356
- ], BaseItemComponent.prototype, "inline", void 0);
3357
- BaseItemComponent = __decorate([
3358
- Component({
3359
- selector: 'base-item',
3360
- template: '',
3361
- changeDetection: ChangeDetectionStrategy.OnPush
3362
- }),
3363
- __metadata("design:paramtypes", [KeyValueDiffers,
3364
- ChangeDetectorRef])
3365
- ], BaseItemComponent);
3366
-
3367
- let SelectComponent = class SelectComponent extends BaseItemComponent {
3368
- constructor(_kvDiffers, _cd) {
3369
- super(_kvDiffers, _cd);
3370
- this._kvDiffers = _kvDiffers;
3371
- this._cd = _cd;
3372
- // For case when we have multiple selection with __all option
3373
- // If _all has been selected than we must disable all other items
3374
- this.allItemsOptionSelected = false;
3511
+ _updateVisibility() {
3512
+ this.itemVisible = this.item.isChipVisible;
3375
3513
  }
3376
- ngDoCheck() {
3377
- if (this._kvDiffer) {
3378
- const changes = this._kvDiffer.diff(this.item);
3379
- if (changes) {
3380
- this._cd.markForCheck();
3381
- if (this.selectedItem) {
3382
- this.selectedItem.cd.markForCheck();
3383
- }
3384
- }
3385
- }
3514
+ _initDelayRender() {
3515
+ this.chipDelayedRender$ = combineLatest([
3516
+ this.item.values$,
3517
+ this._chipRenderTimer$.pipe(startWith(false))
3518
+ ])
3519
+ .pipe(map(([values, timerValue]) => {
3520
+ return !!values || timerValue;
3521
+ }));
3386
3522
  }
3387
- };
3388
- SelectComponent.ctorParameters = () => [
3389
- { type: KeyValueDiffers },
3390
- { type: ChangeDetectorRef }
3391
- ];
3392
- __decorate([
3393
- ViewChild('selectItem'),
3394
- __metadata("design:type", Object)
3395
- ], SelectComponent.prototype, "selectedItem", void 0);
3396
- SelectComponent = __decorate([
3397
- Component({
3398
- selector: 'filter-item-select',
3399
- 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=\"(item.values$ | async)?.length\">\n <ng-container *ngIf=\"item.multiple && !item.children\">\n <filter-item-select-multiple\n [item]=\"item\"\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]=\"item\"\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",
3400
- changeDetection: ChangeDetectionStrategy.OnPush
3401
- }),
3402
- __metadata("design:paramtypes", [KeyValueDiffers,
3403
- ChangeDetectorRef])
3404
- ], SelectComponent);
3523
+ }
3524
+ FsFilterChipComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFilterChipComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: FocusControllerService }], target: i0.ɵɵFactoryTarget.Component });
3525
+ FsFilterChipComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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.clearAllowed\"\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.clearAllowed\"\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.clearAllowed\"\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$1.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 });
3526
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFilterChipComponent, decorators: [{
3527
+ type: Component,
3528
+ args: [{
3529
+ selector: 'fs-filter-chip',
3530
+ templateUrl: './filter-chip.component.html',
3531
+ styleUrls: ['./filter-chip.component.scss'],
3532
+ changeDetection: ChangeDetectionStrategy.OnPush,
3533
+ }]
3534
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: FocusControllerService }]; }, propDecorators: { item: [{
3535
+ type: Input
3536
+ }] } });
3405
3537
 
3406
- let SelectGroupsComponent = class SelectGroupsComponent {
3407
- constructor(cd) {
3408
- this.cd = cd;
3409
- }
3410
- compare(o1, o2) {
3411
- return o1 == o2;
3538
+ class FsFilterChipsComponent {
3539
+ constructor() {
3540
+ this.chips = [];
3412
3541
  }
3413
- };
3414
- SelectGroupsComponent.ctorParameters = () => [
3415
- { type: ChangeDetectorRef }
3416
- ];
3417
- __decorate([
3418
- ViewChild('select', { static: true }),
3419
- __metadata("design:type", MatSelect)
3420
- ], SelectGroupsComponent.prototype, "select", void 0);
3421
- __decorate([
3422
- Input(),
3423
- __metadata("design:type", Object)
3424
- ], SelectGroupsComponent.prototype, "item", void 0);
3425
- SelectGroupsComponent = __decorate([
3426
- Component({
3427
- selector: 'filter-item-select-groups',
3428
- 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",
3429
- changeDetection: ChangeDetectionStrategy.OnPush
3430
- }),
3431
- __metadata("design:paramtypes", [ChangeDetectorRef])
3432
- ], SelectGroupsComponent);
3542
+ }
3543
+ FsFilterChipsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFilterChipsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3544
+ FsFilterChipsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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) !== null\">\n <fs-filter-chip [item]=\"item\"></fs-filter-chip>\n </ng-container>\n </ng-container>\n</fs-chips>\n", styles: [""], components: [{ type: i2$1.FsChipsComponent, selector: "fs-chips", inputs: ["compare", "multiple"] }, { type: FsFilterChipComponent, selector: "fs-filter-chip", inputs: ["item"] }], directives: [{ type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { 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 });
3545
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFilterChipsComponent, decorators: [{
3546
+ type: Component,
3547
+ args: [{
3548
+ selector: 'fs-filter-chips',
3549
+ templateUrl: './filter-chips.component.html',
3550
+ styleUrls: ['./filter-chips.component.scss'],
3551
+ changeDetection: ChangeDetectionStrategy.OnPush,
3552
+ }]
3553
+ }], propDecorators: { filters: [{
3554
+ type: Input
3555
+ }] } });
3433
3556
 
3434
- let SelectSimpleComponent = class SelectSimpleComponent {
3435
- constructor(cd) {
3436
- this.cd = cd;
3557
+ class FilterComponent {
3558
+ constructor(_filterOverlay, _zone, _externalParams, _filterItems, _actions, _defaultConfig) {
3559
+ this._filterOverlay = _filterOverlay;
3560
+ this._zone = _zone;
3561
+ this._externalParams = _externalParams;
3562
+ this._filterItems = _filterItems;
3563
+ this._actions = _actions;
3564
+ this._defaultConfig = _defaultConfig;
3565
+ this.showSortBy = true;
3566
+ this.showFilterInput = true;
3567
+ this.closed = new EventEmitter();
3568
+ this.opened = new EventEmitter();
3569
+ this.ready = new EventEmitter();
3570
+ this.showFilterMenu = false;
3571
+ this.windowDesktop = false;
3572
+ this.fsFilterClass = true;
3573
+ this.searchText = new FormControl();
3574
+ this.searchPlaceholder = 'Search';
3575
+ this._config = null;
3576
+ this._filtersBtnVisible$ = new BehaviorSubject(true);
3577
+ this._keywordVisible$ = new BehaviorSubject(true);
3578
+ this._hasFilterChips$ = new BehaviorSubject(false);
3579
+ this._destroy$ = new Subject();
3580
+ this._listenWhenFilterReady();
3581
+ this._updateWindowWidth();
3582
+ this._filterOverlay.attach$
3583
+ .pipe(takeUntil(this._destroy$))
3584
+ .subscribe(() => {
3585
+ this.showFilterMenu = true;
3586
+ });
3587
+ this._filterOverlay.detach$
3588
+ .pipe(takeUntil(this._destroy$))
3589
+ .subscribe(() => {
3590
+ this.showFilterMenu = false;
3591
+ });
3592
+ this._listenWindowResize();
3437
3593
  }
3438
- changed() {
3439
- if (this.item.isolate) {
3440
- this.item.isolate.enabled = false;
3441
- }
3594
+ set setConfig(config) {
3595
+ this._initFilterWithConfig(config);
3442
3596
  }
3443
- isolateChange(filter) {
3444
- if (filter.isolate.enabled) {
3445
- filter.model = filter.isolate.value;
3446
- }
3447
- else {
3448
- filter.model = null;
3449
- }
3597
+ set setFilter(config) {
3598
+ this._initFilterWithConfig(config);
3450
3599
  }
3451
- };
3452
- SelectSimpleComponent.ctorParameters = () => [
3453
- { type: ChangeDetectorRef }
3454
- ];
3455
- __decorate([
3456
- Input(),
3457
- __metadata("design:type", SimpleSelectItem)
3458
- ], SelectSimpleComponent.prototype, "item", void 0);
3459
- __decorate([
3460
- ViewChild('select', { static: true }),
3461
- __metadata("design:type", MatSelect)
3462
- ], SelectSimpleComponent.prototype, "select", void 0);
3463
- SelectSimpleComponent = __decorate([
3464
- Component({
3465
- selector: 'filter-item-select-simple',
3466
- 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",
3467
- changeDetection: ChangeDetectionStrategy.OnPush,
3468
- styles: [".isolate{margin-bottom:25px}"]
3469
- }),
3470
- __metadata("design:paramtypes", [ChangeDetectorRef])
3471
- ], SelectSimpleComponent);
3472
-
3473
- let SelectMultipleComponent = class SelectMultipleComponent {
3474
- constructor(cd) {
3475
- this.cd = cd;
3600
+ get config() {
3601
+ return this._config;
3476
3602
  }
3477
- changed() {
3478
- if (this.item.isolate) {
3479
- this.item.isolate.enabled = false;
3480
- if (this.item.multiple && Array.isArray(this.item.model)) {
3481
- const index = this.item.model.indexOf(this.item.isolate.value);
3482
- if (index > -1) {
3483
- this.item.model.splice(index, 1);
3484
- }
3485
- }
3486
- }
3603
+ get filterParams() {
3604
+ return this._filterItems.values();
3487
3605
  }
3488
- close() {
3489
- this.select.close();
3606
+ get filterParamsQuery() {
3607
+ return this._filterItems.valuesAsQuery();
3490
3608
  }
3491
- isolateChange(filter) {
3492
- if (filter.isolate.enabled) {
3493
- filter.model = filter.multiple ? [filter.isolate.value] : filter.isolate.value;
3494
- }
3495
- else {
3496
- if (filter.multiple) {
3497
- filter.model = filter.defaultValue ? filter.defaultValue : [];
3498
- }
3499
- else {
3500
- filter.model = filter.defaultValue ? filter.defaultValue : null;
3501
- }
3502
- }
3609
+ get items() {
3610
+ return this._filterItems.items;
3503
3611
  }
3504
- };
3505
- SelectMultipleComponent.ctorParameters = () => [
3506
- { type: ChangeDetectorRef }
3507
- ];
3508
- __decorate([
3509
- Input(),
3510
- __metadata("design:type", Object)
3511
- ], SelectMultipleComponent.prototype, "item", void 0);
3512
- __decorate([
3513
- ViewChild('select', { static: true }),
3514
- __metadata("design:type", MatSelect)
3515
- ], SelectMultipleComponent.prototype, "select", void 0);
3516
- SelectMultipleComponent = __decorate([
3517
- Component({
3518
- selector: 'filter-item-select-multiple',
3519
- 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",
3520
- changeDetection: ChangeDetectionStrategy.OnPush,
3521
- styles: [".isolate{margin-bottom:25px}"]
3522
- }),
3523
- __metadata("design:paramtypes", [ChangeDetectorRef])
3524
- ], SelectMultipleComponent);
3525
-
3526
- let ChipsComponent = class ChipsComponent extends BaseItemComponent {
3527
- constructor(_kvDiffers, _cd) {
3528
- super(_kvDiffers, _cd);
3529
- this._kvDiffers = _kvDiffers;
3530
- this._cd = _cd;
3612
+ get visibleItems() {
3613
+ return this._filterItems.visibleItems;
3531
3614
  }
3532
- modelChange() {
3533
- this.itemChange();
3615
+ get itemsReady$() {
3616
+ return this._filterItems.ready$;
3534
3617
  }
3535
- compareFn(modelValue, chipValue) {
3536
- return modelValue.value === chipValue.value;
3618
+ get hasFilterChips$() {
3619
+ return this._hasFilterChips$.asObservable();
3537
3620
  }
3538
- };
3539
- ChipsComponent.ctorParameters = () => [
3540
- { type: KeyValueDiffers },
3541
- { type: ChangeDetectorRef }
3542
- ];
3543
- ChipsComponent = __decorate([
3544
- Component({
3545
- selector: 'filter-item-chips',
3546
- 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",
3547
- changeDetection: ChangeDetectionStrategy.OnPush,
3548
- styles: ["fs-chip{line-height:40px}"]
3549
- }),
3550
- __metadata("design:paramtypes", [KeyValueDiffers,
3551
- ChangeDetectorRef])
3552
- ], ChipsComponent);
3553
-
3554
- let TextComponent = class TextComponent extends BaseItemComponent {
3555
- constructor(_kvDiffers, _cd) {
3556
- super(_kvDiffers, _cd);
3557
- this._kvDiffers = _kvDiffers;
3558
- this._cd = _cd;
3559
- this.textControl = new FormControl();
3560
- this.destroy$ = new Subject();
3621
+ get hasVisibleItemOrSorting() {
3622
+ return this.visibleItems.length > 0 || !!this._filterItems.sortByItem;
3561
3623
  }
3562
- ngOnInit() {
3563
- this._listenControlValueChanges();
3564
- this._listenModelChanges();
3624
+ get hasKeyword() {
3625
+ return this._filterItems.hasKeyword;
3565
3626
  }
3566
- ngOnDestroy() {
3567
- this.destroy$.next();
3568
- this.destroy$.complete();
3627
+ get filtersBtnVisible$() {
3628
+ return this._filtersBtnVisible$.asObservable();
3569
3629
  }
3570
- _listenControlValueChanges() {
3571
- this.textControl.valueChanges
3572
- .pipe(distinctUntilChanged(), debounceTime(200), takeUntil(this.destroy$))
3573
- .subscribe((value) => {
3574
- this.item.model = value;
3575
- });
3630
+ get keywordVisible$() {
3631
+ return this._keywordVisible$.asObservable();
3576
3632
  }
3577
- _listenModelChanges() {
3578
- this._item.value$
3579
- .pipe(takeUntil(this.destroy$))
3580
- .subscribe(() => {
3581
- this.textControl.setValue(this.item.model, { emitEvent: false });
3582
- });
3633
+ get actionsVisible$() {
3634
+ return this._actions.visible$;
3583
3635
  }
3584
- };
3585
- TextComponent.ctorParameters = () => [
3586
- { type: KeyValueDiffers },
3587
- { type: ChangeDetectorRef }
3588
- ];
3589
- TextComponent = __decorate([
3590
- Component({
3591
- selector: 'filter-item-text',
3592
- 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",
3593
- changeDetection: ChangeDetectionStrategy.OnPush,
3594
- styles: [""]
3595
- }),
3596
- __metadata("design:paramtypes", [KeyValueDiffers,
3597
- ChangeDetectorRef])
3598
- ], TextComponent);
3599
-
3600
- let RangeComponent = class RangeComponent extends BaseItemComponent {
3601
- constructor(_kvDiffers, _cd) {
3602
- super(_kvDiffers, _cd);
3603
- this._kvDiffers = _kvDiffers;
3604
- this._cd = _cd;
3636
+ get actions$() {
3637
+ return this._actions.actions$;
3638
+ }
3639
+ get menuActions$() {
3640
+ return this._actions.menuActions$;
3605
3641
  }
3606
3642
  ngOnInit() {
3607
- this.listenChanges();
3643
+ // Avoid ngChanges error
3644
+ setTimeout(() => {
3645
+ if (this.config.autofocus) {
3646
+ this.focus();
3647
+ }
3648
+ });
3649
+ this._listenInternalItemsChange();
3650
+ this._initOverlay();
3608
3651
  }
3609
- listenChanges() {
3610
- const fromListener = fromEvent(this.from.nativeElement, 'keyup')
3611
- .pipe(distinctUntilChanged());
3612
- const toListener = fromEvent(this.to.nativeElement, 'keyup')
3613
- .pipe(distinctUntilChanged());
3614
- merge(fromListener, toListener)
3615
- .pipe(takeUntil(this._destroy$))
3616
- .subscribe(() => {
3617
- this.itemChange();
3652
+ ngAfterViewInit() {
3653
+ this._listenInputKeyEvents();
3654
+ // FIXME prevent fire change after init
3655
+ setTimeout(() => {
3656
+ this._listenInputChanges();
3618
3657
  });
3619
3658
  }
3620
- };
3621
- RangeComponent.ctorParameters = () => [
3622
- { type: KeyValueDiffers },
3623
- { type: ChangeDetectorRef }
3624
- ];
3625
- __decorate([
3626
- ViewChild('from', { static: true }),
3627
- __metadata("design:type", ElementRef)
3628
- ], RangeComponent.prototype, "from", void 0);
3629
- __decorate([
3630
- ViewChild('to', { static: true }),
3631
- __metadata("design:type", Object)
3632
- ], RangeComponent.prototype, "to", void 0);
3633
- RangeComponent = __decorate([
3634
- Component({
3635
- selector: 'filter-item-range',
3636
- template: "<span fxLayout=\"row\">\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 matInput\n [fsFilterFocusTrigger]=\"item\"\n [focusTargetType]=\"'from'\"\n type=\"text\"\n inputmode=\"decimal\"\n [(ngModel)]=\"item.model.min\"\n fsMaskNumber\n [scale]=\"item.options?.scale || 2\"\n #from\n >\n <span matSuffix *ngIf=\"item.suffix\" [innerHtml]=\"item.suffix\"></span>\n </mat-form-field>\n <div class=\"spacer\"></div>\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 matInput\n [fsFilterFocusTrigger]=\"item\"\n [focusTargetType]=\"'to'\"\n type=\"text\"\n inputmode=\"decimal\"\n [(ngModel)]=\"item.model.max\"\n fsMaskNumber\n [scale]=\"item.options?.scale || 2\"\n #to\n >\n <span matSuffix *ngIf=\"item.suffix\" [innerHtml]=\"item.suffix\"></span>\n </mat-form-field>\n</span>\n",
3637
- changeDetection: ChangeDetectionStrategy.OnPush,
3638
- styles: [".spacer{width:15px}mat-form-field{min-width:initial;display:flex;width:auto}mat-form-field ::ng-deep .mat-form-field-infix{width:auto}"]
3639
- }),
3640
- __metadata("design:paramtypes", [KeyValueDiffers,
3641
- ChangeDetectorRef])
3642
- ], RangeComponent);
3643
-
3644
- let AutocompleteComponent = class AutocompleteComponent extends BaseItemComponent {
3645
- constructor(_kvDiffers, _cd) {
3646
- super(_kvDiffers, _cd);
3647
- this._kvDiffers = _kvDiffers;
3648
- this._cd = _cd;
3649
- this.displayWith = (data) => {
3650
- return data ? data.name : data;
3651
- };
3652
- this.fetch = (keyword) => {
3653
- return this.item.valuesFn(keyword);
3654
- };
3659
+ ngOnDestroy() {
3660
+ this._destroyFilterDrawer();
3661
+ this._destroy$.next();
3662
+ this._destroy$.complete();
3655
3663
  }
3656
- };
3657
- AutocompleteComponent.ctorParameters = () => [
3658
- { type: KeyValueDiffers },
3659
- { type: ChangeDetectorRef }
3660
- ];
3661
- AutocompleteComponent = __decorate([
3662
- Component({
3663
- selector: 'filter-item-autocomplete',
3664
- template: "<fs-autocomplete\n [fsFilterFocusTrigger]=\"item\"\n [fetch]=\"fetch\"\n [displayWith]=\"displayWith\"\n [(ngModel)]=\"item.model\"\n [placeholder]=\"item.label\"\n [fetchOnFocus]=\"item.fetchOnFocus\"\n [showClear]=\"item.clearAllowed\"\n name=\"item.name\">\n <ng-template fsAutocompleteTemplate let-data=\"data\">\n {{data.name}}\n </ng-template>\n</fs-autocomplete>\n",
3665
- changeDetection: ChangeDetectionStrategy.OnPush
3666
- }),
3667
- __metadata("design:paramtypes", [KeyValueDiffers,
3668
- ChangeDetectorRef])
3669
- ], AutocompleteComponent);
3670
-
3671
- let AutocompletechipsComponent = class AutocompletechipsComponent extends BaseItemComponent {
3672
- constructor(_kvDiffers, _cd) {
3673
- super(_kvDiffers, _cd);
3674
- this._kvDiffers = _kvDiffers;
3675
- this._cd = _cd;
3676
- this.fetch = (keyword) => {
3677
- return this.item.valuesFn(keyword);
3678
- };
3664
+ focus() {
3665
+ if (this.searchTextMatInput) {
3666
+ this.searchTextMatInput.focus();
3667
+ }
3679
3668
  }
3680
- // SP-T1747
3681
- clicked() {
3682
- this.chipBackground = this.item.chipBackground;
3683
- this.chipColor = this.item.chipColor;
3684
- this.chipIcon = this.item.chipIcon;
3685
- this._cd.markForCheck();
3669
+ updateSort(sort) {
3670
+ this._filterItems.updateSort(sort);
3686
3671
  }
3687
- addAutocompleteChipItem(event) {
3688
- if (event.data && this.item.model.indexOf(event.data.value) === -1) {
3689
- this.item.model.push(event.data);
3690
- this.itemChange();
3691
- }
3672
+ /**
3673
+ *
3674
+ * Do update value of some field
3675
+ *
3676
+ * @param values - values for update
3677
+ *
3678
+ * To update text value just pass new text value
3679
+ *
3680
+ * public updateSelectValue(val) {
3681
+ * this.filterEl.updateValues({ keyword: val });
3682
+ * }
3683
+ *
3684
+ * To update select or observable select you could pass suitable value
3685
+ *
3686
+ * public updateSelectValue(val: number) {
3687
+ * this.filterEl.updateValues({ simple_select: val }, { observable_select: val });
3688
+ * }
3689
+ *
3690
+ * To update checkbox value just pass true/false as value
3691
+ *
3692
+ * public updateCheckox(val: boolean) {
3693
+ * this.filterEl.updateValues({ checkbox: val });
3694
+ * }
3695
+ *
3696
+ * To update range value just pass object with min&max object or just with one of targets
3697
+ *
3698
+ * Ex.: { min: 10, max 15 }, { min: 5 }, { max 5 }
3699
+ *
3700
+ * public updateRange(val) {
3701
+ * this.filterEl.updateValues({ range: val });
3702
+ * }
3703
+ *
3704
+ * To update autocomplete just pass object with name/value fields
3705
+ *
3706
+ * Ex.: { name: 'John Doe', value: 1 }
3707
+ *
3708
+ * public updateAutocomplete(val) {
3709
+ * this.filterEl.updateValues({ autocomplete_user_id: val });
3710
+ * }
3711
+ *
3712
+ * To update autocompletechips just pass:
3713
+ *
3714
+ * 1) object with name/value fields - will be appended to existing set of values
3715
+ *
3716
+ * { name: 'John Doe', value: 1 }
3717
+ *
3718
+ * 2) array of objects - will be appended to existing set of values
3719
+ *
3720
+ * [{ name: 'John Doe', value: 1 }, { name: 'Darya Filipova', value: 2 }]
3721
+ *
3722
+ * 3) null - clear existing set of values
3723
+ *
3724
+ * public updateAutocomplete(val) {
3725
+ * this.filterEl.updateValues({ autocompletechips_user_id: val });
3726
+ * }
3727
+ *
3728
+ */
3729
+ updateValues(values) {
3730
+ Object.keys(values).forEach((key) => {
3731
+ const filterItem = this.items
3732
+ .find((item) => item.name === key);
3733
+ if (!filterItem) {
3734
+ return;
3735
+ }
3736
+ filterItem.model = values[key];
3737
+ });
3692
3738
  }
3693
- removeAutocompleteChipItem(event) {
3694
- remove(this.item.model, { value: event.data.value });
3695
- this.itemChange();
3739
+ hide() {
3740
+ this.changeVisibility(false);
3696
3741
  }
3697
- clearAutocompleteChipItem() {
3698
- this.item.clear();
3699
- this.itemChange();
3742
+ show() {
3743
+ this.changeVisibility(true);
3700
3744
  }
3701
- compareItems(item1, item2) {
3702
- return (item1 === null || item1 === void 0 ? void 0 : item1.value) === (item2 === null || item2 === void 0 ? void 0 : item2.value);
3745
+ changeVisibilityClick(value, event = null) {
3746
+ if (event) {
3747
+ event.stopPropagation();
3748
+ }
3749
+ this.changeVisibility(value);
3703
3750
  }
3704
- };
3705
- AutocompletechipsComponent.ctorParameters = () => [
3706
- { type: KeyValueDiffers },
3707
- { type: ChangeDetectorRef }
3708
- ];
3709
- AutocompletechipsComponent = __decorate([
3710
- Component({
3711
- selector: 'filter-item-autocompletechips',
3712
- 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 (click)=\"clicked()\"\n [allowText]=\"false\"\n [fetchOnFocus]=\"item.fetchOnFocus\"\n [placeholder]=\"item.label\"\n [chipImage]=\"item.chipImage\"\n [chipColor]=\"chipColor\"\n [chipIconColor]=\"chipIcon\"\n [chipBackground]=\"chipBackground\"\n [chipIcon]=\"item.chipIcon\"\n [chipClass]=\"item.chipClass\"\n [allowClear]=\"item.clearAllowed\"\n [removable]=\"item.clearAllowed\"\n [compareWith]=\"compareItems\"\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",
3713
- changeDetection: ChangeDetectionStrategy.OnPush
3714
- }),
3715
- __metadata("design:paramtypes", [KeyValueDiffers,
3716
- ChangeDetectorRef])
3717
- ], AutocompletechipsComponent);
3718
-
3719
- let DateComponent = class DateComponent extends BaseItemComponent {
3720
- constructor(_kvDiffers, _cd) {
3721
- super(_kvDiffers, _cd);
3722
- this._kvDiffers = _kvDiffers;
3723
- this._cd = _cd;
3724
- this.viewType = 'date';
3725
- this.itemDateMode = ItemDateMode;
3726
- this.showYear = true;
3727
- this.showMonth = true;
3728
- this.showDay = true;
3751
+ filterInputEvent(event) {
3752
+ if (!this.windowDesktop) {
3753
+ return;
3754
+ }
3755
+ if (['Enter', 'NumpadEnter', 'Escape'].indexOf(event.code) >= 0) {
3756
+ this.changeVisibility(false);
3757
+ if (this.searchTextInput) {
3758
+ this.searchTextInput.nativeElement.blur();
3759
+ }
3760
+ }
3729
3761
  }
3730
- ngOnInit() {
3731
- if (this.item.type === ItemType.DateTime) {
3732
- this.viewType = 'datetime';
3762
+ getItemValue(name) {
3763
+ const item = this.items
3764
+ .find((item) => item.name === name);
3765
+ if (item) {
3766
+ return item.model;
3767
+ }
3768
+ else {
3769
+ return null;
3770
+ }
3771
+ }
3772
+ showItem(name) {
3773
+ const item = this.getItem(name);
3774
+ if (item) {
3775
+ item.hide = false;
3776
+ this._filterItems.updateVisibleItems();
3733
3777
  }
3734
- else {
3735
- this.viewType = 'date';
3778
+ }
3779
+ hideItem(name) {
3780
+ const item = this.getItem(name);
3781
+ if (!item) {
3782
+ return;
3736
3783
  }
3737
- if (this.item.mode === ItemDateMode.ScrollMonthYear) {
3738
- this.showDay = false;
3784
+ item.hide = true;
3785
+ this._filterItems.updateVisibleItems();
3786
+ }
3787
+ clearItem(name) {
3788
+ const item = this.getItem(name);
3789
+ if (!item) {
3790
+ return;
3739
3791
  }
3792
+ item.clear();
3740
3793
  }
3741
- };
3742
- DateComponent.ctorParameters = () => [
3743
- { type: KeyValueDiffers },
3744
- { type: ChangeDetectorRef }
3745
- ];
3746
- DateComponent = __decorate([
3747
- Component({
3748
- selector: 'filter-item-date',
3749
- 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.clearAllowed\"\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.clearAllowed\"\n [name]=\"item.name\">\n <mat-placeholder *ngIf=\"inline\">{{ item.label }}</mat-placeholder>\n </mat-form-field>\n</ng-template>\n",
3750
- changeDetection: ChangeDetectionStrategy.OnPush
3751
- }),
3752
- __metadata("design:paramtypes", [KeyValueDiffers,
3753
- ChangeDetectorRef])
3754
- ], DateComponent);
3755
-
3756
- let DateRangeComponent = class DateRangeComponent extends BaseItemComponent {
3757
- constructor(_kvDiffers, _cd) {
3758
- super(_kvDiffers, _cd);
3759
- this._kvDiffers = _kvDiffers;
3760
- this._cd = _cd;
3761
- this.viewType = 'date';
3794
+ updateItemConfig(name, params) {
3795
+ var _a, _b;
3796
+ const item = this.getItem(name);
3797
+ if (!item) {
3798
+ return;
3799
+ }
3800
+ item.label = (_a = params.label) !== null && _a !== void 0 ? _a : item.label;
3801
+ item.chipLabel = (_b = params.chipLabel) !== null && _b !== void 0 ? _b : item.chipLabel;
3802
+ this._filterItems.updateVisibleItems();
3762
3803
  }
3763
- ngOnInit() {
3764
- if (this.item.type === ItemType.DateTimeRange) {
3765
- this.viewType = 'datetime';
3804
+ getItemValueChange$(name) {
3805
+ const item = this.items.find((i) => i.name === name);
3806
+ if (item) {
3807
+ return item.value$
3808
+ .pipe(map(() => {
3809
+ return item.model;
3810
+ }));
3766
3811
  }
3767
3812
  else {
3768
- this.viewType = 'date';
3813
+ return null;
3769
3814
  }
3770
3815
  }
3771
- };
3772
- DateRangeComponent.ctorParameters = () => [
3773
- { type: KeyValueDiffers },
3774
- { type: ChangeDetectorRef }
3775
- ];
3776
- DateRangeComponent = __decorate([
3777
- Component({
3778
- selector: 'filter-item-date-range',
3779
- 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.clearAllowed\"\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.clearAllowed\"\n [view]=\"viewType\"\n name=\"date_to\">\n</mat-form-field>\n",
3780
- changeDetection: ChangeDetectionStrategy.OnPush
3781
- }),
3782
- __metadata("design:paramtypes", [KeyValueDiffers,
3783
- ChangeDetectorRef])
3784
- ], DateRangeComponent);
3785
-
3786
- let CheckboxComponent = class CheckboxComponent extends BaseItemComponent {
3787
- constructor(_kvDiffers, _cd) {
3788
- super(_kvDiffers, _cd);
3789
- this._kvDiffers = _kvDiffers;
3790
- this._cd = _cd;
3816
+ changeVisibility(state) {
3817
+ if (state === this.showFilterMenu) {
3818
+ return;
3819
+ }
3820
+ if (!state) {
3821
+ this.closed.emit();
3822
+ return this._destroyFilterDrawer();
3823
+ }
3824
+ if (!this.hasVisibleItemOrSorting) {
3825
+ return;
3826
+ }
3827
+ this._listenEscButton();
3828
+ this.opened.emit();
3829
+ this._filterOverlay.open();
3791
3830
  }
3792
- };
3793
- CheckboxComponent.ctorParameters = () => [
3794
- { type: KeyValueDiffers },
3795
- { type: ChangeDetectorRef }
3796
- ];
3797
- CheckboxComponent = __decorate([
3798
- Component({
3799
- selector: 'filter-item-checkbox',
3800
- template: "<fs-label-field>\n <mat-checkbox [(ngModel)]=\"item.model\">\n {{ item.label }}\n </mat-checkbox>\n</fs-label-field>\n",
3801
- changeDetection: ChangeDetectionStrategy.OnPush,
3802
- styles: ["fs-label-field{margin:0}"]
3803
- }),
3804
- __metadata("design:paramtypes", [KeyValueDiffers,
3805
- ChangeDetectorRef])
3806
- ], CheckboxComponent);
3807
-
3808
- let FsFilterChipsComponent = class FsFilterChipsComponent {
3809
- constructor() {
3810
- this.chips = [];
3831
+ clearSearchText(event) {
3832
+ event.stopPropagation();
3833
+ this._filterItems.keywordItem.clear();
3834
+ this.searchTextInput.nativeElement.focus();
3811
3835
  }
3812
- };
3813
- __decorate([
3814
- Input(),
3815
- __metadata("design:type", Array)
3816
- ], FsFilterChipsComponent.prototype, "filters", void 0);
3817
- FsFilterChipsComponent = __decorate([
3818
- Component({
3819
- selector: 'fs-filter-chips',
3820
- template: "<fs-chips [(ngModel)]=\"chips\">\n <ng-container *ngFor=\"let item of filters\">\n <ng-container *ngIf=\"(item.value$ | async) !== null\">\n <fs-filter-chip [item]=\"item\"></fs-filter-chip>\n </ng-container>\n </ng-container>\n</fs-chips>\n",
3821
- changeDetection: ChangeDetectionStrategy.OnPush,
3822
- styles: [""]
3823
- })
3824
- ], FsFilterChipsComponent);
3825
-
3826
- let SelectBackdropComponent = class SelectBackdropComponent {
3827
- constructor() { }
3828
- };
3829
- SelectBackdropComponent = __decorate([
3830
- Component({
3831
- selector: 'filter-item-select-backdrop',
3832
- template: "",
3833
- changeDetection: ChangeDetectionStrategy.OnPush,
3834
- styles: [":host{position:absolute;top:0;bottom:0;right:0;z-index:1002;left:0}"]
3835
- }),
3836
- __metadata("design:paramtypes", [])
3837
- ], SelectBackdropComponent);
3838
-
3839
- let FsFilterChipComponent = class FsFilterChipComponent {
3840
- constructor(_cdRef, _focusController) {
3841
- this._cdRef = _cdRef;
3842
- this._focusController = _focusController;
3843
- this._chipRenderTimer$ = timer(500)
3844
- .pipe(mapTo(true));
3845
- this._destroy$ = new Subject();
3836
+ init() {
3837
+ const data = this._filterItems.valuesAsQuery();
3838
+ this._sort = this._filterItems.getSort();
3839
+ this.config.init(data, this._sort);
3840
+ this._updateChipsVisibility();
3846
3841
  }
3847
- ngOnInit() {
3848
- this.rangeItem = this.item.isTypeDateRange
3849
- || this.item.isTypeRange
3850
- || this.item.isTypeDateTimeRange;
3851
- this.listenValueChangesForRanges();
3852
- this._updateVisibility();
3853
- if (this.item.hasPendingValues) {
3854
- this.item.loadAsyncValues(false);
3855
- this.item.values$
3856
- .pipe(take(2), takeUntil(this._destroy$))
3857
- .subscribe(() => {
3858
- this._updateVisibility();
3859
- this._cdRef.markForCheck();
3860
- });
3861
- this._initDelayRender();
3842
+ clear(event = null) {
3843
+ if (event) {
3844
+ event.stopPropagation();
3845
+ }
3846
+ this._filterItems.filtersClear();
3847
+ if (this.config.clear) {
3848
+ this.config.clear();
3862
3849
  }
3863
3850
  }
3864
- ngOnDestroy() {
3865
- this._destroy$.next();
3866
- this._destroy$.complete();
3867
- }
3868
- focusOnItem(type = null) {
3869
- this._focusController.click(this.item, type);
3851
+ /**
3852
+ * Close filter window and do change callback
3853
+ */
3854
+ search(event) {
3855
+ this.changeVisibilityClick(false, event);
3870
3856
  }
3871
- removeItem(event, type = null) {
3872
- if (this.item instanceof RangeItem) {
3873
- this.item.clearRange(type);
3857
+ reload(event = null) {
3858
+ if (event) {
3859
+ event.preventDefault();
3860
+ event.stopPropagation();
3874
3861
  }
3875
- else if (this.item instanceof DateRangeItem || this.item instanceof DateTimeRangeItem) {
3876
- this.item.clearDateRange(type);
3862
+ const data = this._filterItems.valuesAsQuery();
3863
+ if (this.config.reload) {
3864
+ this.config.reload(data, this._filterItems.getSort());
3877
3865
  }
3878
- else {
3879
- this.item.clear();
3866
+ }
3867
+ getItem(name) {
3868
+ return this.items
3869
+ .find((item) => item.name === name);
3870
+ }
3871
+ fetchQueryParams() {
3872
+ this._externalParams.fetchQueryParams();
3873
+ }
3874
+ /**
3875
+ * Call change callback and apply new filter values
3876
+ */
3877
+ change() {
3878
+ const data = this._filterItems.valuesAsQuery();
3879
+ const sort = this._filterItems.getSort();
3880
+ const sortingChanged = ((!sort || !this._sort) && sort !== this._sort)
3881
+ || (sort && this._sort && !objectsAreEquals(this._sort, sort));
3882
+ if (sortingChanged) {
3883
+ this._sort = sort;
3884
+ if (this.config.sortChange) {
3885
+ this.config.sortChange(data, sort);
3886
+ }
3880
3887
  }
3888
+ if (this.config.change) {
3889
+ this.config.change(data, sort);
3890
+ }
3891
+ this._updateChipsVisibility();
3881
3892
  }
3882
- listenValueChangesForRanges() {
3883
- this.item.value$
3884
- .pipe(distinctUntilChanged(), takeUntil(this._destroy$))
3885
- .subscribe(() => {
3886
- this._updateVisibility();
3887
- this._cdRef.markForCheck();
3888
- });
3893
+ /**
3894
+ * Update filter actions config
3895
+ * @param actions
3896
+ */
3897
+ updateActions(actions) {
3898
+ this._actions.initActions(actions);
3889
3899
  }
3890
- _updateVisibility() {
3891
- this.itemVisible = this.item.isChipVisible;
3900
+ /**
3901
+ * Show "Filters" button
3902
+ */
3903
+ showFiltersBtn() {
3904
+ this._filtersBtnVisible$.next(true);
3892
3905
  }
3893
- _initDelayRender() {
3894
- this.chipDelayedRender$ = combineLatest([
3895
- this.item.values$,
3896
- this._chipRenderTimer$.pipe(startWith(false))
3897
- ])
3898
- .pipe(map(([values, timerValue]) => {
3899
- return !!values || timerValue;
3900
- }));
3906
+ /**
3907
+ * Hide "Filters" button
3908
+ */
3909
+ hideFiltersBtn() {
3910
+ this._filtersBtnVisible$.next(false);
3901
3911
  }
3902
- };
3903
- FsFilterChipComponent.ctorParameters = () => [
3904
- { type: ChangeDetectorRef },
3905
- { type: FocusControllerService }
3906
- ];
3907
- __decorate([
3908
- Input(),
3909
- __metadata("design:type", BaseItem)
3910
- ], FsFilterChipComponent.prototype, "item", void 0);
3911
- FsFilterChipComponent = __decorate([
3912
- Component({
3913
- selector: 'fs-filter-chip',
3914
- 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.clearAllowed\"\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.clearAllowed\"\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.clearAllowed\"\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",
3915
- changeDetection: ChangeDetectionStrategy.OnPush,
3916
- styles: ["fs-chip{cursor:pointer;color:#6f6f6f}"]
3917
- }),
3918
- __metadata("design:paramtypes", [ChangeDetectorRef,
3919
- FocusControllerService])
3920
- ], FsFilterChipComponent);
3921
-
3922
- let FsFilterDrawerActionsComponent = class FsFilterDrawerActionsComponent {
3923
- constructor(externalParams) {
3924
- this.externalParams = externalParams;
3925
- this._clear = new EventEmitter();
3926
- this._done = new EventEmitter();
3912
+ /**
3913
+ * Show "Keyword" field if it present
3914
+ */
3915
+ showKeywordField() {
3916
+ this._keywordVisible$.next(true);
3927
3917
  }
3928
- get savedFilters() {
3929
- return this.externalParams.savedFiltersController;
3918
+ /**
3919
+ * Hide "Keyword" field if it present
3920
+ */
3921
+ hideKeywordField() {
3922
+ this._keywordVisible$.next(false);
3930
3923
  }
3931
- done() {
3932
- this._done.emit();
3924
+ /**
3925
+ * Go through actions and check show() callback and update visible actions
3926
+ */
3927
+ updateActionsVisibility() {
3928
+ this._actions.updateActionsVisibility();
3933
3929
  }
3934
- clear() {
3935
- this._clear.emit();
3930
+ /**
3931
+ * Go through actions and check disabled() callback and update disabled state
3932
+ */
3933
+ updateDisabledState() {
3934
+ this._actions.updateDisabledState();
3936
3935
  }
3937
- saveFilters() {
3938
- this.externalParams
3939
- .savedFiltersController
3940
- .openSavedFilterEditDialog();
3936
+ setItems(items) {
3937
+ this._filterItems.destroyItems();
3938
+ this.config.items = items;
3939
+ this._filterItems.setConfig(this._config);
3940
+ this._externalParams.initItems();
3941
+ this._syncSearchInputWithKeyword();
3942
+ this._listenKeywordItemClear();
3941
3943
  }
3942
- };
3943
- FsFilterDrawerActionsComponent.ctorParameters = () => [
3944
- { type: ExternalParamsController }
3945
- ];
3946
- __decorate([
3947
- Output('clear'),
3948
- __metadata("design:type", Object)
3949
- ], FsFilterDrawerActionsComponent.prototype, "_clear", void 0);
3950
- __decorate([
3951
- Output('done'),
3952
- __metadata("design:type", Object)
3953
- ], FsFilterDrawerActionsComponent.prototype, "_done", void 0);
3954
- FsFilterDrawerActionsComponent = __decorate([
3955
- Component({
3956
- selector: 'fs-filter-drawer-actions',
3957
- 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"
3958
- }),
3959
- __metadata("design:paramtypes", [ExternalParamsController])
3960
- ], FsFilterDrawerActionsComponent);
3961
-
3962
- let FsFilterIsolateValues = class FsFilterIsolateValues {
3963
- transform(values, isolate) {
3964
- if (!isolate) {
3965
- return values;
3944
+ _initFilterWithConfig(config) {
3945
+ if (this.config) {
3946
+ this._filterItems.destroyItems();
3966
3947
  }
3967
- else {
3968
- return values.filter((value) => {
3969
- return value.value !== isolate.value;
3970
- });
3948
+ config = Object.assign(Object.assign({}, (this._defaultConfig || {})), config);
3949
+ this._config = new FsFilterConfig(config);
3950
+ this._actions.initActions(this._config.actions);
3951
+ this._filterItems.setConfig(this._config);
3952
+ this._externalParams.setConfig(this._config);
3953
+ this._syncSearchInputWithKeyword();
3954
+ if (!!this.config.reloadWhenConfigChanged) {
3955
+ this.change();
3971
3956
  }
3957
+ this._listenKeywordItemClear();
3972
3958
  }
3973
- };
3974
- FsFilterIsolateValues = __decorate([
3975
- Pipe({
3976
- name: 'fsFilterIsolateValues'
3977
- })
3978
- ], FsFilterIsolateValues);
3979
-
3980
- let FocusToItemDirective = class FocusToItemDirective {
3981
- constructor(_el, _focusController, _targetSelect, _targetDate, _targetDateScroll, _targetDateRangeFrom, _targetDateRangeTo, _targetAutocomplete, _targetAutocompleteChips) {
3982
- this._el = _el;
3983
- this._focusController = _focusController;
3984
- this._targetSelect = _targetSelect;
3985
- this._targetDate = _targetDate;
3986
- this._targetDateScroll = _targetDateScroll;
3987
- this._targetDateRangeFrom = _targetDateRangeFrom;
3988
- this._targetDateRangeTo = _targetDateRangeTo;
3989
- this._targetAutocomplete = _targetAutocomplete;
3990
- this._targetAutocompleteChips = _targetAutocompleteChips;
3991
- this._destroy$ = new Subject();
3959
+ _destroyFilterDrawer() {
3960
+ this._filterOverlay.close();
3992
3961
  }
3993
- ngOnInit() {
3994
- this._focusController
3995
- .listenFocusFor$(this._item, this._focusTargetType)
3996
- .pipe(delay(500), takeUntil(this._destroy$))
3997
- .subscribe(() => {
3998
- this._focus();
3999
- });
3962
+ _updateWindowWidth() {
3963
+ this.windowDesktop = window.innerWidth > 1200;
4000
3964
  }
4001
- ngOnDestroy() {
4002
- this._destroy$.next();
4003
- this._destroy$.complete();
3965
+ _listenEscButton() {
3966
+ this._zone.runOutsideAngular(() => {
3967
+ fromEvent(window, 'keyup')
3968
+ .pipe(filter$1((event) => event.code === 'Escape'), takeUntil(this.closed), takeUntil(this._destroy$))
3969
+ .subscribe(() => {
3970
+ this._zone.run(() => {
3971
+ this.changeVisibility(false);
3972
+ });
3973
+ });
3974
+ });
4004
3975
  }
4005
- _focus() {
4006
- switch (this._item.type) {
4007
- case ItemType.Select:
4008
- {
4009
- this._targetSelect.open();
4010
- }
4011
- break;
4012
- case ItemType.Text:
4013
- case ItemType.Range:
4014
- {
4015
- this._el.nativeElement.focus();
4016
- }
4017
- break;
4018
- case ItemType.Date:
4019
- {
4020
- if (this._item.mode === ItemDateMode.Calendar) {
4021
- this._targetDate.open();
4022
- }
4023
- else {
4024
- this._targetDateScroll.inputClick();
4025
- }
4026
- }
4027
- break;
4028
- case ItemType.DateRange:
4029
- {
4030
- if (this._focusTargetType === 'from') {
4031
- this._targetDateRangeFrom.open();
4032
- }
4033
- else {
4034
- this._targetDateRangeTo.open();
4035
- }
4036
- }
4037
- break;
4038
- case ItemType.AutoComplete:
4039
- {
4040
- this._targetAutocomplete.focus();
4041
- }
4042
- break;
4043
- case ItemType.AutoCompleteChips:
4044
- {
4045
- this._targetAutocompleteChips.focus();
4046
- }
4047
- break;
3976
+ _listenInputKeyEvents() {
3977
+ if (!this.searchTextInput) {
3978
+ return;
4048
3979
  }
3980
+ this._zone.runOutsideAngular(() => {
3981
+ fromEvent(this.searchTextInput.nativeElement, 'keydown')
3982
+ .pipe(debounceTime(500), filter$1((event) => {
3983
+ return ['Enter', 'NumpadEnter', 'Escape'].indexOf(event.code) > -1;
3984
+ }), takeUntil(this._destroy$))
3985
+ .subscribe((event) => {
3986
+ this._zone.run(() => {
3987
+ this.filterInputEvent(event);
3988
+ });
3989
+ });
3990
+ });
4049
3991
  }
4050
- };
4051
- FocusToItemDirective.ctorParameters = () => [
4052
- { type: ElementRef },
4053
- { type: FocusControllerService },
4054
- { type: MatSelect, decorators: [{ type: Optional }, { type: Self }] },
4055
- { type: FsDatePickerComponent, decorators: [{ type: Optional }, { type: Self }] },
4056
- { type: FsDateScrollPickerComponent, decorators: [{ type: Optional }, { type: Self }] },
4057
- { type: DateRangePickerFromComponent, decorators: [{ type: Optional }, { type: Self }] },
4058
- { type: DateRangePickerToComponent, decorators: [{ type: Optional }, { type: Self }] },
4059
- { type: FsAutocompleteComponent, decorators: [{ type: Optional }, { type: Self }] },
4060
- { type: FsAutocompleteChipsComponent, decorators: [{ type: Optional }, { type: Self }] }
4061
- ];
4062
- __decorate([
4063
- Input('fsFilterFocusTrigger'),
4064
- __metadata("design:type", Object)
4065
- ], FocusToItemDirective.prototype, "_item", void 0);
4066
- __decorate([
4067
- Input('focusTargetType'),
4068
- __metadata("design:type", Object)
4069
- ], FocusToItemDirective.prototype, "_focusTargetType", void 0);
4070
- FocusToItemDirective = __decorate([
4071
- Directive({
4072
- selector: '[fsFilterFocusTrigger]',
4073
- }),
4074
- __param(2, Optional()), __param(2, Self()),
4075
- __param(3, Optional()), __param(3, Self()),
4076
- __param(4, Optional()), __param(4, Self()),
4077
- __param(5, Optional()), __param(5, Self()),
4078
- __param(6, Optional()), __param(6, Self()),
4079
- __param(7, Optional()), __param(7, Self()),
4080
- __param(8, Optional()), __param(8, Self()),
4081
- __metadata("design:paramtypes", [ElementRef,
4082
- FocusControllerService,
4083
- MatSelect,
4084
- FsDatePickerComponent,
4085
- FsDateScrollPickerComponent,
4086
- DateRangePickerFromComponent,
4087
- DateRangePickerToComponent,
4088
- FsAutocompleteComponent,
4089
- FsAutocompleteChipsComponent])
4090
- ], FocusToItemDirective);
4091
-
4092
- let FsFilterChipContentComponent = class FsFilterChipContentComponent {
4093
- constructor(_cdRef) {
4094
- this._cdRef = _cdRef;
4095
- this._destroy$ = new Subject();
3992
+ _listenWindowResize() {
3993
+ this._zone.runOutsideAngular(() => {
3994
+ fromEvent(window, 'resize')
3995
+ .pipe(debounceTime(100), takeUntil(this._destroy$))
3996
+ .subscribe(() => {
3997
+ this._zone.run(() => {
3998
+ this._updateWindowWidth();
3999
+ });
4000
+ });
4001
+ });
4096
4002
  }
4097
- ngOnInit() {
4098
- this.listenValueChangesForRanges();
4003
+ _listenInputChanges() {
4004
+ if (!this._filterItems.keywordItem) {
4005
+ return;
4006
+ }
4007
+ this._zone.runOutsideAngular(() => {
4008
+ this.searchText.valueChanges
4009
+ .pipe(debounceTime(200), distinctUntilChanged(), filter$1((value) => {
4010
+ var _a;
4011
+ return value !== ((_a = this._filterItems.keywordItem) === null || _a === void 0 ? void 0 : _a.model);
4012
+ }), takeUntil(this._destroy$))
4013
+ .subscribe((value) => {
4014
+ this._zone.run(() => {
4015
+ const keywordItem = this._filterItems.keywordItem;
4016
+ if (keywordItem && keywordItem.value !== value) {
4017
+ keywordItem.model = value;
4018
+ }
4019
+ });
4020
+ });
4021
+ });
4099
4022
  }
4100
- ngOnDestroy() {
4101
- this._destroy$.next();
4102
- this._destroy$.complete();
4023
+ _syncSearchInputWithKeyword() {
4024
+ const keywordItem = this._filterItems.keywordItem;
4025
+ if (keywordItem) {
4026
+ this.searchText.setValue(keywordItem.model);
4027
+ this.searchPlaceholder = keywordItem.label || 'Search';
4028
+ }
4103
4029
  }
4104
- listenValueChangesForRanges() {
4105
- this.item.value$
4030
+ _listenKeywordItemClear() {
4031
+ var _a;
4032
+ (_a = this._filterItems
4033
+ .keywordItem) === null || _a === void 0 ? void 0 : _a.clear$.pipe(takeUntil(this._filterItems.keywordItem.destroy$), takeUntil(this._destroy$)).subscribe(() => {
4034
+ this.searchText.setValue('');
4035
+ });
4036
+ }
4037
+ _listenInternalItemsChange() {
4038
+ this._filterItems
4039
+ .itemsChange$
4106
4040
  .pipe(takeUntil(this._destroy$))
4107
4041
  .subscribe(() => {
4108
- this.content = this._getContent();
4109
- this._cdRef.detectChanges();
4042
+ this.change();
4110
4043
  });
4111
4044
  }
4112
- _getContent() {
4113
- const result = this.item.getChipsContent(this.type);
4114
- if (this.item.chipLabel !== undefined) {
4115
- if (this.item.chipLabel === '') {
4116
- return `${result}`;
4117
- }
4118
- else {
4119
- if (Array.isArray(this.item.chipLabel)) {
4120
- const label = getLabelFromArray(this.item.chipLabel, this.type);
4121
- return `${label}: ${result}`;
4122
- }
4123
- else {
4124
- return `${this.item.chipLabel}: ${result}`;
4125
- }
4126
- }
4127
- }
4128
- else {
4129
- if (Array.isArray(this.item.label)) {
4130
- const label = getLabelFromArray(this.item.label, this.type);
4131
- return `${label}: ${result}`;
4132
- }
4133
- else {
4134
- if (this.item.isTypeCheckbox) {
4135
- return result;
4136
- }
4137
- else {
4138
- return `${this.item.label}: ${result}`;
4139
- }
4140
- }
4141
- }
4142
- }
4143
- };
4144
- FsFilterChipContentComponent.ctorParameters = () => [
4145
- { type: ChangeDetectorRef }
4146
- ];
4147
- __decorate([
4148
- Input(),
4149
- __metadata("design:type", BaseItem)
4150
- ], FsFilterChipContentComponent.prototype, "item", void 0);
4151
- __decorate([
4152
- Input(),
4153
- __metadata("design:type", String)
4154
- ], FsFilterChipContentComponent.prototype, "type", void 0);
4155
- FsFilterChipContentComponent = __decorate([
4156
- Component({
4157
- selector: 'fs-filter-chip-content',
4158
- template: "{{ content }}\n",
4159
- changeDetection: ChangeDetectionStrategy.OnPush,
4160
- styles: [""]
4161
- }),
4162
- __metadata("design:paramtypes", [ChangeDetectorRef])
4163
- ], FsFilterChipContentComponent);
4164
- function getLabelFromArray(labelArr, type) {
4165
- if (type === 'from' && labelArr[0]) {
4166
- return `${labelArr[0]}`;
4045
+ _initOverlay() {
4046
+ this._filterOverlay.setClearFn(this.clear.bind(this));
4047
+ this._filterOverlay.setDoneFn(this.hide.bind(this));
4167
4048
  }
4168
- else if (type === 'to' && labelArr[1]) {
4169
- return `${labelArr[1]}`;
4049
+ // We may need some time to recieve external params and after that ready can be emitted
4050
+ _listenWhenFilterReady() {
4051
+ combineLatest([
4052
+ this._externalParams.pending$,
4053
+ this.itemsReady$,
4054
+ ])
4055
+ .pipe(filter$1(([pendingParams, itemsReady]) => !pendingParams && itemsReady), takeUntil(this._destroy$))
4056
+ .subscribe(() => {
4057
+ if (this.config.init) {
4058
+ this.init();
4059
+ }
4060
+ this.ready.emit();
4061
+ });
4170
4062
  }
4171
- else {
4172
- return '';
4063
+ _updateChipsVisibility() {
4064
+ const hasFilterChips = this._filterItems.items
4065
+ .some((item) => {
4066
+ return item.isChipVisible;
4067
+ });
4068
+ this._hasFilterChips$.next(hasFilterChips);
4173
4069
  }
4174
4070
  }
4071
+ FilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterComponent, deps: [{ token: FsFilterOverlayService }, { token: i0.NgZone }, { token: ExternalParamsController }, { token: FsFilterItemsStore }, { token: ActionsController }, { token: FS_FILTER_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Component });
4072
+ FilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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" } }, providers: [
4073
+ FsFilterOverlayService,
4074
+ ExternalParamsController,
4075
+ PersistanceParamsController,
4076
+ QueryParamsController,
4077
+ FocusControllerService,
4078
+ FsFilterItemsStore,
4079
+ SavedFiltersController,
4080
+ ActionsController,
4081
+ ], queries: [{ propertyName: "statusBar", first: true, predicate: FilterStatusBarDirective, descendants: true, read: TemplateRef }], viewQueries: [{ propertyName: "searchTextInput", first: true, predicate: ["searchTextInput"], descendants: true }, { propertyName: "searchTextMatInput", first: true, predicate: ["searchTextInput"], descendants: true, read: MatInput }], ngImport: i0, template: "<ng-container *ngIf=\"hasKeyword; else noKeywordFilter\">\n <div class=\"filter-search-container\">\n <div class=\"filter-input-field\">\n <form autocomplete=\"off\" role=\"presentation\" *ngIf=\"keywordVisible$ | async\">\n <mat-form-field floatLabel=\"never\">\n <span matPrefix>\n <mat-icon matPrefix>search</mat-icon>\n </span>\n\n <input\n #searchTextInput\n matInput\n [formControl]=\"searchText\"\n [placeholder]=\"searchPlaceholder\"\n name=\"filter-input\"\n (click)=\"filterInputEvent($event)\"\n class=\"filter-input\">\n\n <a matSuffix\n *ngIf=\"searchText.value && showFilterInput && config.clear\"\n (click)=\"clearSearchText($event)\"\n href=\"javascript:void(0)\"\n class=\"clear\">\n <mat-icon>clear</mat-icon>\n </a>\n\n <a matSuffix\n (click)=\"reload($event)\"\n class=\"reload\"\n *ngIf=\"config.reload\">\n <mat-icon>refresh</mat-icon>\n </a>\n </mat-form-field>\n </form>\n </div>\n <ng-container *ngTemplateOutlet=\"filterActions\"></ng-container>\n </div>\n <div class=\"status-actions\" *ngIf=\"keywordVisible$ | async\">\n <ng-container *ngTemplateOutlet=\"statusBarContainer\"></ng-container>\n <ng-container *ngTemplateOutlet=\"filterChips\"></ng-container>\n </div>\n</ng-container>\n\n<ng-template #noKeywordFilter>\n <div class=\"filter-searchless-container\">\n <div class=\"status-actions\">\n <ng-container *ngTemplateOutlet=\"statusBarContainer\"></ng-container>\n <ng-container *ngTemplateOutlet=\"filterChips\"></ng-container>\n </div>\n <ng-container *ngTemplateOutlet=\"filterActions\"></ng-container>\n </div>\n</ng-template>\n\n\n<ng-template #filterActions>\n <div class=\"filter-actions\">\n <ng-container *ngIf=\"hasVisibleItemOrSorting && filtersBtnVisible$ | async\">\n <button\n mat-button\n class=\"filters-button\"\n [ngClass]=\"{\n 'mat-raised-button': config.button.style == 'raised',\n 'mat-button': config.button.style == 'basic',\n 'mat-icon-button': config.button.style == 'icon'\n }\"\n (click)=\"changeVisibilityClick(!showFilterMenu, $event)\"\n type=\"button\"\n [color]=\"config.button.color\">\n <mat-icon *ngIf=\"config.button.icon\">{{config.button.icon}}</mat-icon>\n {{ config.button.label }}\n </button>\n </ng-container>\n\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 #filterChips>\n <fs-filter-chips\n *ngIf=\"config.chips && hasFilterChips$ | async\"\n class=\"filter-chips\"\n [filters]=\"items\">\n </fs-filter-chips>\n</ng-template>\n\n<ng-template #statusBarContainer>\n <div class=\"status-bar\" *ngIf=\"statusBar\">\n <small><ng-container *ngTemplateOutlet=\"statusBar\"></ng-container></small>\n </div>\n</ng-template>\n", styles: ["fs-filter{display:block}.fs-filter{margin-bottom:20px;display:block}.fs-filter .results{min-height:90px;position:relative;overflow-x:auto;overflow-y:hidden}.fs-filter .status-bar{overflow:hidden;text-overflow:ellipsis;line-height:17px;margin:4px 0}.fs-filter .filter-chips{display:block}.fs-filter .filter-searchless-container{display:flex}.fs-filter .filter-searchless-container .status-actions{flex-grow:1}.fs-filter .filter-searchless-container .status-actions>*:first-child{margin-top:0}.fs-filter fs-filter-chips{margin:5px 0}.fs-filter .filter-search-container{flex-direction:row;box-sizing:border-box;display:flex;flex:1 1 0;position:relative}.fs-filter .filter-search-container .search{top:8px;position:absolute;margin-left:1px;left:0}.fs-filter .filter-search-container .search mat-icon{transform:scale(.9)}.fs-filter .filter-search-container form{width:100%;height:100%}.fs-filter .filter-search-container .filter-input-field{flex-direction:row;box-sizing:border-box;display:flex;align-items:center;flex:1}.fs-filter .filter-search-container .filter-input-field .mat-form-field{width:100%;height:100%;font-size:103%}.fs-filter .filter-search-container .filter-input-field .mat-form-field .mat-form-field-underline{bottom:auto}.fs-filter .filter-search-container .filter-input-field .mat-form-field .mat-form-field-infix{border-top:0}.fs-filter .filter-search-container .filter-input-field .mat-form-field .mat-form-field-wrapper{padding-bottom:0;height:100%}.fs-filter .filter-search-container .filter-input-field .mat-form-field .mat-form-field-flex{align-items:center;height:100%}.fs-filter .filter-search-container .filter-input-field .mat-form-field-prefix,.fs-filter .filter-search-container .filter-input-field .mat-form-field-suffix{align-self:center;display:flex;align-items:center;white-space:nowrap}.fs-filter .filter-search-container .filter-input-field .mat-form-field-prefix mat-icon,.fs-filter .filter-search-container .filter-input-field .mat-form-field-prefix a,.fs-filter .filter-search-container .filter-input-field .mat-form-field-suffix mat-icon,.fs-filter .filter-search-container .filter-input-field .mat-form-field-suffix a{display:flex;cursor:pointer;color:initial}.fs-filter .filter-search-container .filter-input-field .mat-form-field-prefix mat-icon:hover,.fs-filter .filter-search-container .filter-input-field .mat-form-field-prefix a:hover,.fs-filter .filter-search-container .filter-input-field .mat-form-field-suffix mat-icon:hover,.fs-filter .filter-search-container .filter-input-field .mat-form-field-suffix a:hover{color:inherit}.fs-filter .filter-search-container .filter-input-field .mat-form-field-infix{width:auto}.fs-filter .filter-actions{display:flex;align-items:center}.fs-filter button.reload{margin-left:-40px;right:-9px}@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: i1$3.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i2$3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { 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: FsFilterActionsComponent, selector: "fs-filter-actions", inputs: ["kebabActions", "actions"] }, { type: FsFilterChipsComponent, selector: "fs-filter-chips", inputs: ["filters"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i5.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i5.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i1$3.MatPrefix, selector: "[matPrefix]" }, { type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i5.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: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5.FormControlDirective, selector: "[formControl]", inputs: ["disabled", "formControl", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i1$3.MatSuffix, selector: "[matSuffix]" }, { type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6$1.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }], pipes: { "async": i3.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
4082
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FilterComponent, decorators: [{
4083
+ type: Component,
4084
+ args: [{
4085
+ selector: 'fs-filter',
4086
+ styleUrls: ['./filter.component.scss'],
4087
+ templateUrl: './filter.component.html',
4088
+ encapsulation: ViewEncapsulation.None,
4089
+ providers: [
4090
+ FsFilterOverlayService,
4091
+ ExternalParamsController,
4092
+ PersistanceParamsController,
4093
+ QueryParamsController,
4094
+ FocusControllerService,
4095
+ FsFilterItemsStore,
4096
+ SavedFiltersController,
4097
+ ActionsController,
4098
+ ],
4099
+ changeDetection: ChangeDetectionStrategy.OnPush,
4100
+ }]
4101
+ }], ctorParameters: function () { return [{ type: FsFilterOverlayService }, { type: i0.NgZone }, { type: ExternalParamsController }, { type: FsFilterItemsStore }, { type: ActionsController }, { type: FsFilterConfig, decorators: [{
4102
+ type: Optional
4103
+ }, {
4104
+ type: Inject,
4105
+ args: [FS_FILTER_CONFIG]
4106
+ }] }]; }, propDecorators: { setConfig: [{
4107
+ type: Input,
4108
+ args: ['config']
4109
+ }], setFilter: [{
4110
+ type: Input,
4111
+ args: ['filter']
4112
+ }], showSortBy: [{
4113
+ type: Input
4114
+ }], showFilterInput: [{
4115
+ type: Input
4116
+ }], closed: [{
4117
+ type: Output
4118
+ }], opened: [{
4119
+ type: Output
4120
+ }], ready: [{
4121
+ type: Output
4122
+ }], statusBar: [{
4123
+ type: ContentChild,
4124
+ args: [FilterStatusBarDirective, { read: TemplateRef }]
4125
+ }], searchTextInput: [{
4126
+ type: ViewChild,
4127
+ args: ['searchTextInput']
4128
+ }], searchTextMatInput: [{
4129
+ type: ViewChild,
4130
+ args: ['searchTextInput', { read: MatInput }]
4131
+ }], showFilterMenu: [{
4132
+ type: HostBinding,
4133
+ args: ['class.filters-open']
4134
+ }], windowDesktop: [{
4135
+ type: HostBinding,
4136
+ args: ['class.window-desktop']
4137
+ }], fsFilterClass: [{
4138
+ type: HostBinding,
4139
+ args: ['class.fs-filter']
4140
+ }] } });
4141
+
4142
+ class SelectBackdropComponent {
4143
+ constructor() { }
4144
+ }
4145
+ SelectBackdropComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SelectBackdropComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4146
+ SelectBackdropComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SelectBackdropComponent, selector: "filter-item-select-backdrop", ngImport: i0, template: "", styles: [":host{position:absolute;top:0;bottom:0;right:0;z-index:1002;left:0}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
4147
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SelectBackdropComponent, decorators: [{
4148
+ type: Component,
4149
+ args: [{
4150
+ selector: 'filter-item-select-backdrop',
4151
+ styleUrls: ['./backdrop.component.scss'],
4152
+ templateUrl: './backdrop.component.html',
4153
+ changeDetection: ChangeDetectionStrategy.OnPush,
4154
+ }]
4155
+ }], ctorParameters: function () { return []; } });
4175
4156
 
4176
- let FsSavedFiltersMenuComponent = class FsSavedFiltersMenuComponent {
4157
+ class FsSavedFiltersMenuComponent {
4177
4158
  constructor(_itemsStore, _externalParams, _savedFilters) {
4178
4159
  this._itemsStore = _itemsStore;
4179
4160
  this._externalParams = _externalParams;
@@ -4200,105 +4181,99 @@ let FsSavedFiltersMenuComponent = class FsSavedFiltersMenuComponent {
4200
4181
  manageFilters() {
4201
4182
  this.manage.emit();
4202
4183
  }
4203
- };
4204
- FsSavedFiltersMenuComponent.ctorParameters = () => [
4205
- { type: FsFilterItemsStore },
4206
- { type: ExternalParamsController },
4207
- { type: SavedFiltersController }
4208
- ];
4209
- __decorate([
4210
- Output(),
4211
- __metadata("design:type", Object)
4212
- ], FsSavedFiltersMenuComponent.prototype, "select", void 0);
4213
- __decorate([
4214
- Output(),
4215
- __metadata("design:type", Object)
4216
- ], FsSavedFiltersMenuComponent.prototype, "clear", void 0);
4217
- __decorate([
4218
- Output(),
4219
- __metadata("design:type", Object)
4220
- ], FsSavedFiltersMenuComponent.prototype, "manage", void 0);
4221
- FsSavedFiltersMenuComponent = __decorate([
4222
- Component({
4223
- selector: 'fs-filter-saved-filters-menu',
4224
- 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",
4225
- changeDetection: ChangeDetectionStrategy.OnPush,
4226
- styles: [":host ::ng-deep .selector{cursor:pointer}"]
4227
- }),
4228
- __metadata("design:paramtypes", [FsFilterItemsStore,
4229
- ExternalParamsController,
4230
- SavedFiltersController])
4231
- ], FsSavedFiltersMenuComponent);
4232
-
4233
- let FsFilterActionsComponent = class FsFilterActionsComponent {
4234
- constructor() {
4235
- this.kebabActions = [];
4236
- this.actions = [];
4237
- }
4238
- };
4239
- __decorate([
4240
- Input(),
4241
- __metadata("design:type", Array)
4242
- ], FsFilterActionsComponent.prototype, "kebabActions", void 0);
4243
- __decorate([
4244
- Input(),
4245
- __metadata("design:type", Array)
4246
- ], FsFilterActionsComponent.prototype, "actions", void 0);
4247
- FsFilterActionsComponent = __decorate([
4248
- Component({
4249
- selector: 'fs-filter-actions',
4250
- template: "<!-- Buttons -->\n<ng-container *ngFor=\"let action of actions\">\n\n <ng-container [ngSwitch]=\"action.mode\">\n <ng-container *ngSwitchCase=\"'button'\">\n <fs-filter-action-button [action]=\"action\"></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 </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 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 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 <fs-filter-action-button [action]=\"action\"></fs-filter-action-button>\n </fs-file>\n </ng-container>\n </ng-container>\n</ng-container>\n<!-- /Buttons -->\n\n<!-- menu -->\n<ng-container *ngIf=\"kebabActions?.length\">\n <fs-filter-action-kebab-actions [kebabActions]=\"kebabActions\"></fs-filter-action-kebab-actions>\n</ng-container>\n",
4251
- changeDetection: ChangeDetectionStrategy.OnPush,
4252
- 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}"]
4253
- })
4254
- ], FsFilterActionsComponent);
4255
-
4256
- let FsFilterActionButtonComponent = class FsFilterActionButtonComponent {
4257
- };
4258
- __decorate([
4259
- Input(),
4260
- __metadata("design:type", Action)
4261
- ], FsFilterActionButtonComponent.prototype, "action", void 0);
4262
- FsFilterActionButtonComponent = __decorate([
4263
- Component({
4264
- selector: 'fs-filter-action-button',
4265
- template: "<ng-container [ngSwitch]=\"action.type\">\n <!-- Basic button -->\n <button type=\"button\"\n *ngSwitchCase=\"'basic'\"\n mat-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 >\n <ng-template [ngTemplateOutlet]=\"buttonContent\"></ng-template>\n </button>\n\n <!-- Raised button -->\n <button type=\"button\"\n *ngSwitchDefault\n mat-raised-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 >\n <ng-template [ngTemplateOutlet]=\"buttonContent\"></ng-template>\n </button>\n\n <!-- Icon button -->\n <button type=\"button\"\n *ngSwitchCase=\"'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 >\n <ng-template [ngTemplateOutlet]=\"buttonContent\"></ng-template>\n </button>\n\n <!-- Fab button -->\n <button type=\"button\"\n *ngSwitchCase=\"'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 >\n <ng-template [ngTemplateOutlet]=\"buttonContent\"></ng-template>\n </button>\n\n <!-- Mini Fab button -->\n <button type=\"button\"\n *ngSwitchCase=\"'mini-fab'\"\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 >\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",
4266
- host: {
4267
- class: 'action-button',
4268
- },
4269
- changeDetection: ChangeDetectionStrategy.OnPush
4270
- })
4271
- ], FsFilterActionButtonComponent);
4272
-
4273
- let FsFilterActionKebabActionsComponent = class FsFilterActionKebabActionsComponent {
4274
- };
4275
- __decorate([
4276
- Input(),
4277
- __metadata("design:type", Array)
4278
- ], FsFilterActionKebabActionsComponent.prototype, "kebabActions", void 0);
4279
- FsFilterActionKebabActionsComponent = __decorate([
4280
- Component({
4281
- selector: 'fs-filter-action-kebab-actions',
4282
- template: "<button 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 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 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 fs-menu-item\n [fsClass]=\"action.classArray\"\n >\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 <mat-icon *ngIf=\"action.icon\">{{action.icon}}</mat-icon> {{action.label}}\n </fs-file>\n </ng-template>\n </ng-container>\n\n <ng-container *ngSwitchDefault>\n <ng-template fs-menu-item\n (click)=\"action.click($event)\"\n [fsClass]=\"action.classArray\"\n >\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",
4283
- changeDetection: ChangeDetectionStrategy.OnPush,
4284
- styles: [".menu-button{width:36px;height:36px;line-height:36px}"]
4285
- })
4286
- ], FsFilterActionKebabActionsComponent);
4184
+ }
4185
+ FsSavedFiltersMenuComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsSavedFiltersMenuComponent, deps: [{ token: FsFilterItemsStore }, { token: ExternalParamsController }, { token: SavedFiltersController }], target: i0.ɵɵFactoryTarget.Component });
4186
+ FsSavedFiltersMenuComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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"], 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]", inputs: ["fsClass", "class", "id", "label", "hidden", "groupHidden", "dismissAfterClick", "link", "target", "queryParams"], outputs: ["click"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i3.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
4187
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsSavedFiltersMenuComponent, decorators: [{
4188
+ type: Component,
4189
+ args: [{
4190
+ selector: 'fs-filter-saved-filters-menu',
4191
+ templateUrl: './saved-filters-menu.component.html',
4192
+ styleUrls: [
4193
+ './saved-filters-menu.component.scss',
4194
+ ],
4195
+ changeDetection: ChangeDetectionStrategy.OnPush,
4196
+ }]
4197
+ }], ctorParameters: function () { return [{ type: FsFilterItemsStore }, { type: ExternalParamsController }, { type: SavedFiltersController }]; }, propDecorators: { select: [{
4198
+ type: Output
4199
+ }], clear: [{
4200
+ type: Output
4201
+ }], manage: [{
4202
+ type: Output
4203
+ }] } });
4287
4204
 
4288
- var FsFilterModule_1;
4289
- let FsFilterModule = FsFilterModule_1 = class FsFilterModule {
4205
+ class FsFilterModule {
4290
4206
  static forRoot(config = {}) {
4291
4207
  return {
4292
- ngModule: FsFilterModule_1,
4208
+ ngModule: FsFilterModule,
4293
4209
  providers: [
4294
4210
  { provide: FS_FILTER_CONFIG, useValue: config || {} }
4295
4211
  ]
4296
4212
  };
4297
4213
  }
4298
- };
4299
- FsFilterModule = FsFilterModule_1 = __decorate([
4300
- NgModule({
4301
- imports: [
4214
+ }
4215
+ FsFilterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFilterModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4216
+ FsFilterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFilterModule, declarations: [BaseItemComponent,
4217
+ FilterComponent,
4218
+ FilterItemComponent,
4219
+ FsFilterChipsComponent,
4220
+ SelectComponent,
4221
+ SelectGroupsComponent,
4222
+ SelectSimpleComponent,
4223
+ SelectMultipleComponent,
4224
+ ChipsComponent,
4225
+ TextComponent,
4226
+ RangeComponent,
4227
+ AutocompleteComponent,
4228
+ AutocompletechipsComponent,
4229
+ DateComponent,
4230
+ DateRangeComponent,
4231
+ CheckboxComponent,
4232
+ FilterDrawerComponent,
4233
+ SelectBackdropComponent,
4234
+ FsFilterChipComponent,
4235
+ FsFilterChipContentComponent,
4236
+ FsFilterDrawerActionsComponent,
4237
+ FsFilterSavedFilterEditComponent,
4238
+ FsSavedFiltersMenuComponent,
4239
+ FsFilterActionsComponent,
4240
+ FsFilterActionButtonComponent,
4241
+ FsFilterActionKebabActionsComponent,
4242
+ FilterStatusBarDirective,
4243
+ FocusToItemDirective,
4244
+ // Pipes
4245
+ FsFilterIsolateValues], imports: [CommonModule,
4246
+ RouterModule,
4247
+ FormsModule,
4248
+ ReactiveFormsModule,
4249
+ MatIconModule,
4250
+ MatInputModule,
4251
+ MatSelectModule,
4252
+ MatChipsModule,
4253
+ MatCheckboxModule,
4254
+ MatAutocompleteModule,
4255
+ MatButtonModule,
4256
+ MatDialogModule,
4257
+ FlexLayoutModule,
4258
+ FsChipModule,
4259
+ FsCommonModule,
4260
+ FsStoreModule,
4261
+ FsDatePickerModule,
4262
+ FsLabelModule,
4263
+ FsAutocompleteModule,
4264
+ FsAutocompleteChipsModule,
4265
+ FsScrollModule,
4266
+ PortalModule,
4267
+ FsMaskModule,
4268
+ FsMenuModule,
4269
+ FsSkeletonModule,
4270
+ FsFormModule,
4271
+ FsFileModule], exports: [FilterComponent,
4272
+ FilterStatusBarDirective,
4273
+ FsSavedFiltersMenuComponent] });
4274
+ FsFilterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFilterModule, providers: [
4275
+ FsStore,
4276
+ ], imports: [[
4302
4277
  CommonModule,
4303
4278
  RouterModule,
4304
4279
  FormsModule,
@@ -4326,52 +4301,84 @@ FsFilterModule = FsFilterModule_1 = __decorate([
4326
4301
  FsSkeletonModule,
4327
4302
  FsFormModule,
4328
4303
  FsFileModule,
4329
- ],
4330
- declarations: [
4331
- BaseItemComponent,
4332
- FilterComponent,
4333
- FilterItemComponent,
4334
- FsFilterChipsComponent,
4335
- SelectComponent,
4336
- SelectGroupsComponent,
4337
- SelectSimpleComponent,
4338
- SelectMultipleComponent,
4339
- ChipsComponent,
4340
- TextComponent,
4341
- RangeComponent,
4342
- AutocompleteComponent,
4343
- AutocompletechipsComponent,
4344
- DateComponent,
4345
- DateRangeComponent,
4346
- CheckboxComponent,
4347
- FilterDrawerComponent,
4348
- SelectBackdropComponent,
4349
- FsFilterChipComponent,
4350
- FsFilterChipContentComponent,
4351
- FsFilterDrawerActionsComponent,
4352
- FsFilterSavedFilterEditComponent,
4353
- FsSavedFiltersMenuComponent,
4354
- FsFilterActionsComponent,
4355
- FsFilterActionButtonComponent,
4356
- FsFilterActionKebabActionsComponent,
4357
- FilterStatusBarDirective,
4358
- FocusToItemDirective,
4359
- // Pipes
4360
- FsFilterIsolateValues,
4361
- ],
4362
- providers: [
4363
- FsStore,
4364
- ],
4365
- exports: [
4366
- FilterComponent,
4367
- FilterStatusBarDirective,
4368
- FsSavedFiltersMenuComponent,
4369
- ],
4370
- entryComponents: [
4371
- FilterDrawerComponent
4372
- ]
4373
- })
4374
- ], FsFilterModule);
4304
+ ]] });
4305
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFilterModule, decorators: [{
4306
+ type: NgModule,
4307
+ args: [{
4308
+ imports: [
4309
+ CommonModule,
4310
+ RouterModule,
4311
+ FormsModule,
4312
+ ReactiveFormsModule,
4313
+ MatIconModule,
4314
+ MatInputModule,
4315
+ MatSelectModule,
4316
+ MatChipsModule,
4317
+ MatCheckboxModule,
4318
+ MatAutocompleteModule,
4319
+ MatButtonModule,
4320
+ MatDialogModule,
4321
+ FlexLayoutModule,
4322
+ FsChipModule,
4323
+ FsCommonModule,
4324
+ FsStoreModule,
4325
+ FsDatePickerModule,
4326
+ FsLabelModule,
4327
+ FsAutocompleteModule,
4328
+ FsAutocompleteChipsModule,
4329
+ FsScrollModule,
4330
+ PortalModule,
4331
+ FsMaskModule,
4332
+ FsMenuModule,
4333
+ FsSkeletonModule,
4334
+ FsFormModule,
4335
+ FsFileModule,
4336
+ ],
4337
+ declarations: [
4338
+ BaseItemComponent,
4339
+ FilterComponent,
4340
+ FilterItemComponent,
4341
+ FsFilterChipsComponent,
4342
+ SelectComponent,
4343
+ SelectGroupsComponent,
4344
+ SelectSimpleComponent,
4345
+ SelectMultipleComponent,
4346
+ ChipsComponent,
4347
+ TextComponent,
4348
+ RangeComponent,
4349
+ AutocompleteComponent,
4350
+ AutocompletechipsComponent,
4351
+ DateComponent,
4352
+ DateRangeComponent,
4353
+ CheckboxComponent,
4354
+ FilterDrawerComponent,
4355
+ SelectBackdropComponent,
4356
+ FsFilterChipComponent,
4357
+ FsFilterChipContentComponent,
4358
+ FsFilterDrawerActionsComponent,
4359
+ FsFilterSavedFilterEditComponent,
4360
+ FsSavedFiltersMenuComponent,
4361
+ FsFilterActionsComponent,
4362
+ FsFilterActionButtonComponent,
4363
+ FsFilterActionKebabActionsComponent,
4364
+ FilterStatusBarDirective,
4365
+ FocusToItemDirective,
4366
+ // Pipes
4367
+ FsFilterIsolateValues,
4368
+ ],
4369
+ providers: [
4370
+ FsStore,
4371
+ ],
4372
+ exports: [
4373
+ FilterComponent,
4374
+ FilterStatusBarDirective,
4375
+ FsSavedFiltersMenuComponent,
4376
+ ],
4377
+ entryComponents: [
4378
+ FilterDrawerComponent
4379
+ ]
4380
+ }]
4381
+ }] });
4375
4382
 
4376
4383
  // Controllers
4377
4384
 
@@ -4379,5 +4386,5 @@ FsFilterModule = FsFilterModule_1 = __decorate([
4379
4386
  * Generated bundle index. Do not edit.
4380
4387
  */
4381
4388
 
4382
- export { ActionMode, ActionType, AutocompleteChipsItem, AutocompleteItem, BaseItem, CheckboxItem, ChipsItem, DateItem, DateRangeItem, DateTimeItem, DateTimeRangeItem, ExternalParamsController, FS_FILTER_CONFIG, FilterComponent, FilterItemComponent, FilterStatusBarDirective, FsFilterModule, ItemDateMode, ItemType, QUERY_PARAM_DELIMITER, RangeItem, SavedFiltersController, SelectItem, TextItem, filterFromQueryParam, filterToQueryParam, FsFilterItemsStore as ɵa, PersistanceParamsController as ɵb, SelectBackdropComponent as ɵba, FsFilterChipComponent as ɵbb, FsFilterChipContentComponent as ɵbc, FsFilterDrawerActionsComponent as ɵbd, FsFilterSavedFilterEditComponent as ɵbe, FsSavedFiltersMenuComponent as ɵbf, FsFilterActionsComponent as ɵbg, FsFilterActionButtonComponent as ɵbh, FsFilterActionKebabActionsComponent as ɵbi, FocusToItemDirective as ɵbj, FsFilterIsolateValues as ɵbk, BaseDateItem as ɵbl, BaseDateRangeItem as ɵbm, BaseAutocompleteItem as ɵbn, QueryParamsController as ɵc, BaseItemComponent as ɵd, FsFilterOverlayService as ɵe, FS_FILTER_META as ɵg, FocusControllerService as ɵh, ActionsController as ɵi, FsFilterConfig as ɵj, FsFilterChipsComponent as ɵk, SelectComponent as ɵl, SelectGroupsComponent as ɵm, SelectSimpleComponent as ɵn, SelectMultipleComponent as ɵo, ChipsComponent as ɵp, TextComponent as ɵq, RangeComponent as ɵr, AutocompleteComponent as ɵs, AutocompletechipsComponent as ɵt, DateComponent as ɵu, DateRangeComponent as ɵv, CheckboxComponent as ɵw, FilterDrawerComponent as ɵx, FILTER_DRAWER_OVERLAY as ɵy, FILTER_DRAWER_DATA as ɵz };
4389
+ export { ActionMode, ActionType, AutocompleteChipsItem, AutocompleteItem, BaseItem, CheckboxItem, ChipsItem, DateItem, DateRangeItem, DateTimeItem, DateTimeRangeItem, ExternalParamsController, FS_FILTER_CONFIG, FilterComponent, FilterItemComponent, FilterStatusBarDirective, FsFilterModule, FsSavedFiltersMenuComponent, ItemDateMode, ItemType, QUERY_PARAM_DELIMITER, RangeItem, SavedFiltersController, SelectItem, TextItem, filterFromQueryParam, filterToQueryParam };
4383
4390
  //# sourceMappingURL=firestitch-filter.js.map