@skyux/list-builder 5.0.0-beta.0 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. package/LICENSE +21 -0
  2. package/bundles/skyux-list-builder.umd.js +1308 -1130
  3. package/bundles/skyux-list-builder.umd.js.map +1 -1
  4. package/documentation.json +6679 -0
  5. package/esm2015/modules/list/list-data-request.model.js +1 -1
  6. package/esm2015/modules/list/list-data-response.model.js +1 -1
  7. package/esm2015/modules/list/list-data.provider.js +1 -1
  8. package/esm2015/modules/list/list-paging.component.js +1 -1
  9. package/esm2015/modules/list/list-view.component.js +9 -8
  10. package/esm2015/modules/list/list.component.js +81 -87
  11. package/esm2015/modules/list/list.module.js +15 -18
  12. package/esm2015/modules/list/state/filters/filters.orchestrator.js +2 -3
  13. package/esm2015/modules/list/state/filters/update.action.js +1 -1
  14. package/esm2015/modules/list/state/items/items.orchestrator.js +12 -9
  15. package/esm2015/modules/list/state/items/load.action.js +1 -1
  16. package/esm2015/modules/list/state/items/set-items-selected.action.js +4 -2
  17. package/esm2015/modules/list/state/items/set-loading.action.js +1 -1
  18. package/esm2015/modules/list/state/list-state-action.type.js +2 -1
  19. package/esm2015/modules/list/state/list-state.model.js +1 -1
  20. package/esm2015/modules/list/state/list-state.rxstate.js +10 -8
  21. package/esm2015/modules/list/state/list-state.state-node.js +11 -14
  22. package/esm2015/modules/list/state/paging/paging.model.js +1 -1
  23. package/esm2015/modules/list/state/paging/paging.orchestrator.js +2 -3
  24. package/esm2015/modules/list/state/paging/set-items-per-page.action.js +1 -1
  25. package/esm2015/modules/list/state/paging/set-max-pages.action.js +1 -1
  26. package/esm2015/modules/list/state/paging/set-page-number.action.js +1 -1
  27. package/esm2015/modules/list/state/search/search.model.js +1 -1
  28. package/esm2015/modules/list/state/search/search.orchestrator.js +5 -4
  29. package/esm2015/modules/list/state/search/set-field-selectors.action.js +1 -1
  30. package/esm2015/modules/list/state/search/set-functions.action.js +1 -1
  31. package/esm2015/modules/list/state/search/set-options.action.js +1 -1
  32. package/esm2015/modules/list/state/search/set-search-text.action.js +1 -1
  33. package/esm2015/modules/list/state/selected/load.action.js +1 -1
  34. package/esm2015/modules/list/state/selected/selected.model.js +1 -1
  35. package/esm2015/modules/list/state/selected/selected.orchestrator.js +9 -10
  36. package/esm2015/modules/list/state/selected/set-item-selected.action.js +1 -1
  37. package/esm2015/modules/list/state/selected/set-items-selected.action.js +1 -1
  38. package/esm2015/modules/list/state/selected/set-loading.action.js +1 -1
  39. package/esm2015/modules/list/state/sort/label.model.js +1 -1
  40. package/esm2015/modules/list/state/sort/set-available.action.js +1 -1
  41. package/esm2015/modules/list/state/sort/set-field-selectors.action.js +1 -1
  42. package/esm2015/modules/list/state/sort/set-global.action.js +1 -1
  43. package/esm2015/modules/list/state/sort/sort.model.js +1 -1
  44. package/esm2015/modules/list/state/sort/sort.orchestrator.js +4 -5
  45. package/esm2015/modules/list/state/toolbar/disable.action.js +1 -1
  46. package/esm2015/modules/list/state/toolbar/load.action.js +1 -1
  47. package/esm2015/modules/list/state/toolbar/remove.action.js +1 -1
  48. package/esm2015/modules/list/state/toolbar/set-exists.action.js +1 -1
  49. package/esm2015/modules/list/state/toolbar/set-type.action.js +1 -1
  50. package/esm2015/modules/list/state/toolbar/show-multiselect-toolbar.action.js +1 -1
  51. package/esm2015/modules/list/state/toolbar/toolbar-item.model.js +1 -1
  52. package/esm2015/modules/list/state/toolbar/toolbar.model.js +1 -1
  53. package/esm2015/modules/list/state/toolbar/toolbar.orchestrator.js +3 -4
  54. package/esm2015/modules/list/state/views/load.action.js +1 -1
  55. package/esm2015/modules/list/state/views/set-active.action.js +1 -1
  56. package/esm2015/modules/list/state/views/view.model.js +1 -1
  57. package/esm2015/modules/list/state/views/views.model.js +1 -1
  58. package/esm2015/modules/list/state/views/views.orchestrator.js +2 -4
  59. package/esm2015/modules/list-data-provider-in-memory/list-data-in-memory.provider.js +25 -14
  60. package/esm2015/modules/list-filters/filter.model.js +1 -1
  61. package/esm2015/modules/list-filters/list-filter-button.component.js +23 -24
  62. package/esm2015/modules/list-filters/list-filter-inline-item-renderer.component.js +24 -24
  63. package/esm2015/modules/list-filters/list-filter-inline-item.component.js +32 -32
  64. package/esm2015/modules/list-filters/list-filter-inline.component.js +28 -26
  65. package/esm2015/modules/list-filters/list-filter-inline.model.js +1 -1
  66. package/esm2015/modules/list-filters/list-filter-summary.component.js +22 -23
  67. package/esm2015/modules/list-filters/list-filters.module.js +33 -27
  68. package/esm2015/modules/list-paging/list-paging.component.js +37 -40
  69. package/esm2015/modules/list-paging/list-paging.module.js +15 -19
  70. package/esm2015/modules/list-toolbar/list-multiselect-toolbar.component.js +45 -41
  71. package/esm2015/modules/list-toolbar/list-secondary-actions/list-secondary-action.component.js +22 -23
  72. package/esm2015/modules/list-toolbar/list-secondary-actions/list-secondary-action.js +2 -1
  73. package/esm2015/modules/list-toolbar/list-secondary-actions/list-secondary-actions-host.component.js +22 -20
  74. package/esm2015/modules/list-toolbar/list-secondary-actions/list-secondary-actions.component.js +26 -30
  75. package/esm2015/modules/list-toolbar/list-secondary-actions/list-secondary-actions.module.js +34 -23
  76. package/esm2015/modules/list-toolbar/list-secondary-actions/list-secondary-actions.service.js +10 -9
  77. package/esm2015/modules/list-toolbar/list-toolbar-item-renderer.component.js +22 -21
  78. package/esm2015/modules/list-toolbar/list-toolbar-item.component.js +23 -24
  79. package/esm2015/modules/list-toolbar/list-toolbar-search-actions.component.js +15 -13
  80. package/esm2015/modules/list-toolbar/list-toolbar-sort.component.js +21 -23
  81. package/esm2015/modules/list-toolbar/list-toolbar-view-actions.component.js +14 -12
  82. package/esm2015/modules/list-toolbar/list-toolbar.component.js +142 -139
  83. package/esm2015/modules/list-toolbar/list-toolbar.module.js +62 -31
  84. package/esm2015/modules/list-toolbar/state/config/config.model.js +1 -1
  85. package/esm2015/modules/list-toolbar/state/config/config.orchestrator.js +2 -4
  86. package/esm2015/modules/list-toolbar/state/config/set-search-enabled.action.js +1 -1
  87. package/esm2015/modules/list-toolbar/state/config/set-sort-selector-enabled.action.js +1 -1
  88. package/esm2015/modules/list-toolbar/state/toolbar-state-action.type.js +2 -1
  89. package/esm2015/modules/list-toolbar/state/toolbar-state.model.js +1 -1
  90. package/esm2015/modules/list-toolbar/state/toolbar-state.rxstate.js +9 -8
  91. package/esm2015/modules/list-toolbar/state/toolbar-state.state-node.js +12 -17
  92. package/esm2015/modules/shared/sky-list-builder-resources.module.js +53 -0
  93. package/esm2015/public-api.js +78 -0
  94. package/esm2015/skyux-list-builder.js +2 -23
  95. package/fesm2015/skyux-list-builder.js +992 -915
  96. package/fesm2015/skyux-list-builder.js.map +1 -1
  97. package/modules/list/list.component.d.ts +3 -0
  98. package/modules/list/list.module.d.ts +6 -0
  99. package/modules/list/state/list-state.rxstate.d.ts +3 -0
  100. package/modules/list/state/list-state.state-node.d.ts +3 -0
  101. package/modules/list-filters/list-filter-button.component.d.ts +3 -0
  102. package/modules/list-filters/list-filter-inline-item-renderer.component.d.ts +3 -0
  103. package/modules/list-filters/list-filter-inline-item.component.d.ts +3 -0
  104. package/modules/list-filters/list-filter-inline.component.d.ts +3 -0
  105. package/modules/list-filters/list-filter-summary.component.d.ts +3 -0
  106. package/modules/list-filters/list-filters.module.d.ts +11 -0
  107. package/modules/list-paging/list-paging.component.d.ts +3 -0
  108. package/modules/list-paging/list-paging.module.d.ts +7 -0
  109. package/modules/list-toolbar/list-multiselect-toolbar.component.d.ts +3 -0
  110. package/modules/list-toolbar/list-secondary-actions/list-secondary-action.component.d.ts +3 -0
  111. package/modules/list-toolbar/list-secondary-actions/list-secondary-actions-host.component.d.ts +3 -0
  112. package/modules/list-toolbar/list-secondary-actions/list-secondary-actions.component.d.ts +3 -0
  113. package/modules/list-toolbar/list-secondary-actions/list-secondary-actions.module.d.ts +12 -0
  114. package/modules/list-toolbar/list-secondary-actions/list-secondary-actions.service.d.ts +3 -0
  115. package/modules/list-toolbar/list-toolbar-item-renderer.component.d.ts +3 -0
  116. package/modules/list-toolbar/list-toolbar-item.component.d.ts +3 -0
  117. package/modules/list-toolbar/list-toolbar-search-actions.component.d.ts +3 -0
  118. package/modules/list-toolbar/list-toolbar-sort.component.d.ts +3 -0
  119. package/modules/list-toolbar/list-toolbar-view-actions.component.d.ts +3 -0
  120. package/modules/list-toolbar/list-toolbar.component.d.ts +3 -0
  121. package/modules/list-toolbar/list-toolbar.module.d.ts +20 -0
  122. package/modules/list-toolbar/state/toolbar-state.rxstate.d.ts +3 -0
  123. package/modules/list-toolbar/state/toolbar-state.state-node.d.ts +3 -0
  124. package/modules/shared/sky-list-builder-resources.module.d.ts +14 -0
  125. package/package.json +16 -31
  126. package/{public_api.d.ts → public-api.d.ts} +11 -0
  127. package/skyux-list-builder.d.ts +2 -22
  128. package/CHANGELOG.md +0 -161
  129. package/bundles/skyux-list-builder.umd.min.js +0 -16
  130. package/bundles/skyux-list-builder.umd.min.js.map +0 -1
  131. package/esm2015/modules/shared/list-builder-resources.module.js +0 -17
  132. package/esm2015/plugin-resources/list-builder-resources-provider.js +0 -16
  133. package/esm2015/public_api.js +0 -63
  134. package/esm5/modules/list/list-data-request.model.js +0 -20
  135. package/esm5/modules/list/list-data-response.model.js +0 -11
  136. package/esm5/modules/list/list-data.provider.js +0 -10
  137. package/esm5/modules/list/list-paging.component.js +0 -15
  138. package/esm5/modules/list/list-view.component.js +0 -38
  139. package/esm5/modules/list/list.component.js +0 -337
  140. package/esm5/modules/list/list.module.js +0 -24
  141. package/esm5/modules/list/state/filters/filters.orchestrator.js +0 -22
  142. package/esm5/modules/list/state/filters/update.action.js +0 -11
  143. package/esm5/modules/list/state/items/items.orchestrator.js +0 -55
  144. package/esm5/modules/list/state/items/load.action.js +0 -16
  145. package/esm5/modules/list/state/items/set-items-selected.action.js +0 -15
  146. package/esm5/modules/list/state/items/set-loading.action.js +0 -12
  147. package/esm5/modules/list/state/list-state-action.type.js +0 -1
  148. package/esm5/modules/list/state/list-state.model.js +0 -26
  149. package/esm5/modules/list/state/list-state.rxstate.js +0 -91
  150. package/esm5/modules/list/state/list-state.state-node.js +0 -42
  151. package/esm5/modules/list/state/paging/paging.model.js +0 -16
  152. package/esm5/modules/list/state/paging/paging.orchestrator.js +0 -33
  153. package/esm5/modules/list/state/paging/set-items-per-page.action.js +0 -11
  154. package/esm5/modules/list/state/paging/set-max-pages.action.js +0 -11
  155. package/esm5/modules/list/state/paging/set-page-number.action.js +0 -11
  156. package/esm5/modules/list/state/search/search.model.js +0 -34
  157. package/esm5/modules/list/state/search/search.orchestrator.js +0 -51
  158. package/esm5/modules/list/state/search/set-field-selectors.action.js +0 -12
  159. package/esm5/modules/list/state/search/set-functions.action.js +0 -12
  160. package/esm5/modules/list/state/search/set-options.action.js +0 -13
  161. package/esm5/modules/list/state/search/set-search-text.action.js +0 -11
  162. package/esm5/modules/list/state/selected/load.action.js +0 -11
  163. package/esm5/modules/list/state/selected/selected.model.js +0 -11
  164. package/esm5/modules/list/state/selected/selected.orchestrator.js +0 -62
  165. package/esm5/modules/list/state/selected/set-item-selected.action.js +0 -12
  166. package/esm5/modules/list/state/selected/set-items-selected.action.js +0 -15
  167. package/esm5/modules/list/state/selected/set-loading.action.js +0 -12
  168. package/esm5/modules/list/state/sort/label.model.js +0 -27
  169. package/esm5/modules/list/state/sort/set-available.action.js +0 -11
  170. package/esm5/modules/list/state/sort/set-field-selectors.action.js +0 -11
  171. package/esm5/modules/list/state/sort/set-global.action.js +0 -11
  172. package/esm5/modules/list/state/sort/sort.model.js +0 -29
  173. package/esm5/modules/list/state/sort/sort.orchestrator.js +0 -36
  174. package/esm5/modules/list/state/toolbar/disable.action.js +0 -11
  175. package/esm5/modules/list/state/toolbar/load.action.js +0 -13
  176. package/esm5/modules/list/state/toolbar/remove.action.js +0 -11
  177. package/esm5/modules/list/state/toolbar/set-exists.action.js +0 -11
  178. package/esm5/modules/list/state/toolbar/set-type.action.js +0 -11
  179. package/esm5/modules/list/state/toolbar/show-multiselect-toolbar.action.js +0 -11
  180. package/esm5/modules/list/state/toolbar/toolbar-item.model.js +0 -18
  181. package/esm5/modules/list/state/toolbar/toolbar.model.js +0 -19
  182. package/esm5/modules/list/state/toolbar/toolbar.orchestrator.js +0 -86
  183. package/esm5/modules/list/state/views/load.action.js +0 -11
  184. package/esm5/modules/list/state/views/set-active.action.js +0 -11
  185. package/esm5/modules/list/state/views/view.model.js +0 -12
  186. package/esm5/modules/list/state/views/views.model.js +0 -15
  187. package/esm5/modules/list/state/views/views.orchestrator.js +0 -28
  188. package/esm5/modules/list-data-provider-in-memory/list-data-in-memory.provider.js +0 -157
  189. package/esm5/modules/list-filters/filter.model.js +0 -20
  190. package/esm5/modules/list-filters/list-filter-button.component.js +0 -45
  191. package/esm5/modules/list-filters/list-filter-inline-item-renderer.component.js +0 -37
  192. package/esm5/modules/list-filters/list-filter-inline-item.component.js +0 -50
  193. package/esm5/modules/list-filters/list-filter-inline.component.js +0 -73
  194. package/esm5/modules/list-filters/list-filter-inline.model.js +0 -23
  195. package/esm5/modules/list-filters/list-filter-summary.component.js +0 -62
  196. package/esm5/modules/list-filters/list-filters.module.js +0 -38
  197. package/esm5/modules/list-paging/list-paging.component.js +0 -102
  198. package/esm5/modules/list-paging/list-paging.module.js +0 -26
  199. package/esm5/modules/list-toolbar/list-multiselect-toolbar.component.js +0 -153
  200. package/esm5/modules/list-toolbar/list-secondary-actions/list-secondary-action.component.js +0 -34
  201. package/esm5/modules/list-toolbar/list-secondary-actions/list-secondary-action.js +0 -1
  202. package/esm5/modules/list-toolbar/list-secondary-actions/list-secondary-actions-host.component.js +0 -49
  203. package/esm5/modules/list-toolbar/list-secondary-actions/list-secondary-actions.component.js +0 -49
  204. package/esm5/modules/list-toolbar/list-secondary-actions/list-secondary-actions.module.js +0 -38
  205. package/esm5/modules/list-toolbar/list-secondary-actions/list-secondary-actions.service.js +0 -36
  206. package/esm5/modules/list-toolbar/list-toolbar-item-renderer.component.js +0 -32
  207. package/esm5/modules/list-toolbar/list-toolbar-item.component.js +0 -53
  208. package/esm5/modules/list-toolbar/list-toolbar-search-actions.component.js +0 -20
  209. package/esm5/modules/list-toolbar/list-toolbar-sort.component.js +0 -30
  210. package/esm5/modules/list-toolbar/list-toolbar-view-actions.component.js +0 -22
  211. package/esm5/modules/list-toolbar/list-toolbar.component.js +0 -375
  212. package/esm5/modules/list-toolbar/list-toolbar.module.js +0 -59
  213. package/esm5/modules/list-toolbar/state/config/config.model.js +0 -16
  214. package/esm5/modules/list-toolbar/state/config/config.orchestrator.js +0 -28
  215. package/esm5/modules/list-toolbar/state/config/set-search-enabled.action.js +0 -11
  216. package/esm5/modules/list-toolbar/state/config/set-sort-selector-enabled.action.js +0 -13
  217. package/esm5/modules/list-toolbar/state/toolbar-state-action.type.js +0 -1
  218. package/esm5/modules/list-toolbar/state/toolbar-state.model.js +0 -12
  219. package/esm5/modules/list-toolbar/state/toolbar-state.rxstate.js +0 -29
  220. package/esm5/modules/list-toolbar/state/toolbar-state.state-node.js +0 -29
  221. package/esm5/modules/shared/list-builder-resources.module.js +0 -20
  222. package/esm5/plugin-resources/list-builder-resources-provider.js +0 -17
  223. package/esm5/public_api.js +0 -63
  224. package/esm5/skyux-list-builder.js +0 -26
  225. package/fesm5/skyux-list-builder.js +0 -2884
  226. package/fesm5/skyux-list-builder.js.map +0 -1
  227. package/modules/shared/list-builder-resources.module.d.ts +0 -2
  228. package/plugin-resources/list-builder-resources-provider.d.ts +0 -5
  229. package/skyux-list-builder.metadata.json +0 -1
  230. package/src/assets/img/list-toolbar-context.png +0 -0
  231. package/src/assets/img/toolbar-anatomy.png +0 -0
  232. package/src/assets/locales/resources_en_US.json +0 -22
@@ -1,2884 +0,0 @@
1
- import { __spread, __extends, __decorate } from 'tslib';
2
- import { Injectable, EventEmitter, Input, Output, ContentChildren, Component, ChangeDetectionStrategy, NgModule, ViewChild, TemplateRef, ViewContainerRef, forwardRef, ChangeDetectorRef } from '@angular/core';
3
- import { CommonModule } from '@angular/common';
4
- import { BehaviorSubject, Observable, Subject, of, combineLatest } from 'rxjs';
5
- import { map, take, distinctUntilChanged, takeUntil, skip, flatMap, scan } from 'rxjs/operators';
6
- import { ListItemModel, getData, compare, AsyncList, AsyncItem, StateOrchestrator, StateDispatcher, StateNode, getValue, isObservable } from '@skyux/list-builder-common';
7
- import { SkyFilterModule, SkyPagingModule, SkySortModule } from '@skyux/lists';
8
- import { getStringForLocale, SKY_LIB_RESOURCES_PROVIDERS, SkyI18nModule } from '@skyux/i18n';
9
- import { SkyIconModule } from '@skyux/indicators';
10
- import { SkyDropdownModule } from '@skyux/popovers';
11
- import { SkyToolbarModule } from '@skyux/layout';
12
- import { SkySearchComponent, SkySearchModule } from '@skyux/lookup';
13
- import { SkyCheckboxModule } from '@skyux/forms';
14
-
15
- var ListDataRequestModel = /** @class */ (function () {
16
- function ListDataRequestModel(data) {
17
- /**
18
- * Indicates whether to disable the search bar and filter button.
19
- * @default false
20
- */
21
- this.isToolbarDisabled = false;
22
- if (data !== undefined) {
23
- this.filters = data.filters;
24
- this.pageSize = data.pageSize;
25
- this.pageNumber = data.pageNumber;
26
- this.search = data.search;
27
- this.sort = data.sort;
28
- this.isToolbarDisabled = data.isToolbarDisabled;
29
- }
30
- }
31
- return ListDataRequestModel;
32
- }());
33
-
34
- var ListDataResponseModel = /** @class */ (function () {
35
- function ListDataResponseModel(data) {
36
- if (data !== undefined) {
37
- this.count = data.count;
38
- this.items = data.items;
39
- }
40
- }
41
- return ListDataResponseModel;
42
- }());
43
-
44
- /**
45
- * @internal
46
- */
47
- var ListDataProvider = /** @class */ (function () {
48
- function ListDataProvider(data) {
49
- }
50
- return ListDataProvider;
51
- }());
52
-
53
- /**
54
- * @internal
55
- */
56
- var ListItemsLoadAction = /** @class */ (function () {
57
- function ListItemsLoadAction(items, refresh, dataChanged, count) {
58
- if (refresh === void 0) { refresh = false; }
59
- if (dataChanged === void 0) { dataChanged = true; }
60
- this.items = items;
61
- this.refresh = refresh;
62
- this.dataChanged = dataChanged;
63
- this.count = count;
64
- }
65
- return ListItemsLoadAction;
66
- }());
67
-
68
- /**
69
- * @internal
70
- */
71
- var ListItemsSetLoadingAction = /** @class */ (function () {
72
- function ListItemsSetLoadingAction(loading) {
73
- if (loading === void 0) { loading = true; }
74
- this.loading = loading;
75
- }
76
- return ListItemsSetLoadingAction;
77
- }());
78
-
79
- /**
80
- * @internal
81
- */
82
- var ListSelectedLoadAction = /** @class */ (function () {
83
- function ListSelectedLoadAction(items) {
84
- this.items = items;
85
- }
86
- return ListSelectedLoadAction;
87
- }());
88
-
89
- /**
90
- * @internal
91
- */
92
- var ListSelectedSetLoadingAction = /** @class */ (function () {
93
- function ListSelectedSetLoadingAction(loading) {
94
- if (loading === void 0) { loading = true; }
95
- this.loading = loading;
96
- }
97
- return ListSelectedSetLoadingAction;
98
- }());
99
-
100
- /**
101
- * Specifies a set of fields to sort by.
102
- */
103
- var ListSortModel = /** @class */ (function () {
104
- function ListSortModel(data) {
105
- /**
106
- * Specifies the list of available views to sort.
107
- */
108
- this.available = [];
109
- /**
110
- * Specifies whether the sort applies to all list views.
111
- */
112
- this.global = [];
113
- /**
114
- * Specifies the fields to sort.
115
- * For information about `ListSortFieldSelectorModel`, see the
116
- * [shared classes for lists](https://developer.blackbaud.com/skyux-list-builder-common/docs/list-builder-common).
117
- */
118
- this.fieldSelectors = [];
119
- if (data) {
120
- this.available = data.available;
121
- this.global = data.global;
122
- this.fieldSelectors = data.fieldSelectors;
123
- }
124
- }
125
- return ListSortModel;
126
- }());
127
-
128
- /**
129
- * @internal
130
- */
131
- var ListSortSetFieldSelectorsAction = /** @class */ (function () {
132
- function ListSortSetFieldSelectorsAction(fieldSelectors) {
133
- this.fieldSelectors = fieldSelectors;
134
- }
135
- return ListSortSetFieldSelectorsAction;
136
- }());
137
-
138
- /**
139
- * Specifies a function to dynamically manage the data source when users change the text
140
- * in the list field. The search function must return an array or a promise of an array.
141
- * The `search` property is particularly useful when the data source does not live
142
- * in the source code.
143
- */
144
- var ListSearchModel = /** @class */ (function () {
145
- function ListSearchModel(data) {
146
- /**
147
- * Specifies the text to search.
148
- */
149
- this.searchText = '';
150
- /**
151
- * Specifies an array of functions that returns a `boolean` value of `true` when
152
- * the search is successful. This property accepts a function of type
153
- * `(data: any, searchText: string) => boolean>.`
154
- */
155
- this.functions = [];
156
- /**
157
- * Specifies the columns to search. The columns correspond to `field` values that
158
- * you specify with the list component's `data` property.
159
- */
160
- this.fieldSelectors = [];
161
- if (data) {
162
- this.searchText = data.searchText;
163
- this.functions = __spread(data.functions);
164
- this.fieldSelectors = data.fieldSelectors;
165
- }
166
- }
167
- return ListSearchModel;
168
- }());
169
-
170
- var idIndex = 0;
171
- var SkyListInMemoryDataProvider = /** @class */ (function (_super) {
172
- __extends(SkyListInMemoryDataProvider, _super);
173
- function SkyListInMemoryDataProvider(data, searchFunction) {
174
- var _this = _super.call(this, data) || this;
175
- _this.items = new BehaviorSubject([]);
176
- _this.searchFunction = searchFunction;
177
- if (data) {
178
- data.subscribe(function (items) {
179
- _this.items.next(items.map(function (d) {
180
- return new ListItemModel(d.id || "sky-list-data-in-memory-provider-item-" + ++idIndex, d);
181
- }));
182
- });
183
- }
184
- return _this;
185
- }
186
- SkyListInMemoryDataProvider.prototype.count = function () {
187
- return this.items.pipe(map(function (items) { return items.length; }));
188
- };
189
- SkyListInMemoryDataProvider.prototype.get = function (request) {
190
- return this.filteredItems(request).pipe(map(function (result) {
191
- if (request.pageNumber && request.pageSize) {
192
- var itemStart = (request.pageNumber - 1) * request.pageSize;
193
- var pagedResult = result.slice(itemStart, itemStart + request.pageSize);
194
- return new ListDataResponseModel({
195
- count: result.length,
196
- items: pagedResult
197
- });
198
- }
199
- else {
200
- return new ListDataResponseModel({
201
- count: result.length,
202
- items: result
203
- });
204
- }
205
- }));
206
- };
207
- SkyListInMemoryDataProvider.prototype.filteredItems = function (request) {
208
- var _this = this;
209
- var showSelectedId = ['show-selected'];
210
- return this.items.pipe(map(function (items) {
211
- var dataChanged = false;
212
- var search = request.search;
213
- var sort = request.sort;
214
- var filters = request.filters;
215
- if (_this.lastItems === undefined || _this.lastItems !== items) {
216
- dataChanged = true;
217
- _this.lastItems = items;
218
- }
219
- var searchChanged = false;
220
- var filtersChanged = false;
221
- if (request.isToolbarDisabled) {
222
- searchChanged = true;
223
- search = new ListSearchModel();
224
- filters = filters.filter(function (f) { return showSelectedId.indexOf(f.name) >= 0; });
225
- filtersChanged = true;
226
- }
227
- else {
228
- if (_this.lastSearch === undefined || _this.lastSearch !== search) {
229
- searchChanged = true;
230
- }
231
- if (_this.lastFilters === undefined || _this.lastFilters !== filters) {
232
- filtersChanged = true;
233
- }
234
- }
235
- _this.lastSearch = search;
236
- _this.lastFilters = filters;
237
- var result = items;
238
- // Apply filters.
239
- if (!dataChanged && !filtersChanged && _this.lastFilterResults !== undefined) {
240
- result = _this.lastFilterResults;
241
- }
242
- else if (filters && filters.length > 0) {
243
- result = result.filter(function (item) {
244
- for (var i = 0; i < filters.length; i++) {
245
- var filter = filters[i];
246
- if (filter.value === undefined ||
247
- filter.value === '' ||
248
- filter.value === false ||
249
- filter.value === filter.defaultValue) {
250
- continue;
251
- }
252
- if (!filter.filterFunction(item, filter.value)) {
253
- return false;
254
- }
255
- }
256
- return true;
257
- });
258
- _this.lastFilterResults = result;
259
- }
260
- else {
261
- _this.lastFilterResults = undefined;
262
- }
263
- // Apply search.
264
- if (!dataChanged && !searchChanged && _this.lastSearchResults !== undefined && !filtersChanged) {
265
- result = _this.lastSearchResults;
266
- }
267
- else if (search && search.searchText !== undefined && search.searchText.length > 0) {
268
- var searchText_1 = search.searchText.toLowerCase();
269
- var searchFunctions_1;
270
- if (_this.searchFunction !== undefined) {
271
- searchFunctions_1 = [_this.searchFunction];
272
- }
273
- else {
274
- searchFunctions_1 = search.functions;
275
- }
276
- result = result.filter(function (item) {
277
- var isMatch = false;
278
- for (var i = 0; i < searchFunctions_1.length; i++) {
279
- var searchFunction = searchFunctions_1[i];
280
- var searchResult = searchFunction(item.data, searchText_1);
281
- if ((typeof searchResult === 'string' && searchResult.indexOf(searchText_1) !== -1) ||
282
- searchResult === true) {
283
- isMatch = true;
284
- break;
285
- }
286
- }
287
- return isMatch;
288
- });
289
- _this.lastSearchResults = result;
290
- }
291
- else {
292
- _this.lastSearchResults = undefined;
293
- }
294
- // Apply sort.
295
- if (sort && sort.fieldSelectors.length > 0) {
296
- result = result.slice().sort(function (item1, item2) {
297
- var compareResult = 0;
298
- for (var i = 0; i < sort.fieldSelectors.length; i++) {
299
- var selector = sort.fieldSelectors[i];
300
- var value1 = getData(item1.data, selector.fieldSelector);
301
- var value2 = getData(item2.data, selector.fieldSelector);
302
- compareResult = compare(value1, value2);
303
- if (selector.descending && compareResult !== 0) {
304
- compareResult *= -1;
305
- }
306
- if (compareResult !== 0) {
307
- break;
308
- }
309
- }
310
- return compareResult;
311
- });
312
- }
313
- return result;
314
- }));
315
- };
316
- return SkyListInMemoryDataProvider;
317
- }(ListDataProvider));
318
-
319
- /**
320
- * @internal
321
- */
322
- var ListPagingModel = /** @class */ (function () {
323
- function ListPagingModel(data) {
324
- if (data !== undefined) {
325
- this.itemsPerPage = data.itemsPerPage || 10;
326
- this.maxDisplayedPages = data.maxDisplayedPages || 5;
327
- this.pageCount = data.pageCount || 0;
328
- this.pageNumber = data.pageNumber || 1;
329
- }
330
- }
331
- return ListPagingModel;
332
- }());
333
-
334
- /**
335
- * Contains data about the selected items in the list.
336
- */
337
- var ListSelectedModel = /** @class */ (function () {
338
- function ListSelectedModel() {
339
- this.selectedIdMap = new Map();
340
- }
341
- return ListSelectedModel;
342
- }());
343
-
344
- /**
345
- * @internal
346
- */
347
- var ListToolbarModel = /** @class */ (function () {
348
- function ListToolbarModel(data) {
349
- this.items = [];
350
- this.showMultiselectToolbar = false;
351
- if (data) {
352
- this.exists = data.exists;
353
- this.disabled = data.disabled;
354
- this.items = data.items;
355
- this.type = data.type;
356
- this.showMultiselectToolbar = data.showMultiselectToolbar;
357
- }
358
- }
359
- return ListToolbarModel;
360
- }());
361
-
362
- /**
363
- * @internal
364
- */
365
- var ListViewsModel = /** @class */ (function () {
366
- function ListViewsModel(data) {
367
- this.views = [];
368
- if (data) {
369
- this.active = data.active;
370
- this.views = data.views;
371
- }
372
- }
373
- return ListViewsModel;
374
- }());
375
-
376
- /**
377
- * @internal
378
- */
379
- var ListStateModel = /** @class */ (function () {
380
- function ListStateModel() {
381
- this.filters = [];
382
- this.items = new AsyncList();
383
- this.paging = new ListPagingModel();
384
- this.search = new ListSearchModel();
385
- this.selected = new AsyncItem();
386
- this.sort = new ListSortModel();
387
- this.toolbar = new ListToolbarModel();
388
- this.views = new ListViewsModel();
389
- this.selected.item = new ListSelectedModel();
390
- }
391
- return ListStateModel;
392
- }());
393
-
394
- /**
395
- * @internal
396
- */
397
- var ListFiltersUpdateAction = /** @class */ (function () {
398
- function ListFiltersUpdateAction(filters) {
399
- this.filters = filters;
400
- }
401
- return ListFiltersUpdateAction;
402
- }());
403
-
404
- /**
405
- * @internal
406
- */
407
- var ListSearchSetFunctionsAction = /** @class */ (function () {
408
- function ListSearchSetFunctionsAction(functions) {
409
- if (functions === void 0) { functions = []; }
410
- this.functions = functions;
411
- }
412
- return ListSearchSetFunctionsAction;
413
- }());
414
-
415
- /**
416
- * @internal
417
- */
418
- var ListSearchSetSearchTextAction = /** @class */ (function () {
419
- function ListSearchSetSearchTextAction(searchText) {
420
- this.searchText = searchText;
421
- }
422
- return ListSearchSetSearchTextAction;
423
- }());
424
-
425
- /**
426
- * @internal
427
- */
428
- var ListSearchSetFieldSelectorsAction = /** @class */ (function () {
429
- function ListSearchSetFieldSelectorsAction(fieldSelectors) {
430
- if (fieldSelectors === void 0) { fieldSelectors = []; }
431
- this.fieldSelectors = fieldSelectors;
432
- }
433
- return ListSearchSetFieldSelectorsAction;
434
- }());
435
-
436
- /**
437
- * @internal
438
- */
439
- var ListSearchSetOptionsAction = /** @class */ (function () {
440
- function ListSearchSetOptionsAction(searchTextAction, setFieldSelectorsAction, setFunctionsAction) {
441
- this.searchTextAction = searchTextAction;
442
- this.setFieldSelectorsAction = setFieldSelectorsAction;
443
- this.setFunctionsAction = setFunctionsAction;
444
- }
445
- return ListSearchSetOptionsAction;
446
- }());
447
-
448
- /**
449
- * @internal
450
- */
451
- var ListSelectedSetItemsSelectedAction = /** @class */ (function () {
452
- function ListSelectedSetItemsSelectedAction(items, selected, refresh) {
453
- if (selected === void 0) { selected = false; }
454
- if (refresh === void 0) { refresh = true; }
455
- this.items = items;
456
- this.selected = selected;
457
- this.refresh = refresh;
458
- }
459
- return ListSelectedSetItemsSelectedAction;
460
- }());
461
-
462
- /**
463
- * @internal
464
- */
465
- var ListSortSetAvailableAction = /** @class */ (function () {
466
- function ListSortSetAvailableAction(available) {
467
- this.available = available;
468
- }
469
- return ListSortSetAvailableAction;
470
- }());
471
-
472
- /**
473
- * @internal
474
- */
475
- var ListSortSetGlobalAction = /** @class */ (function () {
476
- function ListSortSetGlobalAction(global) {
477
- this.global = global;
478
- }
479
- return ListSortSetGlobalAction;
480
- }());
481
-
482
- /**
483
- * @internal
484
- */
485
- var ListToolbarItemsDisableAction = /** @class */ (function () {
486
- function ListToolbarItemsDisableAction(disable) {
487
- this.disable = disable;
488
- }
489
- return ListToolbarItemsDisableAction;
490
- }());
491
-
492
- /**
493
- * @internal
494
- */
495
- var ListToolbarItemsLoadAction = /** @class */ (function () {
496
- function ListToolbarItemsLoadAction(items, index) {
497
- if (index === void 0) { index = -1; }
498
- this.items = items;
499
- this.index = index;
500
- }
501
- return ListToolbarItemsLoadAction;
502
- }());
503
-
504
- /**
505
- * @internal
506
- */
507
- var ListToolbarItemsRemoveAction = /** @class */ (function () {
508
- function ListToolbarItemsRemoveAction(ids) {
509
- this.ids = ids;
510
- }
511
- return ListToolbarItemsRemoveAction;
512
- }());
513
-
514
- /**
515
- * @internal
516
- */
517
- var ListToolbarSetExistsAction = /** @class */ (function () {
518
- function ListToolbarSetExistsAction(exists) {
519
- this.exists = exists;
520
- }
521
- return ListToolbarSetExistsAction;
522
- }());
523
-
524
- /**
525
- * @internal
526
- */
527
- var ListToolbarShowMultiselectToolbarAction = /** @class */ (function () {
528
- function ListToolbarShowMultiselectToolbarAction(exists) {
529
- this.exists = exists;
530
- }
531
- return ListToolbarShowMultiselectToolbarAction;
532
- }());
533
-
534
- /**
535
- * @internal
536
- */
537
- var ListViewsSetActiveAction = /** @class */ (function () {
538
- function ListViewsSetActiveAction(view) {
539
- this.view = view;
540
- }
541
- return ListViewsSetActiveAction;
542
- }());
543
-
544
- /**
545
- * @internal
546
- */
547
- var ListStateOrchestrator = /** @class */ (function (_super) {
548
- __extends(ListStateOrchestrator, _super);
549
- function ListStateOrchestrator() {
550
- return _super !== null && _super.apply(this, arguments) || this;
551
- }
552
- return ListStateOrchestrator;
553
- }(StateOrchestrator));
554
- /**
555
- * @internal
556
- */
557
- var ListStateDispatcher = /** @class */ (function (_super) {
558
- __extends(ListStateDispatcher, _super);
559
- function ListStateDispatcher() {
560
- return _super !== null && _super.apply(this, arguments) || this;
561
- }
562
- ListStateDispatcher.prototype.viewsSetActive = function (id) {
563
- this.next(new ListViewsSetActiveAction(id));
564
- };
565
- ListStateDispatcher.prototype.toolbarExists = function (exists) {
566
- this.next(new ListToolbarSetExistsAction(exists));
567
- };
568
- ListStateDispatcher.prototype.toolbarSetDisabled = function (disabled) {
569
- this.next(new ListToolbarItemsDisableAction(disabled));
570
- };
571
- ListStateDispatcher.prototype.toolbarAddItems = function (items, index) {
572
- if (index === void 0) { index = -1; }
573
- this.next(new ListToolbarItemsLoadAction(items, index));
574
- };
575
- ListStateDispatcher.prototype.toolbarRemoveItems = function (ids) {
576
- this.next(new ListToolbarItemsRemoveAction(ids));
577
- };
578
- ListStateDispatcher.prototype.toolbarShowMultiselectToolbar = function (show) {
579
- this.next(new ListToolbarShowMultiselectToolbarAction(show));
580
- };
581
- ListStateDispatcher.prototype.searchSetFunctions = function (sortFunctions) {
582
- this.next(new ListSearchSetFunctionsAction(sortFunctions));
583
- };
584
- ListStateDispatcher.prototype.searchSetFieldSelectors = function (fieldSelectors) {
585
- this.next(new ListSearchSetFieldSelectorsAction(fieldSelectors));
586
- };
587
- ListStateDispatcher.prototype.searchSetText = function (searchText) {
588
- this.next(new ListSearchSetSearchTextAction(searchText));
589
- };
590
- ListStateDispatcher.prototype.searchSetOptions = function (searchOptions) {
591
- this.next(new ListSearchSetOptionsAction(new ListSearchSetSearchTextAction(searchOptions.searchText), new ListSearchSetFieldSelectorsAction(searchOptions.fieldSelectors), new ListSearchSetFunctionsAction(searchOptions.functions)));
592
- };
593
- ListStateDispatcher.prototype.sortSetAvailable = function (sortLabels) {
594
- this.next(new ListSortSetAvailableAction(sortLabels));
595
- };
596
- ListStateDispatcher.prototype.sortSetFieldSelectors = function (fieldSelectors) {
597
- this.next(new ListSortSetFieldSelectorsAction(fieldSelectors));
598
- };
599
- ListStateDispatcher.prototype.sortSetGlobal = function (sortLabels) {
600
- this.next(new ListSortSetGlobalAction(sortLabels));
601
- };
602
- ListStateDispatcher.prototype.filtersUpdate = function (filters) {
603
- this.next(new ListFiltersUpdateAction(filters));
604
- };
605
- ListStateDispatcher.prototype.setSelected = function (selectedIds, selected, refresh) {
606
- if (refresh === void 0) { refresh = false; }
607
- this.next(new ListSelectedSetItemsSelectedAction(selectedIds, selected, refresh));
608
- };
609
- ListStateDispatcher = __decorate([
610
- Injectable()
611
- ], ListStateDispatcher);
612
- return ListStateDispatcher;
613
- }(StateDispatcher));
614
-
615
- /**
616
- * @internal
617
- */
618
- var ListFiltersOrchestrator = /** @class */ (function (_super) {
619
- __extends(ListFiltersOrchestrator, _super);
620
- /* istanbul ignore next */
621
- function ListFiltersOrchestrator() {
622
- var _this = _super.call(this) || this;
623
- _this
624
- .register(ListFiltersUpdateAction, _this.update);
625
- return _this;
626
- }
627
- ListFiltersOrchestrator.prototype.update = function (state, action) {
628
- return __spread(action.filters);
629
- };
630
- return ListFiltersOrchestrator;
631
- }(ListStateOrchestrator));
632
-
633
- /**
634
- * @internal
635
- */
636
- var ListItemsSetSelectedAction = /** @class */ (function () {
637
- function ListItemsSetSelectedAction(items, selected, refresh) {
638
- if (selected === void 0) { selected = false; }
639
- if (refresh === void 0) { refresh = true; }
640
- this.items = items;
641
- this.selected = selected;
642
- this.refresh = refresh;
643
- }
644
- return ListItemsSetSelectedAction;
645
- }());
646
-
647
- /**
648
- * @internal
649
- */
650
- var ListItemsOrchestrator = /** @class */ (function (_super) {
651
- __extends(ListItemsOrchestrator, _super);
652
- /* istanbul ignore next */
653
- function ListItemsOrchestrator() {
654
- var _this = _super.call(this) || this;
655
- _this
656
- .register(ListItemsSetLoadingAction, _this.setLoading)
657
- .register(ListItemsLoadAction, _this.load)
658
- .register(ListItemsSetSelectedAction, _this.setItemsSelected);
659
- return _this;
660
- }
661
- ListItemsOrchestrator.prototype.setLoading = function (state, action) {
662
- return new AsyncList(state.items, state.lastUpdate, action.loading, state.count);
663
- };
664
- ListItemsOrchestrator.prototype.load = function (state, action) {
665
- var newListItems = action.items.map(function (g) { return new ListItemModel(g.id, g.data, g.isSelected); });
666
- var resultItems = (action.refresh) ? __spread(newListItems) : __spread(state.items, newListItems);
667
- var count = action.count === undefined ? resultItems.length : action.count;
668
- return new AsyncList(resultItems, action.dataChanged ? Date.now() : state.lastUpdate, false, count);
669
- };
670
- ListItemsOrchestrator.prototype.setItemsSelected = function (state, action) {
671
- var newSelectedIds = action.items || [];
672
- var newListItemModels = this.cloneListItemModelArray(state.items);
673
- if (action.refresh) {
674
- newListItemModels.forEach(function (item) { return item.isSelected = undefined; });
675
- }
676
- newSelectedIds.map(function (s) {
677
- var newItem = newListItemModels.find(function (i) { return i.id === s; });
678
- if (newItem) {
679
- newItem.isSelected = action.selected;
680
- }
681
- });
682
- return new AsyncList(newListItemModels, Date.now(), state.loading, state.count);
683
- };
684
- ListItemsOrchestrator.prototype.cloneListItemModelArray = function (source) {
685
- var newListItems = [];
686
- source.forEach(function (item) {
687
- newListItems.push(new ListItemModel(item.id, Object.assign({}, item.data), item.isSelected));
688
- });
689
- return newListItems;
690
- };
691
- return ListItemsOrchestrator;
692
- }(ListStateOrchestrator));
693
-
694
- /**
695
- * @internal
696
- */
697
- var ListPagingSetMaxPagesAction = /** @class */ (function () {
698
- function ListPagingSetMaxPagesAction(maxPages) {
699
- this.maxPages = maxPages;
700
- }
701
- return ListPagingSetMaxPagesAction;
702
- }());
703
-
704
- /**
705
- * @internal
706
- */
707
- var ListPagingSetItemsPerPageAction = /** @class */ (function () {
708
- function ListPagingSetItemsPerPageAction(itemsPerPage) {
709
- this.itemsPerPage = itemsPerPage;
710
- }
711
- return ListPagingSetItemsPerPageAction;
712
- }());
713
-
714
- /**
715
- * @internal
716
- */
717
- var ListPagingSetPageNumberAction = /** @class */ (function () {
718
- function ListPagingSetPageNumberAction(pageNumber) {
719
- this.pageNumber = pageNumber;
720
- }
721
- return ListPagingSetPageNumberAction;
722
- }());
723
-
724
- /**
725
- * @internal
726
- */
727
- var ListPagingOrchestrator = /** @class */ (function (_super) {
728
- __extends(ListPagingOrchestrator, _super);
729
- /* istanbul ignore next */
730
- function ListPagingOrchestrator() {
731
- var _this = _super.call(this) || this;
732
- _this
733
- .register(ListPagingSetMaxPagesAction, _this.setMaxPages)
734
- .register(ListPagingSetItemsPerPageAction, _this.setItemsPerPage)
735
- .register(ListPagingSetPageNumberAction, _this.setPageNumber);
736
- return _this;
737
- }
738
- ListPagingOrchestrator.prototype.setMaxPages = function (state, action) {
739
- return new ListPagingModel(Object.assign({}, state, { maxDisplayedPages: Number(action.maxPages) }));
740
- };
741
- ListPagingOrchestrator.prototype.setItemsPerPage = function (state, action) {
742
- return new ListPagingModel(Object.assign({}, state, { itemsPerPage: Number(action.itemsPerPage) }));
743
- };
744
- ListPagingOrchestrator.prototype.setPageNumber = function (state, action) {
745
- return new ListPagingModel(Object.assign({}, state, { pageNumber: Number(action.pageNumber) }));
746
- };
747
- return ListPagingOrchestrator;
748
- }(ListStateOrchestrator));
749
-
750
- /**
751
- * @internal
752
- */
753
- var ListViewsLoadAction = /** @class */ (function () {
754
- function ListViewsLoadAction(views) {
755
- this.views = views;
756
- }
757
- return ListViewsLoadAction;
758
- }());
759
-
760
- /**
761
- * @internal
762
- */
763
- var ListViewsOrchestrator = /** @class */ (function (_super) {
764
- __extends(ListViewsOrchestrator, _super);
765
- /* istanbul ignore next */
766
- function ListViewsOrchestrator() {
767
- var _this = _super.call(this) || this;
768
- _this
769
- .register(ListViewsSetActiveAction, _this.setActive)
770
- .register(ListViewsLoadAction, _this.load);
771
- return _this;
772
- }
773
- ListViewsOrchestrator.prototype.setActive = function (state, action) {
774
- return new ListViewsModel(Object.assign({}, state, { active: action.view }));
775
- };
776
- ListViewsOrchestrator.prototype.load = function (state, action) {
777
- return new ListViewsModel(Object.assign({}, state, { views: action.views }));
778
- };
779
- return ListViewsOrchestrator;
780
- }(ListStateOrchestrator));
781
-
782
- /**
783
- * @internal
784
- */
785
- var ListToolbarItemModel = /** @class */ (function () {
786
- function ListToolbarItemModel(data) {
787
- this.index = -1;
788
- if (data) {
789
- this.index = data.index;
790
- this.template = data.template;
791
- this.location = data.location;
792
- this.view = data.view;
793
- this.id = data.id;
794
- }
795
- }
796
- return ListToolbarItemModel;
797
- }());
798
-
799
- /**
800
- * @internal
801
- */
802
- var ListToolbarSetTypeAction = /** @class */ (function () {
803
- function ListToolbarSetTypeAction(type) {
804
- this.type = type;
805
- }
806
- return ListToolbarSetTypeAction;
807
- }());
808
-
809
- /**
810
- * @internal
811
- */
812
- var ListToolbarOrchestrator = /** @class */ (function (_super) {
813
- __extends(ListToolbarOrchestrator, _super);
814
- /* istanbul ignore next */
815
- function ListToolbarOrchestrator() {
816
- var _this = _super.call(this) || this;
817
- _this
818
- .register(ListToolbarSetExistsAction, _this.setExists)
819
- .register(ListToolbarItemsDisableAction, _this.setDisabled)
820
- .register(ListToolbarItemsLoadAction, _this.load)
821
- .register(ListToolbarSetTypeAction, _this.setType)
822
- .register(ListToolbarItemsRemoveAction, _this.remove)
823
- .register(ListToolbarShowMultiselectToolbarAction, _this.showMultiselectToolbar);
824
- return _this;
825
- }
826
- ListToolbarOrchestrator.prototype.setExists = function (state, action) {
827
- var newModel = new ListToolbarModel(state);
828
- newModel.exists = action.exists;
829
- return newModel;
830
- };
831
- ListToolbarOrchestrator.prototype.setDisabled = function (state, action) {
832
- var newModel = new ListToolbarModel(state);
833
- newModel.disabled = action.disable;
834
- return newModel;
835
- };
836
- ListToolbarOrchestrator.prototype.setType = function (state, action) {
837
- var newModel = new ListToolbarModel(state);
838
- newModel.type = action.type;
839
- return newModel;
840
- };
841
- ListToolbarOrchestrator.prototype.load = function (state, action) {
842
- var newModel = new ListToolbarModel(state);
843
- var newListItems = action.items.map(function (item) {
844
- /**
845
- * NOTE: Originally this function went off the action index and item models did not include
846
- * the index. We changed this but must leave functionality to convert the action index for
847
- * backwards compatibility.
848
- */
849
- if (!item.index) {
850
- item.index = action.index;
851
- }
852
- return new ListToolbarItemModel(item);
853
- });
854
- var items = __spread(state.items, newListItems);
855
- items = items.sort(function (a, b) {
856
- if (a.index < b.index) {
857
- return -1;
858
- }
859
- else if (a.index > b.index) {
860
- return 1;
861
- }
862
- else {
863
- return 0;
864
- }
865
- });
866
- newModel.items = items;
867
- return newModel;
868
- };
869
- ListToolbarOrchestrator.prototype.remove = function (state, action) {
870
- var newModel = new ListToolbarModel(state);
871
- newModel.items = newModel.items.filter(function (item) {
872
- return action.ids.indexOf(item.id) === -1;
873
- });
874
- return newModel;
875
- };
876
- ListToolbarOrchestrator.prototype.showMultiselectToolbar = function (state, action) {
877
- var newModel = new ListToolbarModel(state);
878
- newModel.showMultiselectToolbar = action.exists;
879
- return newModel;
880
- };
881
- return ListToolbarOrchestrator;
882
- }(ListStateOrchestrator));
883
-
884
- /**
885
- * @internal
886
- */
887
- var ListSearchOrchestrator = /** @class */ (function (_super) {
888
- __extends(ListSearchOrchestrator, _super);
889
- /* istanbul ignore next */
890
- function ListSearchOrchestrator() {
891
- var _this = _super.call(this) || this;
892
- _this
893
- .register(ListSearchSetSearchTextAction, _this.setSearchText)
894
- .register(ListSearchSetFunctionsAction, _this.setFunctions)
895
- .register(ListSearchSetFieldSelectorsAction, _this.setFieldSelectors)
896
- .register(ListSearchSetOptionsAction, _this.setOptions);
897
- return _this;
898
- }
899
- ListSearchOrchestrator.prototype.setSearchText = function (state, action) {
900
- return new ListSearchModel(Object.assign({}, state, { searchText: action.searchText ? action.searchText : '' }));
901
- };
902
- ListSearchOrchestrator.prototype.setFunctions = function (state, action) {
903
- return new ListSearchModel(Object.assign({}, state, { functions: __spread(action.functions) }));
904
- };
905
- ListSearchOrchestrator.prototype.setFieldSelectors = function (state, action) {
906
- return new ListSearchModel(Object.assign({}, state, { fieldSelectors: __spread(action.fieldSelectors) }));
907
- };
908
- ListSearchOrchestrator.prototype.setOptions = function (state, action) {
909
- var result = state;
910
- /* istanbul ignore else */
911
- if (action.searchTextAction) {
912
- result = this.setSearchText(result, action.searchTextAction);
913
- }
914
- /* istanbul ignore else */
915
- if (action.setFieldSelectorsAction) {
916
- result = this.setFieldSelectors(result, action.setFieldSelectorsAction);
917
- }
918
- /* istanbul ignore else */
919
- if (action.setFunctionsAction) {
920
- result = this.setFunctions(result, action.setFunctionsAction);
921
- }
922
- return result;
923
- };
924
- return ListSearchOrchestrator;
925
- }(ListStateOrchestrator));
926
-
927
- /**
928
- * @internal
929
- */
930
- var ListSelectedSetItemSelectedAction = /** @class */ (function () {
931
- function ListSelectedSetItemSelectedAction(id, selected) {
932
- this.id = id;
933
- this.selected = selected;
934
- }
935
- return ListSelectedSetItemSelectedAction;
936
- }());
937
-
938
- /**
939
- * @internal
940
- */
941
- var ListSelectedOrchestrator = /** @class */ (function (_super) {
942
- __extends(ListSelectedOrchestrator, _super);
943
- /* istanbul ignore next */
944
- function ListSelectedOrchestrator() {
945
- var _this = _super.call(this) || this;
946
- _this
947
- .register(ListSelectedSetLoadingAction, _this.setLoading)
948
- .register(ListSelectedSetItemSelectedAction, _this.setItemSelected)
949
- .register(ListSelectedSetItemsSelectedAction, _this.setItemsSelected)
950
- .register(ListSelectedLoadAction, _this.load);
951
- return _this;
952
- }
953
- ListSelectedOrchestrator.prototype.setLoading = function (state, action) {
954
- return new AsyncItem(state.item, state.lastUpdate, action.loading);
955
- };
956
- ListSelectedOrchestrator.prototype.load = function (state, action) {
957
- var newSelected = new ListSelectedModel();
958
- action.items.map(function (s) { return newSelected.selectedIdMap.set(s, true); });
959
- return new AsyncItem(Object.assign({}, state.item, newSelected), Date.now(), false);
960
- };
961
- ListSelectedOrchestrator.prototype.setItemSelected = function (state, action) {
962
- var newSelected = this.cloneListSelectedModel(state.item);
963
- newSelected.selectedIdMap.set(action.id, action.selected);
964
- return new AsyncItem(newSelected, state.lastUpdate, state.loading);
965
- };
966
- ListSelectedOrchestrator.prototype.setItemsSelected = function (state, action) {
967
- var newSelectedIds = action.items || [];
968
- var newListSelectedModel = action.refresh ? new ListSelectedModel() : this.cloneListSelectedModel(state.item);
969
- if (newSelectedIds instanceof Observable) {
970
- newSelectedIds
971
- .pipe(take(1))
972
- .subscribe(function (selectedIds) {
973
- selectedIds.map(function (s) { return newListSelectedModel.selectedIdMap.set(s, action.selected); });
974
- });
975
- }
976
- else {
977
- newSelectedIds.map(function (s) { return newListSelectedModel.selectedIdMap.set(s, action.selected); });
978
- }
979
- return new AsyncItem(newListSelectedModel, state.lastUpdate, state.loading);
980
- };
981
- ListSelectedOrchestrator.prototype.cloneListSelectedModel = function (source) {
982
- var newListItems = new ListSelectedModel();
983
- newListItems.selectedIdMap = new Map(source.selectedIdMap);
984
- return newListItems;
985
- };
986
- return ListSelectedOrchestrator;
987
- }(ListStateOrchestrator));
988
-
989
- /**
990
- * These properties are a work in progress, and we do not recommend using them.
991
- */
992
- var ListSortLabelModel = /** @class */ (function () {
993
- function ListSortLabelModel(data) {
994
- /**
995
- * Indicates whether to sort all fields.
996
- * @default false
997
- */
998
- this.global = false;
999
- /**
1000
- * Indicates whether to sort in descending order.
1001
- * @default false
1002
- */
1003
- this.descending = false;
1004
- if (data) {
1005
- this.text = data.text;
1006
- this.fieldType = data.fieldType;
1007
- this.fieldSelector = data.fieldSelector;
1008
- this.global = data.global;
1009
- this.descending = data.descending;
1010
- }
1011
- }
1012
- return ListSortLabelModel;
1013
- }());
1014
-
1015
- /**
1016
- * @internal
1017
- */
1018
- var ListSortOrchestrator = /** @class */ (function (_super) {
1019
- __extends(ListSortOrchestrator, _super);
1020
- /* istanbul ignore next */
1021
- function ListSortOrchestrator() {
1022
- var _this = _super.call(this) || this;
1023
- _this
1024
- .register(ListSortSetFieldSelectorsAction, _this.setFieldSelectors)
1025
- .register(ListSortSetAvailableAction, _this.setAvailable)
1026
- .register(ListSortSetGlobalAction, _this.setGlobal);
1027
- return _this;
1028
- }
1029
- ListSortOrchestrator.prototype.setFieldSelectors = function (state, action) {
1030
- return new ListSortModel(Object.assign({}, state, { fieldSelectors: action.fieldSelectors }));
1031
- };
1032
- ListSortOrchestrator.prototype.setAvailable = function (state, action) {
1033
- var newAvailable = action.available.map(function (available) { return new ListSortLabelModel(available); });
1034
- return new ListSortModel(Object.assign({}, state, { available: newAvailable }));
1035
- };
1036
- ListSortOrchestrator.prototype.setGlobal = function (state, action) {
1037
- var newGlobal = action.global.map(function (global) { return new ListSortLabelModel(global); });
1038
- return new ListSortModel(Object.assign({}, state, { global: newGlobal }));
1039
- };
1040
- return ListSortOrchestrator;
1041
- }(ListStateOrchestrator));
1042
-
1043
- /**
1044
- * @internal
1045
- */
1046
- var ListState = /** @class */ (function (_super) {
1047
- __extends(ListState, _super);
1048
- function ListState(dispatcher) {
1049
- var _this = _super.call(this, new ListStateModel(), dispatcher) || this;
1050
- _this
1051
- .register('filters', ListFiltersOrchestrator)
1052
- .register('items', ListItemsOrchestrator)
1053
- .register('paging', ListPagingOrchestrator)
1054
- .register('search', ListSearchOrchestrator)
1055
- .register('sort', ListSortOrchestrator)
1056
- .register('toolbar', ListToolbarOrchestrator)
1057
- .register('views', ListViewsOrchestrator)
1058
- .register('selected', ListSelectedOrchestrator)
1059
- .begin();
1060
- return _this;
1061
- }
1062
- ListState.ctorParameters = function () { return [
1063
- { type: ListStateDispatcher }
1064
- ]; };
1065
- ListState = __decorate([
1066
- Injectable()
1067
- ], ListState);
1068
- return ListState;
1069
- }(StateNode));
1070
-
1071
- var idIndex$1 = 0;
1072
- /**
1073
- * @internal
1074
- */
1075
- var ListViewComponent = /** @class */ (function () {
1076
- function ListViewComponent(state, defaultName) {
1077
- var _this = this;
1078
- this.viewId = "sky-list-view-cmp-" + ++idIndex$1;
1079
- this.state = state;
1080
- this.viewName = defaultName;
1081
- this.hasToolbar = this.state.pipe(map(function (s) { return s.toolbar.exists; }));
1082
- this.active = this.state.pipe(map(function (s) { return s.views.active === _this.viewId; }));
1083
- this.active.pipe(distinctUntilChanged()).subscribe(function (isActive) { return isActive ? _this.onViewActive() : _this.onViewInactive(); });
1084
- }
1085
- Object.defineProperty(ListViewComponent.prototype, "id", {
1086
- get: function () {
1087
- return this.viewId;
1088
- },
1089
- enumerable: true,
1090
- configurable: true
1091
- });
1092
- Object.defineProperty(ListViewComponent.prototype, "label", {
1093
- get: function () {
1094
- return this.viewName;
1095
- },
1096
- enumerable: true,
1097
- configurable: true
1098
- });
1099
- /* istanbul ignore next */
1100
- ListViewComponent.prototype.onViewActive = function () {
1101
- };
1102
- ListViewComponent.prototype.onViewInactive = function () {
1103
- };
1104
- return ListViewComponent;
1105
- }());
1106
-
1107
- /**
1108
- * @internal
1109
- */
1110
- var ListViewModel = /** @class */ (function () {
1111
- function ListViewModel(id, name) {
1112
- this.id = id;
1113
- this.name = name;
1114
- }
1115
- return ListViewModel;
1116
- }());
1117
-
1118
- var idIndex$2 = 0;
1119
- var SkyListComponent = /** @class */ (function () {
1120
- function SkyListComponent(state, dispatcher) {
1121
- this.state = state;
1122
- this.dispatcher = dispatcher;
1123
- this.id = "sky-list-cmp-" + ++idIndex$2;
1124
- /**
1125
- * Specifies the data to display. The list component requires this property or the
1126
- * `dataProvider` property. For checklist or multiselect grids, each row requires an
1127
- * `id` property to manage selected items with the `selectedIds` input and the
1128
- * `selectedIdsChange` event. If you do not provide an `id`, the list automatically
1129
- * generates one. To update data in your view outside of a `dataProvider`, you must use
1130
- * an observable instead of a static array.
1131
- */
1132
- this.data = [];
1133
- /**
1134
- * Specifies a set of filters to apply to list data.
1135
- * These filters create a filter summary when the list includes the
1136
- * [`sky-list-filter-summary`](https://developer.blackbaud.com/skyux/components/list/filters)
1137
- * component.
1138
- */
1139
- this.appliedFilters = [];
1140
- /**
1141
- * For list views that support item selection, emits the selected entries.
1142
- */
1143
- this.selectedIdsChange = new EventEmitter();
1144
- /**
1145
- * Emits the filters applied to the list.
1146
- */
1147
- this.appliedFiltersChange = new EventEmitter();
1148
- /* tslint:enable */
1149
- this.dataFirstLoad = false;
1150
- this.lastSelectedIds = [];
1151
- this.lastFilters = [];
1152
- this.ngUnsubscribe = new Subject();
1153
- }
1154
- SkyListComponent.prototype.ngAfterContentInit = function () {
1155
- var _this = this;
1156
- if (this.data && this.dataProvider && this.initialTotal) {
1157
- this.dataFirstLoad = true;
1158
- }
1159
- if (this.listViews.length > 0) {
1160
- var defaultView = (this.defaultView === undefined) ? this.listViews.first : this.defaultView;
1161
- this.dispatcher.next(new ListViewsLoadAction(this.listViews.map(function (v) { return new ListViewModel(v.id, v.label); })));
1162
- // activate the default view
1163
- this.dispatcher.next(new ListViewsSetActiveAction(defaultView.id));
1164
- }
1165
- else {
1166
- return;
1167
- }
1168
- // set sort fields
1169
- getValue(this.sortFields, function (sortFields) {
1170
- var sortArray;
1171
- if (!Array.isArray(sortFields) && sortFields) {
1172
- sortArray = [sortFields];
1173
- }
1174
- else {
1175
- sortArray = sortFields;
1176
- }
1177
- _this.dispatcher.next(new ListSortSetFieldSelectorsAction(sortArray || []));
1178
- });
1179
- this.displayedItems.subscribe(function (result) {
1180
- _this.dispatcher.next(new ListItemsSetLoadingAction());
1181
- _this.dispatcher.next(new ListItemsLoadAction(result.items, true, true, result.count));
1182
- });
1183
- // Watch for selection changes.
1184
- this.state
1185
- .pipe(map(function (current) { return current.selected; }), takeUntil(this.ngUnsubscribe), distinctUntilChanged())
1186
- .subscribe(function (selected) {
1187
- // Update lastSelectedIds to help us retain user selections.
1188
- var selectedIdsList = [];
1189
- selected.item.selectedIdMap.forEach(function (value, key) {
1190
- if (value === true) {
1191
- selectedIdsList.push(key);
1192
- }
1193
- });
1194
- // If changes are distinct, emit selectedIdsChange.
1195
- var distinctChanges = !_this.arraysEqual(_this.lastSelectedIds, selectedIdsList);
1196
- if (_this.selectedIdsChange.observers.length > 0 && distinctChanges) {
1197
- _this.selectedIdsChange.emit(selected.item.selectedIdMap);
1198
- }
1199
- _this.lastSelectedIds = selectedIdsList;
1200
- });
1201
- if (this.appliedFiltersChange.observers.length > 0) {
1202
- this.state
1203
- .pipe(map(function (current) { return current.filters; }), takeUntil(this.ngUnsubscribe), skip(1))
1204
- .subscribe(function (filters) {
1205
- /**
1206
- * We are doing this instead of a distinctUntilChange due to memory allocation issues
1207
- * with the javascript array. To fix fully the array should be changed to an object in
1208
- * a breaking change.
1209
- */
1210
- if (!_this.arraysEqual(filters, _this.lastFilters)) {
1211
- _this.lastFilters = filters.slice(0);
1212
- _this.appliedFiltersChange.emit(filters);
1213
- }
1214
- });
1215
- }
1216
- };
1217
- SkyListComponent.prototype.ngOnChanges = function (changes) {
1218
- var _this = this;
1219
- if (changes['appliedFilters'] &&
1220
- changes['appliedFilters'].currentValue !== changes['appliedFilters'].previousValue) {
1221
- this.state.pipe(take(1)).subscribe(function (currentState) {
1222
- if (currentState.paging.pageNumber && currentState.paging.pageNumber !== 1) {
1223
- _this.dispatcher.next(new ListPagingSetPageNumberAction(Number(1)));
1224
- }
1225
- _this.dispatcher.filtersUpdate(_this.appliedFilters);
1226
- });
1227
- }
1228
- if (changes['selectedIds']) {
1229
- // Only send selection changes to dispatcher if changes are distinct.
1230
- var newSelectedIds = changes['selectedIds'].currentValue;
1231
- if (!this.arraysEqual(newSelectedIds, this.lastSelectedIds)) {
1232
- this.dispatcher.setSelected(newSelectedIds, true, true);
1233
- }
1234
- }
1235
- };
1236
- SkyListComponent.prototype.ngOnDestroy = function () {
1237
- this.ngUnsubscribe.next();
1238
- this.ngUnsubscribe.complete();
1239
- };
1240
- SkyListComponent.prototype.refreshDisplayedItems = function () {
1241
- var _this = this;
1242
- this.displayedItems.pipe(take(1)).subscribe(function (result) {
1243
- _this.dispatcher.next(new ListItemsSetLoadingAction());
1244
- _this.dispatcher.next(new ListItemsLoadAction(result.items, true, true, result.count));
1245
- });
1246
- };
1247
- Object.defineProperty(SkyListComponent.prototype, "displayedItems", {
1248
- get: function () {
1249
- var _this = this;
1250
- if (!this.data && !this.dataProvider) {
1251
- throw new Error('List requires data or dataProvider to be set.');
1252
- }
1253
- var data = this.data;
1254
- if (!isObservable(data)) {
1255
- data = of(this.data);
1256
- }
1257
- if (!this.dataProvider) {
1258
- this.dataProvider = new SkyListInMemoryDataProvider(data, this.searchFunction);
1259
- }
1260
- var selectedIds = this.selectedIds || of([]);
1261
- if (!isObservable(selectedIds)) {
1262
- selectedIds = of(selectedIds);
1263
- }
1264
- var selectedChanged = false;
1265
- // This subject is used to cancel previous request to the list's data provider when a new change
1266
- // to the list's state occurs. In a future breaking change this should be replaced or coupled
1267
- // with adding a debounce time to the Observable which watches for state changes.
1268
- var cancelLastRequest = new Subject();
1269
- return combineLatest([
1270
- this.state.pipe(map(function (s) { return s.filters; }), distinctUntilChanged()),
1271
- this.state.pipe(map(function (s) { return s.search; }), distinctUntilChanged()),
1272
- this.state.pipe(map(function (s) { return s.sort.fieldSelectors; }), distinctUntilChanged()),
1273
- this.state.pipe(map(function (s) { return s.paging.itemsPerPage; }), distinctUntilChanged()),
1274
- this.state.pipe(map(function (s) { return s.paging.pageNumber; }), distinctUntilChanged()),
1275
- this.state.pipe(map(function (s) { return s.toolbar.disabled; }), distinctUntilChanged()),
1276
- selectedIds.pipe(distinctUntilChanged(), map(function (selected) {
1277
- selectedChanged = true;
1278
- return selected;
1279
- })),
1280
- data.pipe(distinctUntilChanged())
1281
- ], function (filters, search, sortFieldSelectors, itemsPerPage, pageNumber, isToolbarDisabled, selected, itemsData) {
1282
- cancelLastRequest.next();
1283
- cancelLastRequest.complete();
1284
- if (selectedChanged) {
1285
- _this.dispatcher.next(new ListSelectedSetLoadingAction());
1286
- _this.dispatcher.next(new ListSelectedLoadAction(selected));
1287
- _this.dispatcher.next(new ListSelectedSetLoadingAction(false));
1288
- selectedChanged = false;
1289
- }
1290
- var response;
1291
- if (_this.dataFirstLoad) {
1292
- _this.dataFirstLoad = false;
1293
- var initialItems = itemsData.map(function (d) { return new ListItemModel(d.id || "sky-list-item-model-" + ++idIndex$2, d); });
1294
- response = of(new ListDataResponseModel({
1295
- count: _this.initialTotal,
1296
- items: initialItems
1297
- })).pipe(takeUntil(cancelLastRequest));
1298
- }
1299
- else {
1300
- response = _this.dataProvider.get(new ListDataRequestModel({
1301
- filters: filters,
1302
- pageSize: itemsPerPage,
1303
- pageNumber: pageNumber,
1304
- search: search,
1305
- sort: new ListSortModel({ fieldSelectors: sortFieldSelectors }),
1306
- isToolbarDisabled: isToolbarDisabled
1307
- })).pipe(takeUntil(cancelLastRequest));
1308
- }
1309
- return response;
1310
- })
1311
- .pipe(takeUntil(this.ngUnsubscribe),
1312
- // Retain user selections from previous state.
1313
- // This is only necessary for grids component (based on item.isSelected).
1314
- map(function (response) {
1315
- return response.pipe(map(function (listDataResponseModel) {
1316
- return new ListDataResponseModel({
1317
- count: listDataResponseModel.count,
1318
- items: _this.getItemsAndRetainSelections(listDataResponseModel.items, _this.lastSelectedIds)
1319
- });
1320
- }));
1321
- }), flatMap(function (value) { return value; }));
1322
- },
1323
- enumerable: true,
1324
- configurable: true
1325
- });
1326
- Object.defineProperty(SkyListComponent.prototype, "selectedItems", {
1327
- get: function () {
1328
- return combineLatest(this.state.pipe(map(function (current) { return current.items.items; }), distinctUntilChanged()), this.state.pipe(map(function (current) { return current.selected; }), distinctUntilChanged()), function (items, selected) {
1329
- return items.filter(function (i) { return selected.item.selectedIdMap.get(i.id); });
1330
- }).pipe(takeUntil(this.ngUnsubscribe));
1331
- },
1332
- enumerable: true,
1333
- configurable: true
1334
- });
1335
- Object.defineProperty(SkyListComponent.prototype, "lastUpdate", {
1336
- get: function () {
1337
- return this.state
1338
- .pipe(takeUntil(this.ngUnsubscribe), map(function (s) {
1339
- return s.items.lastUpdate ? new Date(s.items.lastUpdate) : undefined;
1340
- }));
1341
- },
1342
- enumerable: true,
1343
- configurable: true
1344
- });
1345
- Object.defineProperty(SkyListComponent.prototype, "views", {
1346
- get: function () {
1347
- return this.listViews.toArray();
1348
- },
1349
- enumerable: true,
1350
- configurable: true
1351
- });
1352
- Object.defineProperty(SkyListComponent.prototype, "itemCount", {
1353
- get: function () {
1354
- return this.dataProvider.count();
1355
- },
1356
- enumerable: true,
1357
- configurable: true
1358
- });
1359
- SkyListComponent.prototype.getItemsAndRetainSelections = function (newList, selectedIds) {
1360
- var updatedListModel = newList.slice();
1361
- updatedListModel.forEach(function (item) {
1362
- item.isSelected = selectedIds.indexOf(item.id) > -1 ? true : false;
1363
- });
1364
- return updatedListModel;
1365
- };
1366
- SkyListComponent.prototype.arraysEqual = function (arrayA, arrayB) {
1367
- /* istanbul ignore next */
1368
- if (arrayA === arrayB) {
1369
- return true;
1370
- }
1371
- if (arrayA === undefined || arrayB === undefined) {
1372
- return false;
1373
- }
1374
- if (arrayA.length !== arrayB.length) {
1375
- return false;
1376
- }
1377
- for (var i = 0; i < arrayA.length; ++i) {
1378
- if (arrayA[i] !== arrayB[i]) {
1379
- return false;
1380
- }
1381
- }
1382
- return true;
1383
- };
1384
- SkyListComponent.ctorParameters = function () { return [
1385
- { type: ListState },
1386
- { type: ListStateDispatcher }
1387
- ]; };
1388
- __decorate([
1389
- Input()
1390
- ], SkyListComponent.prototype, "data", void 0);
1391
- __decorate([
1392
- Input()
1393
- ], SkyListComponent.prototype, "dataProvider", void 0);
1394
- __decorate([
1395
- Input()
1396
- ], SkyListComponent.prototype, "defaultView", void 0);
1397
- __decorate([
1398
- Input()
1399
- ], SkyListComponent.prototype, "initialTotal", void 0);
1400
- __decorate([
1401
- Input()
1402
- ], SkyListComponent.prototype, "selectedIds", void 0);
1403
- __decorate([
1404
- Input()
1405
- ], SkyListComponent.prototype, "sortFields", void 0);
1406
- __decorate([
1407
- Input()
1408
- ], SkyListComponent.prototype, "appliedFilters", void 0);
1409
- __decorate([
1410
- Output()
1411
- ], SkyListComponent.prototype, "selectedIdsChange", void 0);
1412
- __decorate([
1413
- Output()
1414
- ], SkyListComponent.prototype, "appliedFiltersChange", void 0);
1415
- __decorate([
1416
- Input('search')
1417
- ], SkyListComponent.prototype, "searchFunction", void 0);
1418
- __decorate([
1419
- ContentChildren(ListViewComponent)
1420
- ], SkyListComponent.prototype, "listViews", void 0);
1421
- SkyListComponent = __decorate([
1422
- Component({
1423
- selector: 'sky-list',
1424
- template: '<ng-content></ng-content>',
1425
- providers: [ListState, ListStateDispatcher],
1426
- changeDetection: ChangeDetectionStrategy.OnPush
1427
- })
1428
- ], SkyListComponent);
1429
- return SkyListComponent;
1430
- }());
1431
-
1432
- var SkyListModule = /** @class */ (function () {
1433
- function SkyListModule() {
1434
- }
1435
- SkyListModule = __decorate([
1436
- NgModule({
1437
- declarations: [
1438
- SkyListComponent
1439
- ],
1440
- imports: [
1441
- CommonModule
1442
- ],
1443
- exports: [
1444
- SkyListComponent
1445
- ]
1446
- })
1447
- ], SkyListModule);
1448
- return SkyListModule;
1449
- }());
1450
-
1451
- var ListFilterModel = /** @class */ (function () {
1452
- function ListFilterModel(data) {
1453
- /**
1454
- * Indicates whether users can dismiss the filter's summary item.
1455
- * @default true
1456
- */
1457
- this.dismissible = true;
1458
- if (data) {
1459
- this.name = data.name;
1460
- this.label = data.label;
1461
- this.filterFunction = data.filterFunction;
1462
- this.value = data.value;
1463
- this.dismissible = data.dismissible;
1464
- this.defaultValue = data.defaultValue;
1465
- }
1466
- }
1467
- return ListFilterModel;
1468
- }());
1469
-
1470
- /**
1471
- * @internal
1472
- */
1473
- var SkyListFilterInlineModel = /** @class */ (function () {
1474
- function SkyListFilterInlineModel(data) {
1475
- this.onChange = new EventEmitter();
1476
- if (data) {
1477
- this.name = data.name;
1478
- this.filterFunction = data.filterFunction;
1479
- this.value = data.value;
1480
- this.template = data.template;
1481
- this.defaultValue = data.defaultValue;
1482
- }
1483
- }
1484
- SkyListFilterInlineModel.prototype.changed = function (value) {
1485
- this.value = value;
1486
- this.onChange.emit(value);
1487
- };
1488
- return SkyListFilterInlineModel;
1489
- }());
1490
-
1491
- /**
1492
- * Contains a filter button for the list toolbar. Place a
1493
- * [`sky-filter-button`](https://developer.blackbaud.com/skyux/components/filter)
1494
- * component inside this component to open a modal with filtering options.
1495
- * To apply filter options, use the
1496
- * [list component's](https://developer.blackbaud.com/skyux/components/list/overview#list-properties)
1497
- * `appliedFilters` property.
1498
- */
1499
- var SkyListFilterButtonComponent = /** @class */ (function () {
1500
- function SkyListFilterButtonComponent(dispatcher) {
1501
- this.dispatcher = dispatcher;
1502
- this.filterButtonItemToolbarIndex = 5000;
1503
- }
1504
- SkyListFilterButtonComponent.prototype.ngAfterViewInit = function () {
1505
- this.dispatcher.toolbarAddItems([
1506
- new ListToolbarItemModel({
1507
- template: this.filterButtonTemplate,
1508
- location: 'left',
1509
- index: this.filterButtonItemToolbarIndex
1510
- })
1511
- ]);
1512
- };
1513
- SkyListFilterButtonComponent.ctorParameters = function () { return [
1514
- { type: ListStateDispatcher }
1515
- ]; };
1516
- __decorate([
1517
- ViewChild('filterButton', {
1518
- read: TemplateRef,
1519
- static: true
1520
- })
1521
- ], SkyListFilterButtonComponent.prototype, "filterButtonTemplate", void 0);
1522
- SkyListFilterButtonComponent = __decorate([
1523
- Component({
1524
- selector: 'sky-list-filter-button',
1525
- template: "<ng-template #filterButton>\n <ng-content></ng-content>\n</ng-template>\n"
1526
- })
1527
- ], SkyListFilterButtonComponent);
1528
- return SkyListFilterButtonComponent;
1529
- }());
1530
-
1531
- /**
1532
- * Creates a filter summary based on the
1533
- * [list component's](https://developer.blackbaud.com/skyux/components/list/overview#list-properties)
1534
- * `appliedFilters` property. Place this component within the
1535
- * [`sky-list-toolbar`](https://developer.blackbaud.com/skyux/components/list/toolbar) component.
1536
- */
1537
- var SkyListFilterSummaryComponent = /** @class */ (function () {
1538
- function SkyListFilterSummaryComponent(state, dispatcher) {
1539
- this.state = state;
1540
- this.dispatcher = dispatcher;
1541
- /**
1542
- * Emits a `ListFilterModel` when users select a summary item. A common use case is
1543
- * to open a filter modal when this event is received.
1544
- */
1545
- this.summaryItemClick = new EventEmitter();
1546
- }
1547
- SkyListFilterSummaryComponent.prototype.ngAfterContentInit = function () {
1548
- var _this = this;
1549
- // The setTimeout here is to ensure we avoid any ExpressionChangedAfterItHasBeenCheckedError issues.
1550
- setTimeout(function () {
1551
- _this.appliedFilters = _this.state.pipe(map(function (state) {
1552
- return state.filters.filter(function (filter) {
1553
- return filter.value !== '' &&
1554
- filter.value !== undefined &&
1555
- filter.value !== false &&
1556
- filter.value !== filter.defaultValue;
1557
- });
1558
- }));
1559
- });
1560
- };
1561
- SkyListFilterSummaryComponent.prototype.filterSummaryItemDismiss = function (index) {
1562
- var _this = this;
1563
- this.appliedFilters.pipe(take(1)).subscribe(function (filters) {
1564
- filters.splice(index, 1);
1565
- _this.dispatcher.filtersUpdate(filters.slice());
1566
- });
1567
- };
1568
- SkyListFilterSummaryComponent.prototype.filterSummaryItemClick = function (item) {
1569
- this.summaryItemClick.emit(item);
1570
- };
1571
- SkyListFilterSummaryComponent.ctorParameters = function () { return [
1572
- { type: ListState },
1573
- { type: ListStateDispatcher }
1574
- ]; };
1575
- __decorate([
1576
- Output()
1577
- ], SkyListFilterSummaryComponent.prototype, "summaryItemClick", void 0);
1578
- SkyListFilterSummaryComponent = __decorate([
1579
- Component({
1580
- selector: 'sky-list-filter-summary',
1581
- template: "<sky-filter-summary>\n <sky-filter-summary-item\n *ngFor=\"let item of appliedFilters | async; let i = index\"\n (dismiss)=\"filterSummaryItemDismiss(i)\"\n (itemClick)=\"filterSummaryItemClick(item)\"\n [dismissible]=\"item.dismissible\"\n >\n {{item.label || item.value}}\n </sky-filter-summary-item>\n</sky-filter-summary>\n"
1582
- })
1583
- ], SkyListFilterSummaryComponent);
1584
- return SkyListFilterSummaryComponent;
1585
- }());
1586
-
1587
- /**
1588
- * Creates a filter in the list's inline filter area.
1589
- */
1590
- var SkyListFilterInlineItemComponent = /** @class */ (function () {
1591
- function SkyListFilterInlineItemComponent() {
1592
- /* tslint:enable:no-input-rename */
1593
- this.onChange = new EventEmitter();
1594
- }
1595
- SkyListFilterInlineItemComponent.prototype.ngOnInit = function () {
1596
- if (this.name === undefined || this.name.length === 0) {
1597
- throw new Error('Inline filter requires a name.');
1598
- }
1599
- };
1600
- Object.defineProperty(SkyListFilterInlineItemComponent.prototype, "template", {
1601
- get: function () {
1602
- return this.templates.length > 0 ? this.templates.first : this.templateInput;
1603
- },
1604
- enumerable: true,
1605
- configurable: true
1606
- });
1607
- __decorate([
1608
- Input()
1609
- ], SkyListFilterInlineItemComponent.prototype, "name", void 0);
1610
- __decorate([
1611
- Input()
1612
- ], SkyListFilterInlineItemComponent.prototype, "value", void 0);
1613
- __decorate([
1614
- Input()
1615
- ], SkyListFilterInlineItemComponent.prototype, "defaultValue", void 0);
1616
- __decorate([
1617
- Input('filter')
1618
- ], SkyListFilterInlineItemComponent.prototype, "filterFunction", void 0);
1619
- __decorate([
1620
- Input('template')
1621
- ], SkyListFilterInlineItemComponent.prototype, "templateInput", void 0);
1622
- __decorate([
1623
- ContentChildren(TemplateRef)
1624
- ], SkyListFilterInlineItemComponent.prototype, "templates", void 0);
1625
- SkyListFilterInlineItemComponent = __decorate([
1626
- Component({
1627
- selector: 'sky-list-filter-inline-item',
1628
- template: '<ng-content></ng-content>'
1629
- })
1630
- ], SkyListFilterInlineItemComponent);
1631
- return SkyListFilterInlineItemComponent;
1632
- }());
1633
-
1634
- /**
1635
- * Creates an inline filter area for the list. Place each filter
1636
- * in a `sky-list-filter-inline-item` component.
1637
- */
1638
- var SkyListFilterInlineComponent = /** @class */ (function () {
1639
- function SkyListFilterInlineComponent(dispatcher, state) {
1640
- this.dispatcher = dispatcher;
1641
- this.state = state;
1642
- this.inlineFilters = [];
1643
- }
1644
- SkyListFilterInlineComponent.prototype.ngAfterContentInit = function () {
1645
- var _this = this;
1646
- this.inlineFilters = this.filters.map(function (filter) {
1647
- return new SkyListFilterInlineModel({
1648
- name: filter.name,
1649
- filterFunction: filter.filterFunction,
1650
- template: filter.template,
1651
- value: filter.value,
1652
- defaultValue: filter.defaultValue
1653
- });
1654
- });
1655
- this.inlineFilters.forEach(function (filter) {
1656
- filter.onChange.subscribe(function (value) {
1657
- _this.applyFilters();
1658
- });
1659
- });
1660
- this.dispatcher.filtersUpdate(this.getFilterModelFromInline(this.inlineFilters));
1661
- };
1662
- SkyListFilterInlineComponent.prototype.applyFilters = function () {
1663
- var _this = this;
1664
- this.state.pipe(take(1)).subscribe(function (currentState) {
1665
- if (currentState.paging.pageNumber && currentState.paging.pageNumber !== 1) {
1666
- _this.dispatcher.next(new ListPagingSetPageNumberAction(Number(1)));
1667
- }
1668
- _this.dispatcher.filtersUpdate(_this.getFilterModelFromInline(_this.inlineFilters));
1669
- });
1670
- };
1671
- SkyListFilterInlineComponent.prototype.getFilterModelFromInline = function (inlineFilters) {
1672
- return inlineFilters.map(function (filter) {
1673
- return new ListFilterModel({
1674
- name: filter.name,
1675
- value: filter.value,
1676
- filterFunction: filter.filterFunction,
1677
- defaultValue: filter.defaultValue
1678
- });
1679
- });
1680
- };
1681
- SkyListFilterInlineComponent.ctorParameters = function () { return [
1682
- { type: ListStateDispatcher },
1683
- { type: ListState }
1684
- ]; };
1685
- __decorate([
1686
- ContentChildren(SkyListFilterInlineItemComponent)
1687
- ], SkyListFilterInlineComponent.prototype, "filters", void 0);
1688
- SkyListFilterInlineComponent = __decorate([
1689
- Component({
1690
- selector: 'sky-list-filter-inline',
1691
- template: "<ng-content></ng-content>\n\n<sky-filter-inline>\n <sky-filter-inline-item\n *ngFor=\"let filter of inlineFilters\">\n <sky-list-filter-inline-item-renderer\n [template]=\"filter.template\"\n [filter]=\"filter\">\n </sky-list-filter-inline-item-renderer>\n </sky-filter-inline-item>\n</sky-filter-inline>\n"
1692
- })
1693
- ], SkyListFilterInlineComponent);
1694
- return SkyListFilterInlineComponent;
1695
- }());
1696
-
1697
- /**
1698
- * @internal
1699
- */
1700
- var SkyListFilterInlineItemRendererComponent = /** @class */ (function () {
1701
- function SkyListFilterInlineItemRendererComponent() {
1702
- }
1703
- SkyListFilterInlineItemRendererComponent.prototype.ngOnInit = function () {
1704
- /* istanbul ignore else */
1705
- /* sanity check */
1706
- if (this.template !== undefined) {
1707
- this.container.createEmbeddedView(this.template, this);
1708
- }
1709
- };
1710
- __decorate([
1711
- Input()
1712
- ], SkyListFilterInlineItemRendererComponent.prototype, "template", void 0);
1713
- __decorate([
1714
- Input()
1715
- ], SkyListFilterInlineItemRendererComponent.prototype, "filter", void 0);
1716
- __decorate([
1717
- ViewChild('container', {
1718
- read: ViewContainerRef,
1719
- static: true
1720
- })
1721
- ], SkyListFilterInlineItemRendererComponent.prototype, "container", void 0);
1722
- SkyListFilterInlineItemRendererComponent = __decorate([
1723
- Component({
1724
- selector: 'sky-list-filter-inline-item-renderer',
1725
- template: '<ng-template #container></ng-template>'
1726
- })
1727
- ], SkyListFilterInlineItemRendererComponent);
1728
- return SkyListFilterInlineItemRendererComponent;
1729
- }());
1730
-
1731
- var SkyListFiltersModule = /** @class */ (function () {
1732
- function SkyListFiltersModule() {
1733
- }
1734
- SkyListFiltersModule = __decorate([
1735
- NgModule({
1736
- declarations: [
1737
- SkyListFilterButtonComponent,
1738
- SkyListFilterSummaryComponent,
1739
- SkyListFilterInlineItemComponent,
1740
- SkyListFilterInlineComponent,
1741
- SkyListFilterInlineItemRendererComponent
1742
- ],
1743
- imports: [
1744
- CommonModule,
1745
- SkyFilterModule
1746
- ],
1747
- exports: [
1748
- SkyListFilterButtonComponent,
1749
- SkyListFilterSummaryComponent,
1750
- SkyListFilterInlineItemComponent,
1751
- SkyListFilterInlineComponent,
1752
- SkyListFilterInlineItemRendererComponent
1753
- ]
1754
- })
1755
- ], SkyListFiltersModule);
1756
- return SkyListFiltersModule;
1757
- }());
1758
-
1759
- /**
1760
- * Provides a SKY UX-themed pagination control to display list data across multiple pages.
1761
- * @internal
1762
- */
1763
- var ListPagingComponent = /** @class */ (function () {
1764
- function ListPagingComponent(state, dispatcher) {
1765
- this.initialized = new BehaviorSubject(false);
1766
- this.state = state;
1767
- this.dispatcher = dispatcher;
1768
- }
1769
- return ListPagingComponent;
1770
- }());
1771
-
1772
- /**
1773
- * Displays a pagination control for a SKY UX-themed list of data.
1774
- */
1775
- var SkyListPagingComponent = /** @class */ (function (_super) {
1776
- __extends(SkyListPagingComponent, _super);
1777
- function SkyListPagingComponent(state, dispatcher) {
1778
- var _this = _super.call(this, state, dispatcher) || this;
1779
- /**
1780
- * Specifies the number of list items per page.
1781
- * @default 10
1782
- */
1783
- _this.pageSize = 10;
1784
- /**
1785
- * Specifies the maximum pages to display.
1786
- * @default 5
1787
- */
1788
- _this.maxPages = 5;
1789
- /**
1790
- * Specifies the current page number.
1791
- * @default 1
1792
- */
1793
- _this.pageNumber = 1;
1794
- return _this;
1795
- }
1796
- SkyListPagingComponent_1 = SkyListPagingComponent;
1797
- SkyListPagingComponent.prototype.ngOnInit = function () {
1798
- var _this = this;
1799
- this.currentPageNumber = this.state.pipe(map(function (s) { return s.paging.pageNumber; }));
1800
- this.maxDisplayedPages = this.state.pipe(map(function (s) { return s.paging.maxDisplayedPages; }));
1801
- this.itemsPerPage = this.state.pipe(map(function (s) { return s.paging.itemsPerPage; }));
1802
- this.itemCount = this.state
1803
- .pipe(map(function (s) {
1804
- return s.items;
1805
- }), scan(function (previousValue, newValue) {
1806
- if (previousValue.lastUpdate > newValue.lastUpdate) {
1807
- return previousValue;
1808
- }
1809
- else {
1810
- return newValue;
1811
- }
1812
- }), map(function (result) {
1813
- return result.count;
1814
- }), distinctUntilChanged());
1815
- // subscribe to or use inputs
1816
- getValue(this.pageSize, function (pageSize) {
1817
- return _this.dispatcher.next(new ListPagingSetItemsPerPageAction(Number(pageSize)));
1818
- });
1819
- getValue(this.maxPages, function (maxPages) {
1820
- return _this.dispatcher.next(new ListPagingSetMaxPagesAction(Number(maxPages)));
1821
- });
1822
- getValue(this.pageNumber, function (pageNumber) {
1823
- return _this.dispatcher.next(new ListPagingSetPageNumberAction(Number(pageNumber)));
1824
- });
1825
- };
1826
- SkyListPagingComponent.prototype.pageChange = function (currentPage) {
1827
- var _this = this;
1828
- // Paging must be updated after list data has been updated.
1829
- // Adding a setTimeout will pull it out of the stream.
1830
- setTimeout(function () {
1831
- _this.dispatcher.next(new ListPagingSetPageNumberAction(Number(currentPage)));
1832
- });
1833
- };
1834
- var SkyListPagingComponent_1;
1835
- SkyListPagingComponent.ctorParameters = function () { return [
1836
- { type: ListState },
1837
- { type: ListStateDispatcher }
1838
- ]; };
1839
- __decorate([
1840
- Input()
1841
- ], SkyListPagingComponent.prototype, "pageSize", void 0);
1842
- __decorate([
1843
- Input()
1844
- ], SkyListPagingComponent.prototype, "maxPages", void 0);
1845
- __decorate([
1846
- Input()
1847
- ], SkyListPagingComponent.prototype, "pageNumber", void 0);
1848
- SkyListPagingComponent = SkyListPagingComponent_1 = __decorate([
1849
- Component({
1850
- selector: 'sky-list-paging',
1851
- template: "<sky-paging\n [pageSize]=\"itemsPerPage | async\"\n [maxPages]=\"maxDisplayedPages | async\"\n [currentPage]=\"currentPageNumber | async\"\n [itemCount]=\"itemCount | async\"\n (currentPageChange)=\"pageChange($event)\"\n >\n</sky-paging>\n",
1852
- providers: [
1853
- /* tslint:disable */
1854
- { provide: ListPagingComponent, useExisting: forwardRef(function () { return SkyListPagingComponent_1; }) }
1855
- /* tslint:enable */
1856
- ],
1857
- changeDetection: ChangeDetectionStrategy.OnPush
1858
- })
1859
- ], SkyListPagingComponent);
1860
- return SkyListPagingComponent;
1861
- }(ListPagingComponent));
1862
-
1863
- var SkyListPagingModule = /** @class */ (function () {
1864
- function SkyListPagingModule() {
1865
- }
1866
- SkyListPagingModule = __decorate([
1867
- NgModule({
1868
- declarations: [
1869
- SkyListPagingComponent
1870
- ],
1871
- imports: [
1872
- CommonModule,
1873
- SkyPagingModule
1874
- ],
1875
- exports: [
1876
- SkyListPagingComponent
1877
- ]
1878
- })
1879
- ], SkyListPagingModule);
1880
- return SkyListPagingModule;
1881
- }());
1882
-
1883
- var SkyListBuilderResourcesProvider = /** @class */ (function () {
1884
- function SkyListBuilderResourcesProvider() {
1885
- this.resources = { "EN-US": { "skyux_list_show_secondary_actions_button": "More", "skyux_list_multiselect_clear_all": "Clear all", "skyux_list_mutliselect_select_all": "Select all", "skyux_list_mutliselect_show_selected": "Only show selected items", "skyux_list_view_switcher_dropdown_title": "Select view" } };
1886
- }
1887
- SkyListBuilderResourcesProvider.prototype.getString = function (localeInfo, name) {
1888
- return getStringForLocale(this.resources, localeInfo.locale, name);
1889
- };
1890
- SkyListBuilderResourcesProvider = __decorate([
1891
- Injectable()
1892
- ], SkyListBuilderResourcesProvider);
1893
- return SkyListBuilderResourcesProvider;
1894
- }());
1895
-
1896
- var SkyListBuilderResourcesModule = /** @class */ (function () {
1897
- function SkyListBuilderResourcesModule() {
1898
- }
1899
- SkyListBuilderResourcesModule = __decorate([
1900
- NgModule({
1901
- providers: [{
1902
- provide: SKY_LIB_RESOURCES_PROVIDERS,
1903
- useClass: SkyListBuilderResourcesProvider,
1904
- multi: true
1905
- }]
1906
- })
1907
- ], SkyListBuilderResourcesModule);
1908
- return SkyListBuilderResourcesModule;
1909
- }());
1910
-
1911
- /**
1912
- * @internal
1913
- */
1914
- var SkyListSecondaryActionsService = /** @class */ (function () {
1915
- function SkyListSecondaryActionsService() {
1916
- this.secondaryActionsCount = 0;
1917
- this.secondaryActionsSubject = new BehaviorSubject(0);
1918
- this.actionsStream = new BehaviorSubject([]);
1919
- this.actions = [];
1920
- }
1921
- SkyListSecondaryActionsService.prototype.addSecondaryAction = function (action) {
1922
- this.secondaryActionsCount++;
1923
- this.secondaryActionsSubject.next(this.secondaryActionsCount);
1924
- this.actions.push(action);
1925
- this.actionsStream.next(this.actions);
1926
- };
1927
- SkyListSecondaryActionsService.prototype.removeSecondaryAction = function (action) {
1928
- this.secondaryActionsCount--;
1929
- this.secondaryActionsSubject.next(this.secondaryActionsCount);
1930
- this.actions = this.actions.filter(function (existingItem) { return existingItem !== action; });
1931
- this.actionsStream.next(this.actions);
1932
- };
1933
- SkyListSecondaryActionsService.prototype.ngOnDestroy = function () {
1934
- this.secondaryActionsSubject.complete();
1935
- this.actionsStream.complete();
1936
- };
1937
- SkyListSecondaryActionsService = __decorate([
1938
- Injectable()
1939
- ], SkyListSecondaryActionsService);
1940
- return SkyListSecondaryActionsService;
1941
- }());
1942
-
1943
- /**
1944
- * Adds a dropdown to the list toolbar for secondary actions. If the dropdown does not
1945
- * include actions, the secondary actions dropdown is hidden.
1946
- */
1947
- var SkyListSecondaryActionsComponent = /** @class */ (function () {
1948
- function SkyListSecondaryActionsComponent(dispatcher) {
1949
- this.dispatcher = dispatcher;
1950
- this.actions = [];
1951
- this.secondaryActionsItemToolbarIndex = 5000;
1952
- }
1953
- SkyListSecondaryActionsComponent.prototype.ngAfterViewInit = function () {
1954
- var secondaryActionItem = new ListToolbarItemModel({
1955
- id: 'secondary-actions',
1956
- template: this.secondaryActionsTemplate,
1957
- location: 'center',
1958
- index: this.secondaryActionsItemToolbarIndex
1959
- });
1960
- this.dispatcher.toolbarAddItems([
1961
- secondaryActionItem
1962
- ]);
1963
- };
1964
- SkyListSecondaryActionsComponent.ctorParameters = function () { return [
1965
- { type: ListStateDispatcher }
1966
- ]; };
1967
- __decorate([
1968
- ViewChild('secondaryActions', {
1969
- read: TemplateRef,
1970
- static: true
1971
- })
1972
- ], SkyListSecondaryActionsComponent.prototype, "secondaryActionsTemplate", void 0);
1973
- SkyListSecondaryActionsComponent = __decorate([
1974
- Component({
1975
- selector: 'sky-list-secondary-actions',
1976
- template: "<ng-template #secondaryActions>\n <sky-list-secondary-actions-host>\n <ng-content></ng-content>\n </sky-list-secondary-actions-host>\n</ng-template>\n",
1977
- providers: [
1978
- SkyListSecondaryActionsService
1979
- ],
1980
- changeDetection: ChangeDetectionStrategy.OnPush
1981
- })
1982
- ], SkyListSecondaryActionsComponent);
1983
- return SkyListSecondaryActionsComponent;
1984
- }());
1985
-
1986
- /**
1987
- * Adds actions to the secondary actions dropdown in the list toolbar.
1988
- */
1989
- var SkyListSecondaryActionComponent = /** @class */ (function () {
1990
- function SkyListSecondaryActionComponent(actionService) {
1991
- this.actionService = actionService;
1992
- }
1993
- SkyListSecondaryActionComponent.prototype.ngAfterContentInit = function () {
1994
- this.actionService.addSecondaryAction({
1995
- template: this.templateRef
1996
- });
1997
- };
1998
- SkyListSecondaryActionComponent.ctorParameters = function () { return [
1999
- { type: SkyListSecondaryActionsService }
2000
- ]; };
2001
- __decorate([
2002
- ViewChild('listSecondaryAction', {
2003
- read: TemplateRef,
2004
- static: true
2005
- })
2006
- ], SkyListSecondaryActionComponent.prototype, "templateRef", void 0);
2007
- SkyListSecondaryActionComponent = __decorate([
2008
- Component({
2009
- selector: 'sky-list-secondary-action',
2010
- template: "<ng-template #listSecondaryAction>\n <ng-content></ng-content>\n</ng-template>\n"
2011
- })
2012
- ], SkyListSecondaryActionComponent);
2013
- return SkyListSecondaryActionComponent;
2014
- }());
2015
-
2016
- // Note: this component is needed to ensure any reactive styles placed in the element have
2017
- // their host to be based off of. Without this component the host is not written via the dispatcher.
2018
- /**
2019
- * @internal
2020
- */
2021
- var SkyListSecondaryActionsHostComponent = /** @class */ (function () {
2022
- function SkyListSecondaryActionsHostComponent(changeDetector, actionService) {
2023
- this.changeDetector = changeDetector;
2024
- this.actionService = actionService;
2025
- this.dropdownHidden = false;
2026
- this.actions = [];
2027
- this.ngUnsubscribe = new Subject();
2028
- }
2029
- SkyListSecondaryActionsHostComponent.prototype.ngOnInit = function () {
2030
- var _this = this;
2031
- this.actionService.actionsStream
2032
- .pipe(takeUntil(this.ngUnsubscribe), distinctUntilChanged())
2033
- .subscribe(function (actions) {
2034
- var hasSecondaryActions = (actions.length > 0);
2035
- _this.dropdownHidden = !hasSecondaryActions;
2036
- _this.actions = actions;
2037
- _this.changeDetector.detectChanges();
2038
- });
2039
- };
2040
- SkyListSecondaryActionsHostComponent.prototype.ngOnDestroy = function () {
2041
- this.ngUnsubscribe.next();
2042
- this.ngUnsubscribe.complete();
2043
- };
2044
- SkyListSecondaryActionsHostComponent.ctorParameters = function () { return [
2045
- { type: ChangeDetectorRef },
2046
- { type: SkyListSecondaryActionsService }
2047
- ]; };
2048
- SkyListSecondaryActionsHostComponent = __decorate([
2049
- Component({
2050
- selector: 'sky-list-secondary-actions-host',
2051
- template: "<div\n class=\"sky-list-secondary-actions\"\n [ngClass]=\"{ 'sky-list-secondary-actions-hidden': dropdownHidden }\"\n>\n <sky-dropdown\n [attr.title]=\"'skyux_list_show_secondary_actions_button' | skyLibResources\"\n [label]=\"'skyux_list_show_secondary_actions_button' | skyLibResources\"\n >\n <sky-dropdown-button>\n <sky-icon\n icon=\"ellipsis-h\"\n >\n </sky-icon>\n <span\n class=\"sky-list-secondary-actions-btn-text\"\n >\n {{ 'skyux_list_show_secondary_actions_button' | skyLibResources }}\n </span>\n </sky-dropdown-button>\n <sky-dropdown-menu>\n <sky-dropdown-item *ngFor=\"let action of actions\">\n <ng-container *ngTemplateOutlet=\"action.template\">\n </ng-container>\n </sky-dropdown-item>\n </sky-dropdown-menu>\n </sky-dropdown>\n</div>\n<ng-content>\n</ng-content>\n",
2052
- changeDetection: ChangeDetectionStrategy.OnPush,
2053
- styles: [".sky-list-secondary-actions ::ng-deep .sky-dropdown-button-type-select{padding:6px 12px}.sky-list-secondary-actions ::ng-deep .sky-dropdown-button-type-select sky-icon[icon=ellipsis-h]{font-size:1.33333em;line-height:.75em;vertical-align:-15%}.sky-list-secondary-actions-hidden{display:none}:host .sky-list-secondary-actions-btn-text{display:none}:host .sky-list-secondary-actions ::ng-deep .sky-dropdown-caret{display:none}:host-context(.sky-responsive-container-lg) .sky-list-secondary-actions-btn-text,:host-context(.sky-responsive-container-md) .sky-list-secondary-actions-btn-text,:host-context(.sky-responsive-container-sm) .sky-list-secondary-actions-btn-text,:host-context(.sky-responsive-container-xs) .sky-list-secondary-actions-btn-text{display:none}:host-context(.sky-responsive-container-lg) .sky-list-secondary-actions ::ng-deep .sky-dropdown-caret,:host-context(.sky-responsive-container-md) .sky-list-secondary-actions ::ng-deep .sky-dropdown-caret,:host-context(.sky-responsive-container-sm) .sky-list-secondary-actions ::ng-deep .sky-dropdown-caret,:host-context(.sky-responsive-container-xs) .sky-list-secondary-actions ::ng-deep .sky-dropdown-caret{display:none}@media (min-width:768px){:host .sky-list-secondary-actions-btn-text{display:inline}:host .sky-list-secondary-actions ::ng-deep .sky-dropdown-caret{display:inline-block}}:host-context(.sky-responsive-container-lg) .sky-list-secondary-actions-btn-text,:host-context(.sky-responsive-container-md) .sky-list-secondary-actions-btn-text,:host-context(.sky-responsive-container-sm) .sky-list-secondary-actions-btn-text{display:inline}:host-context(.sky-responsive-container-lg) .sky-list-secondary-actions ::ng-deep .sky-dropdown-caret,:host-context(.sky-responsive-container-md) .sky-list-secondary-actions ::ng-deep .sky-dropdown-caret,:host-context(.sky-responsive-container-sm) .sky-list-secondary-actions ::ng-deep .sky-dropdown-caret{display:inline-block}"]
2054
- })
2055
- ], SkyListSecondaryActionsHostComponent);
2056
- return SkyListSecondaryActionsHostComponent;
2057
- }());
2058
-
2059
- var SkyListSecondaryActionsModule = /** @class */ (function () {
2060
- function SkyListSecondaryActionsModule() {
2061
- }
2062
- SkyListSecondaryActionsModule = __decorate([
2063
- NgModule({
2064
- declarations: [
2065
- SkyListSecondaryActionsComponent,
2066
- SkyListSecondaryActionsHostComponent,
2067
- SkyListSecondaryActionComponent
2068
- ],
2069
- imports: [
2070
- CommonModule,
2071
- SkyDropdownModule,
2072
- SkyI18nModule,
2073
- SkyIconModule,
2074
- SkyListBuilderResourcesModule
2075
- ],
2076
- exports: [
2077
- SkyListSecondaryActionsComponent,
2078
- SkyListSecondaryActionsHostComponent,
2079
- SkyListSecondaryActionComponent
2080
- ]
2081
- })
2082
- ], SkyListSecondaryActionsModule);
2083
- return SkyListSecondaryActionsModule;
2084
- }());
2085
-
2086
- var idIndex$3 = 0;
2087
- /**
2088
- * Defines a toolbar item for the list toolbar.
2089
- */
2090
- var SkyListToolbarItemComponent = /** @class */ (function () {
2091
- function SkyListToolbarItemComponent() {
2092
- /**
2093
- * Specifies the ID of the item.
2094
- */
2095
- this.id = "sky-list-toolbar-item-" + ++idIndex$3;
2096
- /**
2097
- * Specifies the index of the item at the given item location.
2098
- * @default -1
2099
- */
2100
- this.index = -1;
2101
- /**
2102
- * Specifies the toolbar location of the item. The valid options are `left`,
2103
- * `center`, and `right`.
2104
- * @default 'left'
2105
- */
2106
- this.location = 'left';
2107
- }
2108
- Object.defineProperty(SkyListToolbarItemComponent.prototype, "template", {
2109
- get: function () {
2110
- return this.templates.length > 0 ? this.templates.first : undefined;
2111
- },
2112
- enumerable: true,
2113
- configurable: true
2114
- });
2115
- __decorate([
2116
- Input()
2117
- ], SkyListToolbarItemComponent.prototype, "id", void 0);
2118
- __decorate([
2119
- Input()
2120
- ], SkyListToolbarItemComponent.prototype, "index", void 0);
2121
- __decorate([
2122
- Input()
2123
- ], SkyListToolbarItemComponent.prototype, "location", void 0);
2124
- __decorate([
2125
- ContentChildren(TemplateRef)
2126
- ], SkyListToolbarItemComponent.prototype, "templates", void 0);
2127
- SkyListToolbarItemComponent = __decorate([
2128
- Component({
2129
- selector: 'sky-list-toolbar-item',
2130
- template: '<ng-content></ng-content>'
2131
- })
2132
- ], SkyListToolbarItemComponent);
2133
- return SkyListToolbarItemComponent;
2134
- }());
2135
-
2136
- /**
2137
- * Adds a sort dropdown to the list toolbar.
2138
- */
2139
- var SkyListToolbarSortComponent = /** @class */ (function () {
2140
- function SkyListToolbarSortComponent() {
2141
- }
2142
- __decorate([
2143
- Input()
2144
- ], SkyListToolbarSortComponent.prototype, "label", void 0);
2145
- __decorate([
2146
- Input()
2147
- ], SkyListToolbarSortComponent.prototype, "field", void 0);
2148
- __decorate([
2149
- Input()
2150
- ], SkyListToolbarSortComponent.prototype, "type", void 0);
2151
- __decorate([
2152
- Input()
2153
- ], SkyListToolbarSortComponent.prototype, "descending", void 0);
2154
- SkyListToolbarSortComponent = __decorate([
2155
- Component({
2156
- selector: 'sky-list-toolbar-sort',
2157
- template: ''
2158
- })
2159
- ], SkyListToolbarSortComponent);
2160
- return SkyListToolbarSortComponent;
2161
- }());
2162
-
2163
- /**
2164
- * Adds a section on the right side of the toolbar for items that substantially change
2165
- * or affect the view of the list. This includes simple filters and view switchers.
2166
- * If the view section includes more than one item, simple filters appear on the left
2167
- * and view switchers appear on the right.
2168
- */
2169
- var SkyListToolbarViewActionsComponent = /** @class */ (function () {
2170
- function SkyListToolbarViewActionsComponent() {
2171
- }
2172
- SkyListToolbarViewActionsComponent = __decorate([
2173
- Component({
2174
- selector: 'sky-list-toolbar-view-actions',
2175
- template: "<ng-content></ng-content>\n",
2176
- styles: [":host{display:flex;align-items:center}:host::ng-deep>:not(:last-child){margin-right:5px}.sky-list-toolbar-view-actions ::ng-deep>:not(:last-child){margin-right:5px}"]
2177
- })
2178
- ], SkyListToolbarViewActionsComponent);
2179
- return SkyListToolbarViewActionsComponent;
2180
- }());
2181
-
2182
- /**
2183
- * @internal
2184
- */
2185
- var ListToolbarConfigSetSearchEnabledAction = /** @class */ (function () {
2186
- function ListToolbarConfigSetSearchEnabledAction(enabled) {
2187
- this.enabled = enabled;
2188
- }
2189
- return ListToolbarConfigSetSearchEnabledAction;
2190
- }());
2191
-
2192
- /**
2193
- * @internal
2194
- */
2195
- var ListToolbarConfigSetSortSelectorEnabledAction = /** @class */ (function () {
2196
- /* istanbul ignore next */
2197
- function ListToolbarConfigSetSortSelectorEnabledAction(enabled) {
2198
- if (enabled === void 0) { enabled = true; }
2199
- this.enabled = enabled;
2200
- }
2201
- return ListToolbarConfigSetSortSelectorEnabledAction;
2202
- }());
2203
-
2204
- /**
2205
- * @internal
2206
- */
2207
- var ListToolbarConfigModel = /** @class */ (function () {
2208
- function ListToolbarConfigModel(data) {
2209
- this.searchEnabled = true;
2210
- this.sortSelectorEnabled = true;
2211
- if (data) {
2212
- this.searchEnabled = data.searchEnabled;
2213
- this.sortSelectorEnabled = data.sortSelectorEnabled;
2214
- }
2215
- }
2216
- return ListToolbarConfigModel;
2217
- }());
2218
-
2219
- /**
2220
- * @internal
2221
- */
2222
- var ListToolbarStateModel = /** @class */ (function () {
2223
- function ListToolbarStateModel() {
2224
- this.config = new ListToolbarConfigModel();
2225
- }
2226
- return ListToolbarStateModel;
2227
- }());
2228
-
2229
- /**
2230
- * @internal
2231
- */
2232
- var ListToolbarStateDispatcher = /** @class */ (function (_super) {
2233
- __extends(ListToolbarStateDispatcher, _super);
2234
- function ListToolbarStateDispatcher() {
2235
- return _super !== null && _super.apply(this, arguments) || this;
2236
- }
2237
- ListToolbarStateDispatcher = __decorate([
2238
- Injectable()
2239
- ], ListToolbarStateDispatcher);
2240
- return ListToolbarStateDispatcher;
2241
- }(StateDispatcher));
2242
- /**
2243
- * @internal
2244
- */
2245
- var ListToolbarStateOrchestrator = /** @class */ (function (_super) {
2246
- __extends(ListToolbarStateOrchestrator, _super);
2247
- function ListToolbarStateOrchestrator() {
2248
- return _super !== null && _super.apply(this, arguments) || this;
2249
- }
2250
- return ListToolbarStateOrchestrator;
2251
- }(StateOrchestrator));
2252
-
2253
- /**
2254
- * @internal
2255
- */
2256
- var ListToolbarConfigOrchestrator = /** @class */ (function (_super) {
2257
- __extends(ListToolbarConfigOrchestrator, _super);
2258
- /* istanbul ignore next */
2259
- function ListToolbarConfigOrchestrator() {
2260
- var _this = _super.call(this) || this;
2261
- _this
2262
- .register(ListToolbarConfigSetSearchEnabledAction, _this.setSearchEnabled)
2263
- .register(ListToolbarConfigSetSortSelectorEnabledAction, _this.setSortSelectorEnabled);
2264
- return _this;
2265
- }
2266
- ListToolbarConfigOrchestrator.prototype.setSearchEnabled = function (state, action) {
2267
- return new ListToolbarConfigModel(Object.assign({}, state, { searchEnabled: action.enabled }));
2268
- };
2269
- ListToolbarConfigOrchestrator.prototype.setSortSelectorEnabled = function (state, action) {
2270
- return new ListToolbarConfigModel(Object.assign({}, state, { sortSelectorEnabled: action.enabled }));
2271
- };
2272
- return ListToolbarConfigOrchestrator;
2273
- }(ListToolbarStateOrchestrator));
2274
-
2275
- /**
2276
- * @internal
2277
- */
2278
- var ListToolbarState = /** @class */ (function (_super) {
2279
- __extends(ListToolbarState, _super);
2280
- function ListToolbarState(initialState, dispatcher) {
2281
- var _this = _super.call(this, initialState, dispatcher) || this;
2282
- _this
2283
- .register('config', ListToolbarConfigOrchestrator)
2284
- .begin();
2285
- return _this;
2286
- }
2287
- ListToolbarState.ctorParameters = function () { return [
2288
- { type: ListToolbarStateModel },
2289
- { type: ListToolbarStateDispatcher }
2290
- ]; };
2291
- ListToolbarState = __decorate([
2292
- Injectable()
2293
- ], ListToolbarState);
2294
- return ListToolbarState;
2295
- }(StateNode));
2296
-
2297
- var nextId = 0;
2298
- /**
2299
- * Displays a toolbar for a SKY UX-themed list of data.
2300
- */
2301
- var SkyListToolbarComponent = /** @class */ (function () {
2302
- function SkyListToolbarComponent(changeDetector, state, dispatcher, toolbarState, toolbarDispatcher) {
2303
- this.changeDetector = changeDetector;
2304
- this.state = state;
2305
- this.dispatcher = dispatcher;
2306
- this.toolbarState = toolbarState;
2307
- this.toolbarDispatcher = toolbarDispatcher;
2308
- /**
2309
- * Display the search bar in the standard position or in a separate section.
2310
- * To highlight the search bar in a section above all other toolbar items,
2311
- * set this property to `search`.
2312
- * @default 'standard'
2313
- */
2314
- this.toolbarType = 'standard';
2315
- this.isToolbarDisabled = false;
2316
- this.inlineFilterBarExpanded = false;
2317
- this.hasAdditionalToolbarSection = false;
2318
- this.hasViewActions = false;
2319
- this.filterButtonId = "sky-list-toolbar-filter-button-" + ++nextId;
2320
- this.listFilterInlineId = "sky-list-toolbar-filter-inline-" + ++nextId;
2321
- /**
2322
- * Fires when users submit a search.
2323
- * @internal
2324
- */
2325
- this.searchApplied = new Subject();
2326
- this.customItemIds = [];
2327
- this.hasSortSelectors = false;
2328
- this.inlineFiltersItemToolbarIndex = 5000;
2329
- this.sortSelectorItemToolbarIndex = 6000;
2330
- this.ngUnsubscribe = new Subject();
2331
- }
2332
- Object.defineProperty(SkyListToolbarComponent.prototype, "inMemorySearchEnabled", {
2333
- get: function () {
2334
- if (this._inMemorySearchEnabled === undefined) {
2335
- return true;
2336
- }
2337
- return this._inMemorySearchEnabled;
2338
- },
2339
- /**
2340
- * Indicates whether to use the in-memory search.
2341
- * Setting this to `false` will allow consumers to run their own searches remotely,
2342
- * and push new values to the list component by updating the `data` property.
2343
- * @default true
2344
- * @internal
2345
- */
2346
- set: function (value) {
2347
- this._inMemorySearchEnabled = value;
2348
- },
2349
- enumerable: true,
2350
- configurable: true
2351
- });
2352
- Object.defineProperty(SkyListToolbarComponent.prototype, "isFilterBarDisplayed", {
2353
- get: function () {
2354
- return !this.isToolbarDisabled && this.hasInlineFilters && this.inlineFilterBarExpanded;
2355
- },
2356
- enumerable: true,
2357
- configurable: true
2358
- });
2359
- Object.defineProperty(SkyListToolbarComponent.prototype, "filterButtonAriaControls", {
2360
- get: function () {
2361
- return this.isFilterBarDisplayed ? this.listFilterInlineId : undefined;
2362
- },
2363
- enumerable: true,
2364
- configurable: true
2365
- });
2366
- SkyListToolbarComponent.prototype.ngOnInit = function () {
2367
- var _this = this;
2368
- this.dispatcher.toolbarExists(true);
2369
- getValue(this.searchText, function (searchText) {
2370
- _this.updateSearchText(searchText);
2371
- });
2372
- getValue(this.searchEnabled, function (searchEnabled) {
2373
- _this.toolbarDispatcher.next(new ListToolbarConfigSetSearchEnabledAction(searchEnabled === undefined ? true : searchEnabled));
2374
- });
2375
- getValue(this.toolbarType, function (type) {
2376
- _this.dispatcher.next(new ListToolbarSetTypeAction(_this.toolbarType));
2377
- });
2378
- getValue(this.sortSelectorEnabled, function (sortSelectorEnabled) {
2379
- _this.toolbarDispatcher.next(new ListToolbarConfigSetSortSelectorEnabledAction(sortSelectorEnabled === undefined ? true : sortSelectorEnabled));
2380
- });
2381
- this.sortSelectors = this.getSortSelectors();
2382
- // Initialize the sort toolbar item if necessary
2383
- this.sortSelectors
2384
- .pipe(takeUntil(this.ngUnsubscribe), distinctUntilChanged())
2385
- .subscribe(function (currentSort) {
2386
- if (currentSort.length > 0 && !_this.hasSortSelectors) {
2387
- _this.hasSortSelectors = true;
2388
- _this.dispatcher.toolbarAddItems([
2389
- new ListToolbarItemModel({
2390
- id: 'sort-selector',
2391
- template: _this.sortSelectorTemplate,
2392
- location: 'left',
2393
- index: _this.sortSelectorItemToolbarIndex
2394
- })
2395
- ]);
2396
- }
2397
- else if (currentSort.length < 1 && _this.hasSortSelectors) {
2398
- _this.hasSortSelectors = false;
2399
- _this.dispatcher.toolbarRemoveItems([
2400
- 'sort-selector'
2401
- ]);
2402
- }
2403
- });
2404
- this.searchTextInput = this.state.pipe(takeUntil(this.ngUnsubscribe), map(function (s) { return s.search.searchText; }), distinctUntilChanged());
2405
- this.view = this.state.pipe(takeUntil(this.ngUnsubscribe), map(function (s) { return s.views.active; }), distinctUntilChanged());
2406
- this.watchTemplates();
2407
- this.type = this.state.pipe(takeUntil(this.ngUnsubscribe), map(function (state) { return state.toolbar.type; }), distinctUntilChanged());
2408
- this.type.pipe(takeUntil(this.ngUnsubscribe))
2409
- .subscribe(function (toolbarType) {
2410
- if (toolbarType === 'search') {
2411
- _this.dispatcher.toolbarRemoveItems(['search']);
2412
- }
2413
- else {
2414
- _this.dispatcher.toolbarAddItems([
2415
- new ListToolbarItemModel({
2416
- id: 'search',
2417
- template: _this.searchTemplate,
2418
- location: 'right'
2419
- })
2420
- ]);
2421
- }
2422
- });
2423
- this.isSearchEnabled = this.toolbarState.pipe(takeUntil(this.ngUnsubscribe), map(function (s) { return s.config; }), distinctUntilChanged(), map(function (c) { return c.searchEnabled; }));
2424
- this.state.pipe(map(function (s) { return s.toolbar; }), takeUntil(this.ngUnsubscribe), distinctUntilChanged(), map(function (c) { return c.disabled; }))
2425
- .subscribe(function (isDisabled) { return _this.isToolbarDisabled = isDisabled; });
2426
- this.isSortSelectorEnabled = this.toolbarState.pipe(takeUntil(this.ngUnsubscribe), map(function (s) { return s.config; }), distinctUntilChanged(), map(function (c) { return c.sortSelectorEnabled; }));
2427
- this.isMultiselectEnabled = this.state.pipe(takeUntil(this.ngUnsubscribe), map(function (s) { return s.toolbar; }), distinctUntilChanged(), map(function (t) { return t.showMultiselectToolbar; }));
2428
- this.hasAppliedFilters = this.state.pipe(takeUntil(this.ngUnsubscribe), map(function (s) { return s.filters; }), distinctUntilChanged(), map(function (filters) {
2429
- var activeFilters = filters.filter(function (f) {
2430
- return f.value !== '' &&
2431
- f.value !== undefined &&
2432
- f.value !== false &&
2433
- f.value !== f.defaultValue;
2434
- });
2435
- return activeFilters.length > 0;
2436
- }));
2437
- this.state.pipe(takeUntil(this.ngUnsubscribe))
2438
- .subscribe(function (current) {
2439
- _this.hasAdditionalToolbarSection = (current.toolbar.items.length > 0);
2440
- _this.changeDetector.detectChanges();
2441
- });
2442
- };
2443
- SkyListToolbarComponent.prototype.ngAfterContentInit = function () {
2444
- var _this = this;
2445
- // Inject custom toolbar items.
2446
- this.toolbarItems.forEach(function (toolbarItem) {
2447
- _this.dispatcher.toolbarAddItems([
2448
- new ListToolbarItemModel(toolbarItem)
2449
- ]);
2450
- _this.customItemIds.push(toolbarItem.id);
2451
- });
2452
- this.toolbarItems.changes.pipe(takeUntil(this.ngUnsubscribe))
2453
- .subscribe(function (newItems) {
2454
- newItems.forEach(function (item) {
2455
- if (_this.customItemIds.indexOf(item.id) < 0) {
2456
- _this.dispatcher.toolbarAddItems([
2457
- new ListToolbarItemModel(item)
2458
- ]);
2459
- _this.customItemIds.push(item.id);
2460
- }
2461
- });
2462
- var itemsToRemove = [];
2463
- _this.customItemIds.forEach(function (itemId, index) {
2464
- if (!newItems.find(function (item) { return item.id === itemId; })) {
2465
- itemsToRemove.push(itemId);
2466
- _this.customItemIds.splice(index, 1);
2467
- }
2468
- });
2469
- _this.dispatcher.toolbarRemoveItems(itemsToRemove);
2470
- });
2471
- var sortModels = this.toolbarSorts.map(function (sort) {
2472
- return new ListSortLabelModel({
2473
- text: sort.label,
2474
- fieldSelector: sort.field,
2475
- fieldType: sort.type,
2476
- global: true,
2477
- descending: sort.descending
2478
- });
2479
- });
2480
- this.dispatcher.sortSetGlobal(sortModels);
2481
- // Add inline filters.
2482
- this.showFilterSummary = (this.filterSummary.length > 0);
2483
- this.hasInlineFilters = (this.inlineFilter.length > 0);
2484
- if (this.hasInlineFilters) {
2485
- this.dispatcher.toolbarAddItems([
2486
- new ListToolbarItemModel({
2487
- template: this.inlineFilterButtonTemplate,
2488
- location: 'left',
2489
- index: this.inlineFiltersItemToolbarIndex
2490
- })
2491
- ]);
2492
- }
2493
- // Check for view actions
2494
- this.hasViewActions = (this.viewActions.length > 0);
2495
- };
2496
- SkyListToolbarComponent.prototype.ngOnDestroy = function () {
2497
- this.searchApplied.complete();
2498
- this.ngUnsubscribe.next();
2499
- this.ngUnsubscribe.complete();
2500
- };
2501
- SkyListToolbarComponent.prototype.setSort = function (sort) {
2502
- var _this = this;
2503
- this.state.pipe(take(1)).subscribe(function (currentState) {
2504
- if (currentState.paging.pageNumber && currentState.paging.pageNumber !== 1) {
2505
- _this.dispatcher.next(new ListPagingSetPageNumberAction(Number(1)));
2506
- }
2507
- _this.dispatcher.sortSetFieldSelectors([{ fieldSelector: sort.fieldSelector, descending: sort.descending }]);
2508
- });
2509
- };
2510
- SkyListToolbarComponent.prototype.inlineFilterButtonClick = function () {
2511
- this.inlineFilterBarExpanded = !this.inlineFilterBarExpanded;
2512
- };
2513
- SkyListToolbarComponent.prototype.updateSearchText = function (searchText) {
2514
- var _this = this;
2515
- this.searchApplied.next(searchText);
2516
- if (this.inMemorySearchEnabled) {
2517
- this.state.pipe(take(1)).subscribe(function (currentState) {
2518
- if (currentState.paging.pageNumber && currentState.paging.pageNumber !== 1) {
2519
- _this.dispatcher.next(new ListPagingSetPageNumberAction(Number(1)));
2520
- }
2521
- _this.dispatcher.searchSetText(searchText);
2522
- });
2523
- }
2524
- };
2525
- SkyListToolbarComponent.prototype.itemIsInView = function (itemView, activeView) {
2526
- return (itemView === undefined || itemView === activeView);
2527
- };
2528
- SkyListToolbarComponent.prototype.getSortSelectors = function () {
2529
- return combineLatest(this.state.pipe(map(function (s) { return s.sort.available; }), distinctUntilChanged()), this.state.pipe(map(function (s) { return s.sort.global; }), distinctUntilChanged()), this.state.pipe(map(function (s) { return s.sort.fieldSelectors; }), distinctUntilChanged()), function (available, global, fieldSelectors) {
2530
- // Get sorts that are in the global that are not in the available
2531
- var sorts = global.filter(function (g) { return available.filter(function (a) { return a.fieldSelector === g.fieldSelector; }).length === 0; });
2532
- var resultSortSelectors = __spread(sorts, available).map(function (sortLabels) {
2533
- var fs = fieldSelectors.filter(function (f) {
2534
- return f.fieldSelector === sortLabels.fieldSelector
2535
- && f.descending === sortLabels.descending;
2536
- });
2537
- var selected = false;
2538
- if (fs.length > 0) {
2539
- selected = true;
2540
- }
2541
- return {
2542
- sort: sortLabels,
2543
- selected: selected
2544
- };
2545
- });
2546
- return resultSortSelectors;
2547
- }).pipe(takeUntil(this.ngUnsubscribe));
2548
- };
2549
- SkyListToolbarComponent.prototype.watchTemplates = function () {
2550
- var _this = this;
2551
- combineLatest(this.state.pipe(map(function (s) { return s.toolbar; }), distinctUntilChanged()), this.view.pipe(distinctUntilChanged()), function (toolbar, view) {
2552
- var items = toolbar.items.filter(function (i) {
2553
- return _this.itemIsInView(i.view, view);
2554
- });
2555
- var templates = {};
2556
- items.forEach(function (item) {
2557
- templates[item.location] = templates[item.location] || [];
2558
- templates[item.location].push(item);
2559
- });
2560
- return templates;
2561
- }).pipe(takeUntil(this.ngUnsubscribe))
2562
- .subscribe(function (value) {
2563
- _this.leftTemplates = value.left;
2564
- _this.centerTemplates = value.center;
2565
- _this.rightTemplates = value.right;
2566
- _this.changeDetector.markForCheck();
2567
- });
2568
- };
2569
- SkyListToolbarComponent.ctorParameters = function () { return [
2570
- { type: ChangeDetectorRef },
2571
- { type: ListState },
2572
- { type: ListStateDispatcher },
2573
- { type: ListToolbarState },
2574
- { type: ListToolbarStateDispatcher }
2575
- ]; };
2576
- __decorate([
2577
- Input()
2578
- ], SkyListToolbarComponent.prototype, "inMemorySearchEnabled", null);
2579
- __decorate([
2580
- Input()
2581
- ], SkyListToolbarComponent.prototype, "placeholder", void 0);
2582
- __decorate([
2583
- Input()
2584
- ], SkyListToolbarComponent.prototype, "searchEnabled", void 0);
2585
- __decorate([
2586
- ViewChild(SkySearchComponent, {
2587
- read: SkySearchComponent,
2588
- static: false
2589
- })
2590
- ], SkyListToolbarComponent.prototype, "searchComponent", void 0);
2591
- __decorate([
2592
- Input()
2593
- ], SkyListToolbarComponent.prototype, "sortSelectorEnabled", void 0);
2594
- __decorate([
2595
- Input()
2596
- ], SkyListToolbarComponent.prototype, "toolbarType", void 0);
2597
- __decorate([
2598
- Input()
2599
- ], SkyListToolbarComponent.prototype, "searchText", void 0);
2600
- __decorate([
2601
- ContentChildren(SkyListToolbarItemComponent)
2602
- ], SkyListToolbarComponent.prototype, "toolbarItems", void 0);
2603
- __decorate([
2604
- ContentChildren(SkyListToolbarSortComponent)
2605
- ], SkyListToolbarComponent.prototype, "toolbarSorts", void 0);
2606
- __decorate([
2607
- ContentChildren(SkyListFilterSummaryComponent)
2608
- ], SkyListToolbarComponent.prototype, "filterSummary", void 0);
2609
- __decorate([
2610
- ContentChildren(SkyListFilterInlineComponent)
2611
- ], SkyListToolbarComponent.prototype, "inlineFilter", void 0);
2612
- __decorate([
2613
- ContentChildren(SkyListToolbarViewActionsComponent)
2614
- ], SkyListToolbarComponent.prototype, "viewActions", void 0);
2615
- __decorate([
2616
- ViewChild('search', {
2617
- read: TemplateRef,
2618
- static: true
2619
- })
2620
- ], SkyListToolbarComponent.prototype, "searchTemplate", void 0);
2621
- __decorate([
2622
- ViewChild('sortSelector', {
2623
- read: TemplateRef,
2624
- static: true
2625
- })
2626
- ], SkyListToolbarComponent.prototype, "sortSelectorTemplate", void 0);
2627
- __decorate([
2628
- ViewChild('inlineFilterButton', {
2629
- read: TemplateRef,
2630
- static: true
2631
- })
2632
- ], SkyListToolbarComponent.prototype, "inlineFilterButtonTemplate", void 0);
2633
- SkyListToolbarComponent = __decorate([
2634
- Component({
2635
- selector: 'sky-list-toolbar',
2636
- template: "<div class=\"sky-list-toolbar-container\">\n <sky-toolbar *ngIf=\"(type | async) !== 'search'\">\n\n <sky-toolbar-section>\n <sky-toolbar-item *ngFor=\"let item of leftTemplates\">\n <sky-list-toolbar-item-renderer\n [attr.sky-cmp-id]=\"item.id\"\n [template]=\"item.template\"\n >\n </sky-list-toolbar-item-renderer>\n </sky-toolbar-item>\n <sky-toolbar-item *ngFor=\"let item of centerTemplates\">\n <sky-list-toolbar-item-renderer\n [attr.sky-cmp-id]=\"item.id\"\n [template]=\"item.template\"\n >\n </sky-list-toolbar-item-renderer>\n </sky-toolbar-item>\n <sky-toolbar-item *ngFor=\"let item of rightTemplates\"\n [attr.sky-toolbar-id]=\"item.id\"\n >\n <sky-list-toolbar-item-renderer\n [attr.sky-cmp-id]=\"item.id\"\n [template]=\"item.template\"\n >\n </sky-list-toolbar-item-renderer>\n </sky-toolbar-item>\n\n <ng-content></ng-content>\n\n <sky-toolbar-view-actions *ngIf=\"hasViewActions\">\n <ng-content\n select=\"sky-list-toolbar-view-actions\"\n >\n </ng-content>\n </sky-toolbar-view-actions>\n </sky-toolbar-section>\n\n <sky-toolbar-section *ngIf=\"showFilterSummary && (hasAppliedFilters | async)\">\n <ng-content select=\"sky-list-filter-summary\">\n </ng-content>\n </sky-toolbar-section>\n </sky-toolbar>\n\n <div *ngIf=\"(type | async) === 'search' &&\n ((isSearchEnabled | async) || hasAdditionalToolbarSection)\"\n class=\"sky-list-toolbar-search\"\n >\n <sky-toolbar>\n <sky-toolbar-section *ngIf=\"(isSearchEnabled | async)\">\n <sky-toolbar-item>\n <sky-list-toolbar-item-renderer\n sky-cmp-id=\"search\"\n [template]=\"search\"\n >\n </sky-list-toolbar-item-renderer>\n </sky-toolbar-item>\n </sky-toolbar-section>\n <sky-toolbar-section [hidden]=\"!hasAdditionalToolbarSection\">\n <sky-toolbar-item *ngFor=\"let item of leftTemplates\">\n <sky-list-toolbar-item-renderer\n [attr.sky-cmp-id]=\"item.id\"\n [template]=\"item.template\"\n >\n </sky-list-toolbar-item-renderer>\n </sky-toolbar-item>\n <sky-toolbar-item *ngFor=\"let item of centerTemplates\">\n <sky-list-toolbar-item-renderer\n [attr.sky-cmp-id]=\"item.id\"\n [template]=\"item.template\"\n >\n </sky-list-toolbar-item-renderer>\n </sky-toolbar-item>\n <sky-toolbar-item *ngFor=\"let item of rightTemplates\"\n [attr.sky-toolbar-id]=\"item.id\"\n >\n <sky-list-toolbar-item-renderer *ngIf=\"item.id !== 'search'\"\n [attr.sky-cmp-id]=\"item.id\"\n [template]=\"item.template\"\n >\n </sky-list-toolbar-item-renderer>\n </sky-toolbar-item>\n <ng-content></ng-content>\n\n <sky-toolbar-view-actions *ngIf=\"hasViewActions\">\n <ng-content\n select=\"sky-list-toolbar-view-actions\"\n >\n </ng-content>\n </sky-toolbar-view-actions>\n </sky-toolbar-section>\n </sky-toolbar>\n </div>\n <div\n *ngIf=\"isFilterBarDisplayed\"\n [attr.aria-labelledby]=\"filterButtonId\"\n [id]=\"listFilterInlineId\"\n >\n <ng-content select=\"sky-list-filter-inline\">\n </ng-content>\n </div>\n <sky-list-multiselect-toolbar *ngIf=\"isMultiselectEnabled | async\">\n </sky-list-multiselect-toolbar>\n</div>\n\n<ng-template #search>\n <div *ngIf=\"isSearchEnabled | async\"\n class=\"sky-list-toolbar-search-wrapper\"\n >\n <sky-search\n [disabled]=\"isToolbarDisabled\"\n [expandMode]=\"(type | async) === 'search' ? 'fit' : 'responsive'\"\n [placeholderText]=\"placeholder\"\n [searchText]=\"searchTextInput | async\"\n (searchApply)=\"updateSearchText($event)\"\n >\n </sky-search>\n <ng-content\n select=\"sky-list-toolbar-search-actions\"\n ></ng-content>\n </div>\n</ng-template>\n\n<ng-template #sortSelector>\n <div *ngIf=\"(isSortSelectorEnabled | async) && (sortSelectors | async).length > 0\"\n class=\"sky-toolbar-item-sort-container\"\n >\n <sky-sort [showButtonText]=\"true\">\n <sky-sort-item *ngFor=\"let item of sortSelectors | async\"\n [active]=\"item.selected\"\n (itemSelect)=\"setSort(item.sort)\"\n >\n {{ item.sort.text }}\n </sky-sort-item>\n </sky-sort>\n </div>\n</ng-template>\n\n<ng-template #inlineFilterButton>\n <sky-filter-button\n [active]=\"hasAppliedFilters | async\"\n [ariaControls]=\"filterButtonAriaControls\"\n [ariaExpanded]=\"inlineFilterBarExpanded\"\n [disabled]=\"isToolbarDisabled\"\n [filterButtonId]=\"filterButtonId\"\n [showButtonText]=\"true\"\n (filterButtonClick)=\"inlineFilterButtonClick()\"\n >\n </sky-filter-button>\n</ng-template>\n",
2637
- providers: [
2638
- ListToolbarState,
2639
- ListToolbarStateDispatcher,
2640
- ListToolbarStateModel
2641
- ],
2642
- changeDetection: ChangeDetectionStrategy.OnPush,
2643
- styles: [".sky-list-toolbar-search-wrapper{display:flex}.sky-list-toolbar-search-wrapper ::ng-deep .sky-search-dismiss-absolute{padding:0;position:static}.sky-list-toolbar-search-wrapper ::ng-deep .sky-search-container{position:relative;height:100%}.sky-list-toolbar-search-wrapper ::ng-deep sky-search{flex:1 1 auto}.sky-list-toolbar-search-wrapper ::ng-deep sky-list-toolbar-search-actions{flex:0 0 auto;z-index:1}.sky-list-toolbar-container ::ng-deep .sky-toolbar-section-items sky-toolbar-item{flex:0 1 auto;align-self:flex-start}.sky-list-toolbar-search ::ng-deep .sky-toolbar-section{padding-top:0}.sky-list-toolbar-search ::ng-deep .sky-toolbar-section-items{display:block;width:100%}.sky-list-toolbar-search ::ng-deep .sky-toolbar-item{margin:0}.sky-list-toolbar-search ::ng-deep .sky-search-dismiss-absolute,.sky-list-toolbar-search ::ng-deep .sky-toolbar-container{background-color:#eeeeef}.sky-list-toolbar-search ::ng-deep .sky-search-btn:disabled,.sky-list-toolbar-search ::ng-deep input[type=text]:disabled{background-color:#cdcfd2;opacity:1}.sky-list-toolbar-container ::ng-deep sky-toolbar-item[sky-toolbar-id=sort-selector] .sky-toolbar-item{margin-right:0}.sky-list-toolbar-container ::ng-deep sky-checkbox{position:relative;top:-2px}"]
2644
- })
2645
- ], SkyListToolbarComponent);
2646
- return SkyListToolbarComponent;
2647
- }());
2648
-
2649
- /**
2650
- * @internal
2651
- */
2652
- var SkyListToolbarItemRendererComponent = /** @class */ (function () {
2653
- function SkyListToolbarItemRendererComponent() {
2654
- }
2655
- SkyListToolbarItemRendererComponent.prototype.ngOnInit = function () {
2656
- if (this.template !== undefined) {
2657
- this.container.createEmbeddedView(this.template, this);
2658
- }
2659
- };
2660
- __decorate([
2661
- Input()
2662
- ], SkyListToolbarItemRendererComponent.prototype, "template", void 0);
2663
- __decorate([
2664
- ViewChild('container', {
2665
- read: ViewContainerRef,
2666
- static: true
2667
- })
2668
- ], SkyListToolbarItemRendererComponent.prototype, "container", void 0);
2669
- SkyListToolbarItemRendererComponent = __decorate([
2670
- Component({
2671
- selector: 'sky-list-toolbar-item-renderer',
2672
- template: '<ng-template #container></ng-template>'
2673
- })
2674
- ], SkyListToolbarItemRendererComponent);
2675
- return SkyListToolbarItemRendererComponent;
2676
- }());
2677
-
2678
- var uniqueId = 0;
2679
- /**
2680
- * @internal
2681
- */
2682
- var SkyListMultiselectToolbarComponent = /** @class */ (function () {
2683
- function SkyListMultiselectToolbarComponent(state, dispatcher) {
2684
- this.state = state;
2685
- this.dispatcher = dispatcher;
2686
- this.showOnlySelected = false;
2687
- this.multiselectToolbarId = "sky-list-multiselect-toolbar-" + uniqueId++;
2688
- this.selectedIdMap = new Map();
2689
- this.ngUnsubscribe = new Subject();
2690
- }
2691
- SkyListMultiselectToolbarComponent.prototype.ngOnInit = function () {
2692
- var _this = this;
2693
- this.state
2694
- .pipe(map(function (t) { return t.selected.item; }), takeUntil(this.ngUnsubscribe), distinctUntilChanged(this.selectedMapEqual))
2695
- .subscribe(function (model) {
2696
- _this.selectedIdMap = model.selectedIdMap;
2697
- if (_this.showOnlySelected) {
2698
- _this.reapplyFilter(true);
2699
- }
2700
- });
2701
- // If 'show-selected' filter is programatically set from a child component (e.g. checkilst),
2702
- // make sure the checked state of the 'show-selected' checkbox stays in sync.
2703
- this.state
2704
- .pipe(map(function (t) { return t.filters; }), takeUntil(this.ngUnsubscribe), distinctUntilChanged(this.showSelectedValuesEqual))
2705
- .subscribe(function (filters) {
2706
- var showSelectedFilter = filters.find(function (filter) { return filter.name === 'show-selected'; });
2707
- if (showSelectedFilter) {
2708
- _this.showOnlySelected = (showSelectedFilter.value === 'true');
2709
- }
2710
- });
2711
- };
2712
- SkyListMultiselectToolbarComponent.prototype.ngOnDestroy = function () {
2713
- this.ngUnsubscribe.next();
2714
- this.ngUnsubscribe.complete();
2715
- };
2716
- SkyListMultiselectToolbarComponent.prototype.selectAll = function () {
2717
- var _this = this;
2718
- this.state
2719
- .pipe(map(function (state) { return state.items.items; }), take(1))
2720
- .subscribe(function (items) {
2721
- _this.dispatcher.setSelected(items.map(function (item) { return item.id; }), true);
2722
- if (_this.showOnlySelected) {
2723
- _this.reapplyFilter(_this.showOnlySelected);
2724
- }
2725
- });
2726
- };
2727
- SkyListMultiselectToolbarComponent.prototype.clearSelections = function () {
2728
- var _this = this;
2729
- this.state
2730
- .pipe(map(function (state) { return state.items.items; }), take(1))
2731
- .subscribe(function (items) {
2732
- _this.dispatcher.setSelected(items.map(function (item) { return item.id; }), false);
2733
- if (_this.showOnlySelected) {
2734
- _this.reapplyFilter(_this.showOnlySelected);
2735
- }
2736
- });
2737
- };
2738
- SkyListMultiselectToolbarComponent.prototype.changeVisibleItems = function (change) {
2739
- this.showOnlySelected = change.checked;
2740
- this.reapplyFilter(change.checked);
2741
- };
2742
- SkyListMultiselectToolbarComponent.prototype.reapplyFilter = function (isSelected) {
2743
- var _this = this;
2744
- var self = this;
2745
- this.state
2746
- .pipe(map(function (state) { return state.filters; }), take(1))
2747
- .subscribe(function (filters) {
2748
- filters = filters.filter(function (filter) { return filter.name !== 'show-selected'; });
2749
- filters.push(self.getShowSelectedFilter(isSelected));
2750
- _this.dispatcher.filtersUpdate(filters);
2751
- });
2752
- // If "show selected" is checked and paging is enabled, go to page one.
2753
- /* istanbul ignore else */
2754
- if (isSelected) {
2755
- this.state.pipe(take(1))
2756
- .subscribe(function (currentState) {
2757
- if (currentState.paging.pageNumber && currentState.paging.pageNumber !== 1) {
2758
- _this.dispatcher.next(new ListPagingSetPageNumberAction(Number(1)));
2759
- }
2760
- });
2761
- }
2762
- this.dispatcher.toolbarSetDisabled(isSelected);
2763
- };
2764
- SkyListMultiselectToolbarComponent.prototype.getShowSelectedFilter = function (isSelected) {
2765
- var _this = this;
2766
- return new ListFilterModel({
2767
- name: 'show-selected',
2768
- value: isSelected.toString(),
2769
- filterFunction: function (model, showOnlySelected) {
2770
- /* istanbul ignore else */
2771
- if (showOnlySelected.toString() !== false.toString()) {
2772
- return _this.selectedIdMap.get(model.id);
2773
- }
2774
- },
2775
- defaultValue: false.toString()
2776
- });
2777
- };
2778
- SkyListMultiselectToolbarComponent.prototype.showSelectedValuesEqual = function (prev, next) {
2779
- var prevShowSelectedFilter = prev.find(function (filter) { return filter.name === 'show-selected'; });
2780
- var nextShowSelectedFilter = next.find(function (filter) { return filter.name === 'show-selected'; });
2781
- // Both undefined.
2782
- if (!prevShowSelectedFilter && !nextShowSelectedFilter) {
2783
- return true;
2784
- }
2785
- // Only one undefined.
2786
- if ((prevShowSelectedFilter && !nextShowSelectedFilter) || (!prevShowSelectedFilter && nextShowSelectedFilter)) {
2787
- return false;
2788
- }
2789
- // Defined, but with different "value".
2790
- return prevShowSelectedFilter.value === nextShowSelectedFilter.value;
2791
- };
2792
- SkyListMultiselectToolbarComponent.prototype.selectedMapEqual = function (prev, next) {
2793
- if (prev.selectedIdMap.size !== next.selectedIdMap.size) {
2794
- return false;
2795
- }
2796
- for (var i = 0; i < next.selectedIdMap.size; i++) {
2797
- var key = Array.from(next.selectedIdMap.keys())[i];
2798
- var value = next.selectedIdMap.get(key);
2799
- if (value !== prev.selectedIdMap.get(key)) {
2800
- return false;
2801
- }
2802
- }
2803
- return true;
2804
- };
2805
- SkyListMultiselectToolbarComponent.ctorParameters = function () { return [
2806
- { type: ListState },
2807
- { type: ListStateDispatcher }
2808
- ]; };
2809
- __decorate([
2810
- Input()
2811
- ], SkyListMultiselectToolbarComponent.prototype, "showOnlySelected", void 0);
2812
- SkyListMultiselectToolbarComponent = __decorate([
2813
- Component({
2814
- selector: 'sky-list-multiselect-toolbar',
2815
- template: "<sky-toolbar\n class=\"sky-list-multiselect-toolbar\"\n>\n <sky-toolbar-section>\n <sky-toolbar-item>\n <sky-list-toolbar-item-renderer\n [template]=\"selectAllTemplate\"\n >\n </sky-list-toolbar-item-renderer>\n </sky-toolbar-item>\n <sky-toolbar-item>\n <sky-list-toolbar-item-renderer\n [template]=\"clearSelectionsTemplate\"\n >\n </sky-list-toolbar-item-renderer>\n </sky-toolbar-item>\n <sky-toolbar-view-actions>\n <ng-container *ngTemplateOutlet=\"showSelectedTemplate\"></ng-container>\n </sky-toolbar-view-actions>\n </sky-toolbar-section>\n</sky-toolbar>\n\n<ng-template #selectAllTemplate>\n <button\n class=\"sky-btn sky-btn-link\"\n type=\"button\"\n [attr.id]=\"multiselectToolbarId + '-select-all'\"\n (click)=\"selectAll();$event.preventDefault();\"\n >\n {{ 'skyux_list_mutliselect_select_all' | skyLibResources }}\n </button>\n</ng-template>\n\n<ng-template #clearSelectionsTemplate>\n <button\n class=\"sky-btn sky-btn-link\"\n type=\"button\"\n [attr.id]=\"multiselectToolbarId + '-clear-all'\"\n (click)=\"clearSelections();$event.preventDefault();\"\n >\n {{ 'skyux_list_multiselect_clear_all' | skyLibResources }}\n </button>\n</ng-template>\n\n<ng-template #showSelectedTemplate>\n <sky-checkbox\n [attr.id]=\"multiselectToolbarId + '-show-selected'\"\n [checked]=\"showOnlySelected\"\n (change)=\"changeVisibleItems($event)\"\n >\n <sky-checkbox-label>\n {{ 'skyux_list_mutliselect_show_selected' | skyLibResources }}\n </sky-checkbox-label>\n </sky-checkbox>\n</ng-template>\n",
2816
- styles: [":host-context(.sky-list-toolbar-search+) .sky-list-multiselect-toolbar ::ng-deep .sky-toolbar-container,:host-context(sky-toolbar+) .sky-list-multiselect-toolbar ::ng-deep .sky-toolbar-container{border-top:none}"]
2817
- })
2818
- ], SkyListMultiselectToolbarComponent);
2819
- return SkyListMultiselectToolbarComponent;
2820
- }());
2821
-
2822
- /**
2823
- * Displays custom actions in the toolbar beside to the search bar.
2824
- */
2825
- var SkyListToolbarSearchActionsComponent = /** @class */ (function () {
2826
- function SkyListToolbarSearchActionsComponent() {
2827
- }
2828
- SkyListToolbarSearchActionsComponent = __decorate([
2829
- Component({
2830
- selector: 'sky-list-toolbar-search-actions',
2831
- template: "<div\n class=\"sky-list-toolbar-search-actions\"\n>\n <ng-content></ng-content>\n</div>\n",
2832
- changeDetection: ChangeDetectionStrategy.OnPush,
2833
- styles: [".sky-list-toolbar-search-actions{margin-left:10px}"]
2834
- })
2835
- ], SkyListToolbarSearchActionsComponent);
2836
- return SkyListToolbarSearchActionsComponent;
2837
- }());
2838
-
2839
- var SkyListToolbarModule = /** @class */ (function () {
2840
- function SkyListToolbarModule() {
2841
- }
2842
- SkyListToolbarModule = __decorate([
2843
- NgModule({
2844
- declarations: [
2845
- SkyListToolbarComponent,
2846
- SkyListToolbarItemComponent,
2847
- SkyListToolbarItemRendererComponent,
2848
- SkyListMultiselectToolbarComponent,
2849
- SkyListToolbarSearchActionsComponent,
2850
- SkyListToolbarSortComponent,
2851
- SkyListToolbarViewActionsComponent
2852
- ],
2853
- imports: [
2854
- CommonModule,
2855
- SkyCheckboxModule,
2856
- SkyI18nModule,
2857
- SkyToolbarModule,
2858
- SkySearchModule,
2859
- SkySortModule,
2860
- SkyFilterModule,
2861
- SkyListFiltersModule,
2862
- SkyIconModule,
2863
- SkyListBuilderResourcesModule
2864
- ],
2865
- exports: [
2866
- SkyListToolbarComponent,
2867
- SkyListToolbarItemComponent,
2868
- SkyListToolbarItemRendererComponent,
2869
- SkyListMultiselectToolbarComponent,
2870
- SkyListToolbarSearchActionsComponent,
2871
- SkyListToolbarSortComponent,
2872
- SkyListToolbarViewActionsComponent
2873
- ]
2874
- })
2875
- ], SkyListToolbarModule);
2876
- return SkyListToolbarModule;
2877
- }());
2878
-
2879
- /**
2880
- * Generated bundle index. Do not edit.
2881
- */
2882
-
2883
- export { ListDataProvider, ListDataRequestModel, ListDataResponseModel, ListFilterModel, ListFiltersOrchestrator, ListFiltersUpdateAction, ListItemsLoadAction, ListItemsOrchestrator, ListItemsSetLoadingAction, ListItemsSetSelectedAction, ListPagingModel, ListPagingOrchestrator, ListPagingSetItemsPerPageAction, ListPagingSetMaxPagesAction, ListPagingSetPageNumberAction, ListSearchModel, ListSearchOrchestrator, ListSearchSetFieldSelectorsAction, ListSearchSetFunctionsAction, ListSearchSetOptionsAction, ListSearchSetSearchTextAction, ListSelectedLoadAction, ListSelectedModel, ListSelectedOrchestrator, ListSelectedSetItemSelectedAction, ListSelectedSetItemsSelectedAction, ListSelectedSetLoadingAction, ListSortLabelModel, ListSortModel, ListSortOrchestrator, ListSortSetAvailableAction, ListSortSetFieldSelectorsAction, ListSortSetGlobalAction, ListState, ListStateDispatcher, ListStateModel, ListStateOrchestrator, ListToolbarItemModel, ListToolbarItemsDisableAction, ListToolbarItemsLoadAction, ListToolbarItemsRemoveAction, ListToolbarModel, ListToolbarOrchestrator, ListToolbarSetExistsAction, ListToolbarSetTypeAction, ListToolbarShowMultiselectToolbarAction, ListViewComponent, ListViewModel, ListViewsLoadAction, ListViewsModel, ListViewsOrchestrator, ListViewsSetActiveAction, SkyListComponent, SkyListFilterInlineModel, SkyListFiltersModule, SkyListInMemoryDataProvider, SkyListModule, SkyListPagingModule, SkyListSecondaryActionsComponent, SkyListSecondaryActionsModule, SkyListToolbarComponent, SkyListToolbarModule, SkyListFilterButtonComponent as ɵa, SkyListFilterSummaryComponent as ɵb, SkyListFilterInlineItemComponent as ɵc, SkyListFilterInlineComponent as ɵd, SkyListFilterInlineItemRendererComponent as ɵe, SkyListPagingComponent as ɵf, ListPagingComponent as ɵg, SkyListSecondaryActionsService as ɵh, SkyListSecondaryActionsHostComponent as ɵi, SkyListSecondaryActionComponent as ɵj, SkyListBuilderResourcesModule as ɵk, SkyListBuilderResourcesProvider as ɵl, ListToolbarState as ɵm, ListToolbarStateModel as ɵn, ListToolbarStateDispatcher as ɵo, SkyListToolbarItemComponent as ɵp, SkyListToolbarSortComponent as ɵq, SkyListToolbarViewActionsComponent as ɵr, SkyListToolbarItemRendererComponent as ɵs, SkyListMultiselectToolbarComponent as ɵt, SkyListToolbarSearchActionsComponent as ɵu };
2884
- //# sourceMappingURL=skyux-list-builder.js.map