@koobiq/components 18.17.0 → 18.19.0

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 (208) hide show
  1. package/actions-panel/actions-panel-config.d.ts +79 -0
  2. package/actions-panel/actions-panel-container.d.ts +90 -0
  3. package/actions-panel/actions-panel-container.scss +33 -0
  4. package/actions-panel/actions-panel-ref.d.ts +31 -0
  5. package/actions-panel/actions-panel-tokens.scss +13 -0
  6. package/actions-panel/actions-panel.d.ts +144 -0
  7. package/actions-panel/index.d.ts +5 -0
  8. package/actions-panel/module.d.ts +7 -0
  9. package/core/animation/animation.d.ts +26 -0
  10. package/core/form-field/form-field-ref.d.ts +4 -0
  11. package/core/locales/en-US.d.ts +45 -0
  12. package/core/locales/es-LA.d.ts +45 -0
  13. package/core/locales/fa-IR.d.ts +45 -0
  14. package/core/locales/locale-service.d.ts +315 -0
  15. package/core/locales/pt-BR.d.ts +45 -0
  16. package/core/locales/ru-RU.d.ts +45 -0
  17. package/core/locales/tk-TM.d.ts +45 -0
  18. package/core/locales/types.d.ts +6 -0
  19. package/core/locales/zh-CN.d.ts +45 -0
  20. package/core/option/option.d.ts +3 -1
  21. package/datepicker/calendar.component.d.ts +9 -0
  22. package/datepicker/datepicker-input.directive.d.ts +5 -1
  23. package/dl/dl.component.d.ts +3 -4
  24. package/dropdown/_dropdown-theme.scss +9 -10
  25. package/dropdown/dropdown-tokens.scss +1 -0
  26. package/dropdown/dropdown.component.d.ts +1 -1
  27. package/dropdown/dropdown.scss +5 -0
  28. package/dropdown/dropdown.types.d.ts +3 -1
  29. package/esm2022/accordion/accordion-trigger.component.mjs +1 -1
  30. package/esm2022/actions-panel/actions-panel-config.mjs +55 -0
  31. package/esm2022/actions-panel/actions-panel-container.mjs +217 -0
  32. package/esm2022/actions-panel/actions-panel-ref.mjs +62 -0
  33. package/esm2022/actions-panel/actions-panel.mjs +220 -0
  34. package/esm2022/actions-panel/index.mjs +6 -0
  35. package/esm2022/actions-panel/koobiq-components-actions-panel.mjs +5 -0
  36. package/esm2022/actions-panel/module.mjs +21 -0
  37. package/esm2022/breadcrumbs/breadcrumbs.mjs +2 -2
  38. package/esm2022/code-block/code-block.mjs +1 -1
  39. package/esm2022/core/animation/animation.mjs +29 -1
  40. package/esm2022/core/common-behaviors/common-module.mjs +2 -2
  41. package/esm2022/core/form-field/form-field-ref.mjs +1 -1
  42. package/esm2022/core/locales/en-US.mjs +46 -1
  43. package/esm2022/core/locales/es-LA.mjs +46 -1
  44. package/esm2022/core/locales/fa-IR.mjs +46 -1
  45. package/esm2022/core/locales/pt-BR.mjs +46 -1
  46. package/esm2022/core/locales/ru-RU.mjs +46 -1
  47. package/esm2022/core/locales/tk-TM.mjs +46 -1
  48. package/esm2022/core/locales/types.mjs +1 -1
  49. package/esm2022/core/locales/zh-CN.mjs +46 -1
  50. package/esm2022/core/option/option.mjs +10 -3
  51. package/esm2022/core/version.mjs +2 -2
  52. package/esm2022/datepicker/calendar-header.component.mjs +1 -1
  53. package/esm2022/datepicker/calendar.component.mjs +20 -2
  54. package/esm2022/datepicker/datepicker-input.directive.mjs +22 -11
  55. package/esm2022/datepicker/datepicker-toggle.component.mjs +1 -1
  56. package/esm2022/dl/dl.component.mjs +8 -7
  57. package/esm2022/dropdown/dropdown-item.component.mjs +1 -1
  58. package/esm2022/dropdown/dropdown-trigger.directive.mjs +6 -1
  59. package/esm2022/dropdown/dropdown.component.mjs +4 -4
  60. package/esm2022/dropdown/dropdown.types.mjs +1 -1
  61. package/esm2022/file-upload/multiple-file-upload.component.mjs +1 -1
  62. package/esm2022/file-upload/single-file-upload.component.mjs +1 -1
  63. package/esm2022/filter-bar/filter-bar-button.mjs +30 -0
  64. package/esm2022/filter-bar/filter-bar.mjs +168 -0
  65. package/esm2022/filter-bar/filter-bar.module.mjs +65 -0
  66. package/esm2022/filter-bar/filter-bar.types.mjs +13 -0
  67. package/esm2022/filter-bar/filter-refresher.mjs +34 -0
  68. package/esm2022/filter-bar/filter-reset.mjs +38 -0
  69. package/esm2022/filter-bar/filter-search.mjs +132 -0
  70. package/esm2022/filter-bar/filters.mjs +225 -0
  71. package/esm2022/filter-bar/index.mjs +2 -0
  72. package/esm2022/filter-bar/koobiq-components-filter-bar.mjs +5 -0
  73. package/esm2022/filter-bar/pipe-add.mjs +129 -0
  74. package/esm2022/filter-bar/pipe.directive.mjs +55 -0
  75. package/esm2022/filter-bar/pipes/base-pipe.mjs +106 -0
  76. package/esm2022/filter-bar/pipes/pipe-button.mjs +59 -0
  77. package/esm2022/filter-bar/pipes/pipe-date.mjs +171 -0
  78. package/esm2022/filter-bar/pipes/pipe-datetime.mjs +172 -0
  79. package/esm2022/filter-bar/pipes/pipe-multi-select.mjs +96 -0
  80. package/esm2022/filter-bar/pipes/pipe-select.mjs +88 -0
  81. package/esm2022/filter-bar/pipes/pipe-state.mjs +45 -0
  82. package/esm2022/filter-bar/pipes/pipe-text.mjs +89 -0
  83. package/esm2022/filter-bar/pipes/pipe-title.mjs +96 -0
  84. package/esm2022/filter-bar/public-api.mjs +20 -0
  85. package/esm2022/form-field/cleaner.mjs +1 -1
  86. package/esm2022/form-field/form-field.mjs +13 -6
  87. package/esm2022/form-field/password-hint.mjs +1 -1
  88. package/esm2022/form-field/password-toggle.mjs +1 -1
  89. package/esm2022/form-field/stepper.mjs +1 -1
  90. package/esm2022/icon/icon-button.component.mjs +9 -9
  91. package/esm2022/icon/icon-item.component.mjs +10 -10
  92. package/esm2022/icon/icon.component.mjs +9 -12
  93. package/esm2022/list/list-selection.component.mjs +4 -4
  94. package/esm2022/modal/modal.component.mjs +1 -1
  95. package/esm2022/modal/modal.directive.mjs +1 -1
  96. package/esm2022/navbar/navbar-item.component.mjs +2 -2
  97. package/esm2022/overflow-items/overflow-items.mjs +151 -195
  98. package/esm2022/popover/popover.component.mjs +30 -10
  99. package/esm2022/select/select.component.mjs +3 -3
  100. package/esm2022/sidepanel/sidepanel-directives.mjs +2 -2
  101. package/esm2022/tabs/tab-header.component.mjs +1 -1
  102. package/esm2022/tabs/tab-nav-bar.mjs +2 -2
  103. package/esm2022/textarea/textarea.component.mjs +9 -5
  104. package/esm2022/timezone/timezone-select.component.mjs +2 -2
  105. package/esm2022/title/title.directive.mjs +12 -5
  106. package/esm2022/toast/toast.component.mjs +2 -2
  107. package/esm2022/tree/toggle.mjs +1 -1
  108. package/esm2022/tree/tree-option.component.mjs +3 -2
  109. package/esm2022/tree/tree-selection.component.mjs +4 -2
  110. package/esm2022/tree-select/tree-select.component.mjs +6 -4
  111. package/fesm2022/koobiq-components-accordion.mjs +1 -1
  112. package/fesm2022/koobiq-components-accordion.mjs.map +1 -1
  113. package/fesm2022/koobiq-components-actions-panel.mjs +567 -0
  114. package/fesm2022/koobiq-components-actions-panel.mjs.map +1 -0
  115. package/fesm2022/koobiq-components-breadcrumbs.mjs +1 -1
  116. package/fesm2022/koobiq-components-breadcrumbs.mjs.map +1 -1
  117. package/fesm2022/koobiq-components-code-block.mjs +1 -1
  118. package/fesm2022/koobiq-components-code-block.mjs.map +1 -1
  119. package/fesm2022/koobiq-components-core.mjs +355 -5
  120. package/fesm2022/koobiq-components-core.mjs.map +1 -1
  121. package/fesm2022/koobiq-components-datepicker.mjs +40 -12
  122. package/fesm2022/koobiq-components-datepicker.mjs.map +1 -1
  123. package/fesm2022/koobiq-components-dl.mjs +7 -6
  124. package/fesm2022/koobiq-components-dl.mjs.map +1 -1
  125. package/fesm2022/koobiq-components-dropdown.mjs +9 -4
  126. package/fesm2022/koobiq-components-dropdown.mjs.map +1 -1
  127. package/fesm2022/koobiq-components-file-upload.mjs +2 -2
  128. package/fesm2022/koobiq-components-file-upload.mjs.map +1 -1
  129. package/fesm2022/koobiq-components-filter-bar.mjs +1596 -0
  130. package/fesm2022/koobiq-components-filter-bar.mjs.map +1 -0
  131. package/fesm2022/koobiq-components-form-field.mjs +16 -9
  132. package/fesm2022/koobiq-components-form-field.mjs.map +1 -1
  133. package/fesm2022/koobiq-components-icon.mjs +23 -26
  134. package/fesm2022/koobiq-components-icon.mjs.map +1 -1
  135. package/fesm2022/koobiq-components-list.mjs +3 -3
  136. package/fesm2022/koobiq-components-list.mjs.map +1 -1
  137. package/fesm2022/koobiq-components-modal.mjs +2 -2
  138. package/fesm2022/koobiq-components-modal.mjs.map +1 -1
  139. package/fesm2022/koobiq-components-navbar.mjs +2 -2
  140. package/fesm2022/koobiq-components-navbar.mjs.map +1 -1
  141. package/fesm2022/koobiq-components-overflow-items.mjs +152 -196
  142. package/fesm2022/koobiq-components-overflow-items.mjs.map +1 -1
  143. package/fesm2022/koobiq-components-popover.mjs +29 -9
  144. package/fesm2022/koobiq-components-popover.mjs.map +1 -1
  145. package/fesm2022/koobiq-components-select.mjs +2 -2
  146. package/fesm2022/koobiq-components-select.mjs.map +1 -1
  147. package/fesm2022/koobiq-components-sidepanel.mjs +1 -1
  148. package/fesm2022/koobiq-components-sidepanel.mjs.map +1 -1
  149. package/fesm2022/koobiq-components-tabs.mjs +2 -2
  150. package/fesm2022/koobiq-components-tabs.mjs.map +1 -1
  151. package/fesm2022/koobiq-components-textarea.mjs +8 -4
  152. package/fesm2022/koobiq-components-textarea.mjs.map +1 -1
  153. package/fesm2022/koobiq-components-timezone.mjs +2 -2
  154. package/fesm2022/koobiq-components-timezone.mjs.map +1 -1
  155. package/fesm2022/koobiq-components-title.mjs +11 -4
  156. package/fesm2022/koobiq-components-title.mjs.map +1 -1
  157. package/fesm2022/koobiq-components-toast.mjs +1 -1
  158. package/fesm2022/koobiq-components-toast.mjs.map +1 -1
  159. package/fesm2022/koobiq-components-tree-select.mjs +5 -3
  160. package/fesm2022/koobiq-components-tree-select.mjs.map +1 -1
  161. package/fesm2022/koobiq-components-tree.mjs +6 -3
  162. package/fesm2022/koobiq-components-tree.mjs.map +1 -1
  163. package/filter-bar/_filter-bar-theme.scss +61 -0
  164. package/filter-bar/filter-bar-button.d.ts +8 -0
  165. package/filter-bar/filter-bar.d.ts +55 -0
  166. package/filter-bar/filter-bar.module.d.ts +17 -0
  167. package/filter-bar/filter-bar.scss +60 -0
  168. package/filter-bar/filter-bar.types.d.ts +97 -0
  169. package/filter-bar/filter-refresher.d.ts +5 -0
  170. package/filter-bar/filter-refresher.scss +6 -0
  171. package/filter-bar/filter-reset.d.ts +11 -0
  172. package/filter-bar/filter-search.d.ts +25 -0
  173. package/filter-bar/filter-search.scss +14 -0
  174. package/filter-bar/filters.d.ts +72 -0
  175. package/filter-bar/filters.scss +92 -0
  176. package/filter-bar/index.d.ts +1 -0
  177. package/filter-bar/pipe-add.d.ts +18 -0
  178. package/filter-bar/pipe-add.scss +5 -0
  179. package/filter-bar/pipe.directive.d.ts +13 -0
  180. package/filter-bar/pipes/base-pipe.d.ts +40 -0
  181. package/filter-bar/pipes/base-pipe.scss +117 -0
  182. package/filter-bar/pipes/pipe-button.d.ts +13 -0
  183. package/filter-bar/pipes/pipe-button.scss +5 -0
  184. package/filter-bar/pipes/pipe-date.d.ts +41 -0
  185. package/filter-bar/pipes/pipe-date.scss +132 -0
  186. package/filter-bar/pipes/pipe-datetime.d.ts +41 -0
  187. package/filter-bar/pipes/pipe-multi-select.d.ts +22 -0
  188. package/filter-bar/pipes/pipe-multiselect.scss +15 -0
  189. package/filter-bar/pipes/pipe-select.d.ts +21 -0
  190. package/filter-bar/pipes/pipe-select.scss +3 -0
  191. package/filter-bar/pipes/pipe-state.d.ts +14 -0
  192. package/filter-bar/pipes/pipe-text.d.ts +19 -0
  193. package/filter-bar/pipes/pipe-title.d.ts +25 -0
  194. package/filter-bar/public-api.d.ts +19 -0
  195. package/form-field/form-field.d.ts +6 -1
  196. package/form-field/form-field.scss +1 -0
  197. package/icon/icon-button.component.d.ts +5 -3
  198. package/icon/icon-item.component.d.ts +5 -3
  199. package/icon/icon.component.d.ts +5 -4
  200. package/overflow-items/overflow-items.d.ts +68 -82
  201. package/package.json +18 -6
  202. package/popover/popover.component.d.ts +6 -1
  203. package/schematics/ng-add/index.js +5 -5
  204. package/select/_select-theme.scss +9 -1
  205. package/textarea/textarea.component.d.ts +2 -1
  206. package/title/title.directive.d.ts +2 -0
  207. package/tree-select/_tree-select-theme.scss +9 -1
  208. package/tree-select/tree-select.component.d.ts +1 -1
@@ -1,73 +1,106 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, TemplateRef, Directive, input, signal, viewChildren, ElementRef, contentChildren, contentChild, viewChild, computed, booleanAttribute, Component, ChangeDetectionStrategy, NgModule } from '@angular/core';
3
- import { ContentObserver } from '@angular/cdk/observers';
2
+ import { inject, Renderer2, ElementRef, signal, Directive, input, contentChildren, contentChild, booleanAttribute, numberAttribute, output, NgModule } from '@angular/core';
4
3
  import { SharedResizeObserver } from '@angular/cdk/observers/private';
5
- import { NgTemplateOutlet } from '@angular/common';
6
- import { toObservable, takeUntilDestroyed } from '@angular/core/rxjs-interop';
7
- import { skip, merge, debounceTime } from 'rxjs';
4
+ import { DOCUMENT } from '@angular/common';
5
+ import { toSignal, outputToObservable, toObservable, takeUntilDestroyed } from '@angular/core/rxjs-interop';
6
+ import { merge, skip, debounceTime } from 'rxjs';
8
7
 
9
8
  /**
10
- * Directive for providing `KbqOverflowItemsResultContext` to the `KbqOverflowItems` component.
9
+ * Manages the visibility of the element.
11
10
  *
12
- * @see `KbqOverflowItemsResultContext`
11
+ * @docs-private
13
12
  */
14
- class KbqOverflowItemsResult {
13
+ class ElementVisibilityManager {
15
14
  constructor() {
15
+ this.renderer = inject(Renderer2);
16
16
  /**
17
- * TemplateRef for the overflow result.
17
+ * Reference to the element.
18
18
  *
19
19
  * @docs-private
20
20
  */
21
- this.templateRef = inject(TemplateRef);
21
+ this.elementRef = inject(ElementRef);
22
+ /**
23
+ * Whether the element is hidden.
24
+ *
25
+ * @docs-private
26
+ */
27
+ this.hidden = signal(false);
22
28
  }
23
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: KbqOverflowItemsResult, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
24
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.6", type: KbqOverflowItemsResult, isStandalone: true, selector: "ng-template[kbqOverflowItemsResult]", ngImport: i0 }); }
29
+ /**
30
+ * Hides the element.
31
+ *
32
+ * @docs-private
33
+ */
34
+ hide() {
35
+ this.renderer.setStyle(this.elementRef.nativeElement, 'visibility', 'hidden');
36
+ this.renderer.setStyle(this.elementRef.nativeElement, 'position', 'absolute');
37
+ this.hidden.set(true);
38
+ }
39
+ /**
40
+ * Shows the element.
41
+ *
42
+ * @docs-private
43
+ */
44
+ show() {
45
+ this.renderer.removeStyle(this.elementRef.nativeElement, 'visibility');
46
+ this.renderer.removeStyle(this.elementRef.nativeElement, 'position');
47
+ this.hidden.set(false);
48
+ }
49
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: ElementVisibilityManager, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
50
+ /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.6", type: ElementVisibilityManager, host: { properties: { "attr.aria-hidden": "hidden()" } }, ngImport: i0 }); }
51
+ }
52
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: ElementVisibilityManager, decorators: [{
53
+ type: Directive,
54
+ args: [{
55
+ host: {
56
+ '[attr.aria-hidden]': 'hidden()'
57
+ }
58
+ }]
59
+ }] });
60
+ /**
61
+ * Directive for displaying the result of hidden items by the `KbqOverflowItems` directive.
62
+ */
63
+ class KbqOverflowItemsResult extends ElementVisibilityManager {
64
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: KbqOverflowItemsResult, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
65
+ /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.6", type: KbqOverflowItemsResult, isStandalone: true, selector: "[kbqOverflowItemsResult]", host: { classAttribute: "kbq-overflow-items-result" }, exportAs: ["kbqOverflowItemsResult"], usesInheritance: true, ngImport: i0 }); }
25
66
  }
26
67
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: KbqOverflowItemsResult, decorators: [{
27
68
  type: Directive,
28
69
  args: [{
29
70
  standalone: true,
30
- selector: 'ng-template[kbqOverflowItemsResult]'
71
+ selector: '[kbqOverflowItemsResult]',
72
+ exportAs: 'kbqOverflowItemsResult',
73
+ host: { class: 'kbq-overflow-items-result' }
31
74
  }]
32
75
  }] });
33
76
  /**
34
- * Structure directive for providing items to the `KbqOverflowItems`.
77
+ * Directive for the item that can be hidden by the `KbqOverflowItems` directive.
35
78
  */
36
- class KbqOverflowItem {
79
+ class KbqOverflowItem extends ElementVisibilityManager {
37
80
  constructor() {
81
+ super(...arguments);
38
82
  /**
39
- * Identifier for the item.
83
+ * Unique identifier for the item.
40
84
  */
41
85
  this.id = input.required({ alias: 'kbqOverflowItem' });
42
- /**
43
- * Whether the item is hidden.
44
- *
45
- * @docs-private
46
- */
47
- this.hidden = signal(false);
48
- /**
49
- * TemplateRef for the item.
50
- *
51
- * @docs-private
52
- */
53
- this.templateRef = inject(TemplateRef);
54
86
  }
55
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: KbqOverflowItem, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
56
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.6", type: KbqOverflowItem, isStandalone: true, selector: "[kbqOverflowItem]", inputs: { id: { classPropertyName: "id", publicName: "kbqOverflowItem", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 }); }
87
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: KbqOverflowItem, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
88
+ /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.6", type: KbqOverflowItem, isStandalone: true, selector: "[kbqOverflowItem]", inputs: { id: { classPropertyName: "id", publicName: "kbqOverflowItem", isSignal: true, isRequired: true, transformFunction: null } }, host: { classAttribute: "kbq-overflow-item" }, exportAs: ["kbqOverflowItem"], usesInheritance: true, ngImport: i0 }); }
57
89
  }
58
90
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: KbqOverflowItem, decorators: [{
59
91
  type: Directive,
60
92
  args: [{
61
93
  standalone: true,
62
- selector: '[kbqOverflowItem]'
94
+ selector: '[kbqOverflowItem]',
95
+ exportAs: 'kbqOverflowItem',
96
+ host: { class: 'kbq-overflow-item' }
63
97
  }]
64
98
  }] });
65
99
  /**
66
- * Component for automatically hiding elements with dynamic adaptation to the container width.
100
+ * Directive for managing the visibility of items that overflow the container.
67
101
  */
68
102
  class KbqOverflowItems {
69
103
  constructor() {
70
- this.itemElementRefs = viewChildren('itemRef', { read: ElementRef });
71
104
  /**
72
105
  * `KbqOverflowItem` directive references.
73
106
  *
@@ -80,192 +113,115 @@ class KbqOverflowItems {
80
113
  * @docs-private
81
114
  */
82
115
  this.result = contentChild(KbqOverflowItemsResult);
83
- this.resultElementRef = viewChild('resultRef', { read: ElementRef });
84
116
  /**
85
- * Template context for the `KbqOverflowItemsResult` directive.
117
+ * Whether the overflow order should be reversed.
86
118
  *
87
- * @docs-private
119
+ * @default false
88
120
  */
89
- this.resultTemplateContext = computed(() => {
90
- const hiddenItemIDs = new Set(this.items()
91
- .filter(({ hidden }) => hidden())
92
- .map(({ id }) => id()));
93
- return {
94
- $implicit: hiddenItemIDs,
95
- hiddenItemIDs: hiddenItemIDs
96
- };
97
- });
121
+ this.reverseOverflowOrder = input(false, { transform: booleanAttribute });
98
122
  /**
99
- * Whether the overflow result is hidden.
123
+ * Debounce time for recalculating items visibility.
100
124
  *
101
- * @docs-private
125
+ * @default 100
102
126
  */
103
- this.resultHidden = computed(() => !this.items().some(({ hidden }) => hidden()));
127
+ this.debounceTime = input(100, { transform: numberAttribute });
104
128
  /**
105
- * Whether the overflow order should be reversed.
106
- * Also changes the position of the `resultTemplateRef`.
107
- *
108
- * @default false
129
+ * Emits when the set of hidden items changes.
109
130
  */
110
- this.reverseOverflowOrder = input(false, { transform: booleanAttribute });
131
+ this.changes = output();
132
+ /**
133
+ * Set of hidden item IDs.
134
+ */
135
+ this.hiddenItemIDs = toSignal(outputToObservable(this.changes), {
136
+ initialValue: new Set([])
137
+ });
111
138
  this.elementRef = inject(ElementRef);
112
139
  this.resizeObserver = inject(SharedResizeObserver);
113
- this.contentObserver = inject(ContentObserver);
114
- toObservable(this.reverseOverflowOrder)
115
- .pipe(skip(1), takeUntilDestroyed())
116
- .subscribe(() => {
117
- this.items().forEach(({ hidden }) => hidden.set(false));
118
- });
119
- merge(toObservable(this.items), this.resizeObserver.observe(this.elementRef.nativeElement), this.contentObserver.observe(this.elementRef.nativeElement).pipe(debounceTime(0)))
120
- .pipe(takeUntilDestroyed())
140
+ this.renderer = inject(Renderer2);
141
+ this.document = inject(DOCUMENT);
142
+ /**
143
+ * Determines if the given item is hidden.
144
+ */
145
+ this.isHiddenItem = ({ hidden }) => hidden();
146
+ this.setStyles();
147
+ merge(toObservable(this.items), toObservable(this.reverseOverflowOrder).pipe(skip(1)), this.resizeObserver.observe(this.elementRef.nativeElement))
148
+ .pipe(debounceTime(this.debounceTime()), takeUntilDestroyed())
121
149
  .subscribe(() => {
122
- this.updateItemsVisibility();
150
+ const hiddenItems = this.calculateItemsVisibility(this.items(), this.reverseOverflowOrder(), this.result(), this.elementRef.nativeElement);
151
+ const hiddenItemIDs = new Set(hiddenItems.map(({ id }) => id()));
152
+ this.changes.emit(hiddenItemIDs);
123
153
  });
124
154
  }
125
155
  /**
126
- * Updates the visibility of items based on the container width.
127
- *
128
- * This method calculates whether items should be hidden or shown by comparing the scroll width of the container
129
- * with its visible width. It determines which items are visible and which are hidden, and applies the hiding logic
130
- * based on the `reverseOverflowOrder` flag.
131
- *
132
- * The function operates recursively to adjust the visibility of items until the overflow condition is resolved.
133
- *
134
- * - If the container is overflown, it hides the last visible item from the end (or start if `reverseOverflowOrder`)
135
- * and checks if further adjustments are needed.
136
- * - If the container is not overflown, it reveals the first hidden item from the start
137
- * (or end if `reverseOverflowOrder`), ensuring it fits within the visible area.
156
+ * Calculates the visibility of items, based on the container width and `reverseOverflowOrder` property.
138
157
  */
139
- updateItemsVisibility() {
140
- const itemElementRefs = this.itemElementRefs();
141
- const items = this.items().map(({ hidden }, index, _items) => {
142
- return {
143
- hidden,
144
- isFirst: index === 0,
145
- isLast: index === _items.length - 1,
146
- elementRef: itemElementRefs[index]
147
- };
158
+ calculateItemsVisibility(items, reverseOverflowOrder, result, { offsetWidth: totalWidth }) {
159
+ result?.hide();
160
+ items.forEach((item) => {
161
+ item.show();
148
162
  });
149
- const reverseOverflowOrder = this.reverseOverflowOrder();
150
- const isEdgeItem = ({ isFirst, isLast }) => (reverseOverflowOrder ? isFirst : isLast);
151
- const { offsetWidth: totalWidth, scrollWidth } = this.elementRef.nativeElement;
152
- const isOverflown = scrollWidth > totalWidth;
153
- if (isOverflown) {
154
- const isVisibleItem = ({ hidden }) => !hidden();
155
- const lastVisibleItem = !reverseOverflowOrder
156
- ? this.findLast(items, isVisibleItem)
157
- : items.find(isVisibleItem);
158
- if (lastVisibleItem) {
159
- lastVisibleItem.hidden.set(true);
160
- if (!isEdgeItem(lastVisibleItem)) {
161
- this.updateItemsVisibility();
162
- }
163
+ let itemsWidth = items.reduce((width, { elementRef }) => width + this.getElementWidthWithMargins(elementRef), 0);
164
+ const startIndex = reverseOverflowOrder ? 0 : items.length - 1;
165
+ const endIndex = reverseOverflowOrder ? items.length : -1;
166
+ const step = reverseOverflowOrder ? 1 : -1;
167
+ const resultWidth = result ? this.getElementWidthWithMargins(result.elementRef) : 0;
168
+ for (let index = startIndex; index !== endIndex; index += step) {
169
+ const current = items[index];
170
+ const currentWidth = this.getElementWidthWithMargins(current.elementRef);
171
+ const _resultWidth = items.some(this.isHiddenItem) ? resultWidth : 0;
172
+ if (itemsWidth + _resultWidth > totalWidth) {
173
+ current.hide();
174
+ itemsWidth -= currentWidth;
163
175
  }
164
- }
165
- else {
166
- const isHiddenItem = ({ hidden }) => hidden();
167
- const firstHiddenItem = !reverseOverflowOrder
168
- ? items.find(isHiddenItem)
169
- : this.findLast(items, isHiddenItem);
170
- if (firstHiddenItem) {
171
- const firstHiddenItemWidth = firstHiddenItem.elementRef.nativeElement.offsetWidth;
172
- const visibleItemsTotalWidth = items
173
- .filter(({ hidden }) => !hidden())
174
- .reduce((width, { elementRef }) => width + elementRef.nativeElement.offsetWidth, 0);
175
- const _isEdgeItem = isEdgeItem(firstHiddenItem);
176
- const resultWidth = _isEdgeItem ? 0 : this.resultElementRef()?.nativeElement.offsetWidth || 0;
177
- if (firstHiddenItemWidth + visibleItemsTotalWidth + resultWidth <= totalWidth) {
178
- firstHiddenItem.hidden.set(false);
179
- if (!_isEdgeItem) {
180
- this.updateItemsVisibility();
181
- }
176
+ else {
177
+ const isEdgeElement = reverseOverflowOrder ? index === 0 : index === items.length - 1;
178
+ const _resultWidth = isEdgeElement ? 0 : resultWidth;
179
+ if (itemsWidth + currentWidth + _resultWidth <= totalWidth) {
180
+ current.show();
181
+ itemsWidth += currentWidth;
182
182
  }
183
183
  }
184
184
  }
185
- }
186
- /** @TODO Should use `Array.prototype.findLast` after migrating to ES2023 */
187
- findLast(array, predicate) {
188
- for (let i = array.length - 1; i >= 0; i--) {
189
- if (predicate(array[i], i, array)) {
190
- return array[i];
191
- }
185
+ const hiddenItems = items.filter(this.isHiddenItem);
186
+ if (hiddenItems.length > 0) {
187
+ result?.show();
192
188
  }
193
- return undefined;
189
+ return hiddenItems;
194
190
  }
195
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: KbqOverflowItems, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
196
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.6", type: KbqOverflowItems, isStandalone: true, selector: "kbq-overflow-items", inputs: { reverseOverflowOrder: { classPropertyName: "reverseOverflowOrder", publicName: "reverseOverflowOrder", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "kbq-overflow-items" }, queries: [{ propertyName: "items", predicate: KbqOverflowItem, isSignal: true }, { propertyName: "result", first: true, predicate: KbqOverflowItemsResult, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "itemElementRefs", predicate: ["itemRef"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "resultElementRef", first: true, predicate: ["resultRef"], descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: `
197
- @if (reverseOverflowOrder()) {
198
- <ng-container [ngTemplateOutlet]="template" />
199
- }
200
-
201
- @for (item of items(); track item.id()) {
202
- <div
203
- class="kbq-overflow-items__item"
204
- #itemRef
205
- [attr.aria-hidden]="item.hidden()"
206
- [class.kbq-overflow-items__item_hidden]="item.hidden()"
207
- >
208
- <ng-container [ngTemplateOutlet]="item.templateRef" />
209
- </div>
210
- }
211
-
212
- @if (!reverseOverflowOrder()) {
213
- <ng-container [ngTemplateOutlet]="template" />
214
- }
215
-
216
- <ng-template #template>
217
- <div
218
- class="kbq-overflow-items__result"
219
- #resultRef
220
- [attr.aria-hidden]="resultHidden()"
221
- [class.kbq-overflow-items__result_hidden]="resultHidden()"
222
- >
223
- <ng-container
224
- [ngTemplateOutlet]="result()?.templateRef || null"
225
- [ngTemplateOutletContext]="resultTemplateContext()"
226
- />
227
- </div>
228
- </ng-template>
229
- `, isInline: true, styles: [":host{position:relative;display:flex;flex-grow:1;overflow:hidden;flex-wrap:nowrap;white-space:nowrap}.kbq-overflow-items__item,.kbq-overflow-items__result{display:flex;align-items:center}.kbq-overflow-items__item.kbq-overflow-items__item_hidden,.kbq-overflow-items__item.kbq-overflow-items__result_hidden,.kbq-overflow-items__result.kbq-overflow-items__item_hidden,.kbq-overflow-items__result.kbq-overflow-items__result_hidden{visibility:hidden;position:absolute}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
191
+ /**
192
+ * Returns the width of the element including margins.
193
+ */
194
+ getElementWidthWithMargins({ nativeElement }) {
195
+ const { marginLeft, marginRight } = this.getWindow().getComputedStyle(nativeElement);
196
+ return Math.ceil(parseFloat(marginLeft) + nativeElement.offsetWidth + parseFloat(marginRight));
197
+ }
198
+ /**
199
+ * This method sets the necessary styles for the directive.
200
+ */
201
+ setStyles() {
202
+ this.renderer.setStyle(this.elementRef.nativeElement, 'position', 'relative');
203
+ this.renderer.setStyle(this.elementRef.nativeElement, 'display', 'flex');
204
+ this.renderer.setStyle(this.elementRef.nativeElement, 'flex-wrap', 'nowrap');
205
+ this.renderer.setStyle(this.elementRef.nativeElement, 'flex-grow', '1');
206
+ this.renderer.setStyle(this.elementRef.nativeElement, 'overflow', 'hidden');
207
+ }
208
+ /**
209
+ * Returns the window object.
210
+ */
211
+ getWindow() {
212
+ return this.document.defaultView || window;
213
+ }
214
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: KbqOverflowItems, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
215
+ /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "18.2.6", type: KbqOverflowItems, isStandalone: true, selector: "[kbqOverflowItems]", inputs: { reverseOverflowOrder: { classPropertyName: "reverseOverflowOrder", publicName: "reverseOverflowOrder", isSignal: true, isRequired: false, transformFunction: null }, debounceTime: { classPropertyName: "debounceTime", publicName: "debounceTime", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { changes: "changes" }, host: { classAttribute: "kbq-overflow-items" }, queries: [{ propertyName: "items", predicate: KbqOverflowItem, isSignal: true }, { propertyName: "result", first: true, predicate: KbqOverflowItemsResult, descendants: true, isSignal: true }], exportAs: ["kbqOverflowItems"], ngImport: i0 }); }
230
216
  }
231
217
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: KbqOverflowItems, decorators: [{
232
- type: Component,
233
- args: [{ standalone: true, selector: 'kbq-overflow-items', imports: [NgTemplateOutlet], template: `
234
- @if (reverseOverflowOrder()) {
235
- <ng-container [ngTemplateOutlet]="template" />
236
- }
237
-
238
- @for (item of items(); track item.id()) {
239
- <div
240
- class="kbq-overflow-items__item"
241
- #itemRef
242
- [attr.aria-hidden]="item.hidden()"
243
- [class.kbq-overflow-items__item_hidden]="item.hidden()"
244
- >
245
- <ng-container [ngTemplateOutlet]="item.templateRef" />
246
- </div>
247
- }
248
-
249
- @if (!reverseOverflowOrder()) {
250
- <ng-container [ngTemplateOutlet]="template" />
251
- }
252
-
253
- <ng-template #template>
254
- <div
255
- class="kbq-overflow-items__result"
256
- #resultRef
257
- [attr.aria-hidden]="resultHidden()"
258
- [class.kbq-overflow-items__result_hidden]="resultHidden()"
259
- >
260
- <ng-container
261
- [ngTemplateOutlet]="result()?.templateRef || null"
262
- [ngTemplateOutletContext]="resultTemplateContext()"
263
- />
264
- </div>
265
- </ng-template>
266
- `, host: {
267
- class: 'kbq-overflow-items'
268
- }, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{position:relative;display:flex;flex-grow:1;overflow:hidden;flex-wrap:nowrap;white-space:nowrap}.kbq-overflow-items__item,.kbq-overflow-items__result{display:flex;align-items:center}.kbq-overflow-items__item.kbq-overflow-items__item_hidden,.kbq-overflow-items__item.kbq-overflow-items__result_hidden,.kbq-overflow-items__result.kbq-overflow-items__item_hidden,.kbq-overflow-items__result.kbq-overflow-items__result_hidden{visibility:hidden;position:absolute}\n"] }]
218
+ type: Directive,
219
+ args: [{
220
+ standalone: true,
221
+ selector: '[kbqOverflowItems]',
222
+ exportAs: 'kbqOverflowItems',
223
+ host: { class: 'kbq-overflow-items' }
224
+ }]
269
225
  }], ctorParameters: () => [] });
270
226
 
271
227
  const COMPONENTS = [
@@ -294,5 +250,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImpor
294
250
  * Generated bundle index. Do not edit.
295
251
  */
296
252
 
297
- export { KbqOverflowItem, KbqOverflowItems, KbqOverflowItemsModule, KbqOverflowItemsResult };
253
+ export { ElementVisibilityManager, KbqOverflowItem, KbqOverflowItems, KbqOverflowItemsModule, KbqOverflowItemsResult };
298
254
  //# sourceMappingURL=koobiq-components-overflow-items.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"koobiq-components-overflow-items.mjs","sources":["../../../packages/components/overflow-items/overflow-items.ts","../../../packages/components/overflow-items/module.ts","../../../packages/components/overflow-items/koobiq-components-overflow-items.ts"],"sourcesContent":["import { ContentObserver } from '@angular/cdk/observers';\nimport { SharedResizeObserver } from '@angular/cdk/observers/private';\nimport { NgTemplateOutlet } from '@angular/common';\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n contentChild,\n contentChildren,\n Directive,\n ElementRef,\n inject,\n input,\n signal,\n TemplateRef,\n viewChild,\n viewChildren\n} from '@angular/core';\nimport { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';\nimport { debounceTime, merge, skip } from 'rxjs';\n\n/**\n * Template context for the `KbqOverflowItemsResult` directive.\n *\n * @see `KbqOverflowItemsResult`\n */\nexport type KbqOverflowItemsResultContext = {\n /**\n * Set of hidden item ID's.\n *\n * Example:\n *\n * ```html\n * <ng-template kbqOverflowItemsResult let-hiddenItemIDs>\n * {{ hiddenItemIDs.size }}\n * </ng-template>\n * ````\n */\n $implicit: ReadonlySet<unknown>;\n /**\n * Set of hidden item ID's.\n *\n * Example:\n *\n * ```html\n * <ng-template kbqOverflowItemsResult let-hiddenItemIDs=\"hiddenItemIDs\">\n * @if (hiddenItemIDs.has(SOME_ID)) {...}\n * </ng-template>\n * ````\n */\n hiddenItemIDs: ReadonlySet<unknown>;\n};\n\n/**\n * Directive for providing `KbqOverflowItemsResultContext` to the `KbqOverflowItems` component.\n *\n * @see `KbqOverflowItemsResultContext`\n */\n@Directive({\n standalone: true,\n selector: 'ng-template[kbqOverflowItemsResult]'\n})\nexport class KbqOverflowItemsResult {\n /**\n * TemplateRef for the overflow result.\n *\n * @docs-private\n */\n readonly templateRef = inject<TemplateRef<KbqOverflowItemsResultContext>>(TemplateRef);\n}\n\n/**\n * Structure directive for providing items to the `KbqOverflowItems`.\n */\n@Directive({\n standalone: true,\n selector: '[kbqOverflowItem]'\n})\nexport class KbqOverflowItem {\n /**\n * Identifier for the item.\n */\n readonly id = input.required({ alias: 'kbqOverflowItem' });\n\n /**\n * Whether the item is hidden.\n *\n * @docs-private\n */\n readonly hidden = signal<boolean>(false);\n\n /**\n * TemplateRef for the item.\n *\n * @docs-private\n */\n readonly templateRef = inject(TemplateRef);\n}\n\n/**\n * Component for automatically hiding elements with dynamic adaptation to the container width.\n */\n@Component({\n standalone: true,\n selector: 'kbq-overflow-items',\n imports: [NgTemplateOutlet],\n template: `\n @if (reverseOverflowOrder()) {\n <ng-container [ngTemplateOutlet]=\"template\" />\n }\n\n @for (item of items(); track item.id()) {\n <div\n class=\"kbq-overflow-items__item\"\n #itemRef\n [attr.aria-hidden]=\"item.hidden()\"\n [class.kbq-overflow-items__item_hidden]=\"item.hidden()\"\n >\n <ng-container [ngTemplateOutlet]=\"item.templateRef\" />\n </div>\n }\n\n @if (!reverseOverflowOrder()) {\n <ng-container [ngTemplateOutlet]=\"template\" />\n }\n\n <ng-template #template>\n <div\n class=\"kbq-overflow-items__result\"\n #resultRef\n [attr.aria-hidden]=\"resultHidden()\"\n [class.kbq-overflow-items__result_hidden]=\"resultHidden()\"\n >\n <ng-container\n [ngTemplateOutlet]=\"result()?.templateRef || null\"\n [ngTemplateOutletContext]=\"resultTemplateContext()\"\n />\n </div>\n </ng-template>\n `,\n styleUrl: './overflow-items.scss',\n host: {\n class: 'kbq-overflow-items'\n },\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class KbqOverflowItems {\n private readonly itemElementRefs = viewChildren<string, ElementRef<HTMLElement>>('itemRef', { read: ElementRef });\n\n /**\n * `KbqOverflowItem` directive references.\n *\n * @docs-private\n */\n protected readonly items = contentChildren(KbqOverflowItem);\n\n /**\n * `KbqOverflowItemsResult` directive reference.\n *\n * @docs-private\n */\n protected readonly result = contentChild(KbqOverflowItemsResult);\n\n private readonly resultElementRef = viewChild<string, ElementRef<HTMLElement>>('resultRef', { read: ElementRef });\n\n /**\n * Template context for the `KbqOverflowItemsResult` directive.\n *\n * @docs-private\n */\n protected readonly resultTemplateContext = computed<KbqOverflowItemsResultContext>(() => {\n const hiddenItemIDs = new Set(\n this.items()\n .filter(({ hidden }) => hidden())\n .map(({ id }) => id())\n );\n return {\n $implicit: hiddenItemIDs,\n hiddenItemIDs: hiddenItemIDs\n };\n });\n\n /**\n * Whether the overflow result is hidden.\n *\n * @docs-private\n */\n protected readonly resultHidden = computed(() => !this.items().some(({ hidden }) => hidden()));\n\n /**\n * Whether the overflow order should be reversed.\n * Also changes the position of the `resultTemplateRef`.\n *\n * @default false\n */\n readonly reverseOverflowOrder = input(false, { transform: booleanAttribute });\n\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly resizeObserver = inject(SharedResizeObserver);\n private readonly contentObserver = inject(ContentObserver);\n\n constructor() {\n toObservable(this.reverseOverflowOrder)\n .pipe(skip(1), takeUntilDestroyed())\n .subscribe(() => {\n this.items().forEach(({ hidden }) => hidden.set(false));\n });\n\n merge(\n toObservable(this.items),\n this.resizeObserver.observe(this.elementRef.nativeElement),\n this.contentObserver.observe(this.elementRef.nativeElement).pipe(debounceTime(0))\n )\n .pipe(takeUntilDestroyed())\n .subscribe(() => {\n this.updateItemsVisibility();\n });\n }\n\n /**\n * Updates the visibility of items based on the container width.\n *\n * This method calculates whether items should be hidden or shown by comparing the scroll width of the container\n * with its visible width. It determines which items are visible and which are hidden, and applies the hiding logic\n * based on the `reverseOverflowOrder` flag.\n *\n * The function operates recursively to adjust the visibility of items until the overflow condition is resolved.\n *\n * - If the container is overflown, it hides the last visible item from the end (or start if `reverseOverflowOrder`)\n * and checks if further adjustments are needed.\n * - If the container is not overflown, it reveals the first hidden item from the start\n * (or end if `reverseOverflowOrder`), ensuring it fits within the visible area.\n */\n private updateItemsVisibility(): void {\n const itemElementRefs = this.itemElementRefs();\n const items = this.items().map(({ hidden }, index, _items) => {\n return {\n hidden,\n isFirst: index === 0,\n isLast: index === _items.length - 1,\n elementRef: itemElementRefs[index]\n };\n });\n const reverseOverflowOrder = this.reverseOverflowOrder();\n const isEdgeItem = ({ isFirst, isLast }: (typeof items)[number]) => (reverseOverflowOrder ? isFirst : isLast);\n const { offsetWidth: totalWidth, scrollWidth } = this.elementRef.nativeElement;\n const isOverflown = scrollWidth > totalWidth;\n if (isOverflown) {\n const isVisibleItem = ({ hidden }: (typeof items)[number]) => !hidden();\n const lastVisibleItem = !reverseOverflowOrder\n ? this.findLast(items, isVisibleItem)\n : items.find(isVisibleItem);\n if (lastVisibleItem) {\n lastVisibleItem.hidden.set(true);\n if (!isEdgeItem(lastVisibleItem)) {\n this.updateItemsVisibility();\n }\n }\n } else {\n const isHiddenItem = ({ hidden }: (typeof items)[number]) => hidden();\n const firstHiddenItem = !reverseOverflowOrder\n ? items.find(isHiddenItem)\n : this.findLast(items, isHiddenItem);\n if (firstHiddenItem) {\n const firstHiddenItemWidth = firstHiddenItem.elementRef.nativeElement.offsetWidth;\n const visibleItemsTotalWidth = items\n .filter(({ hidden }) => !hidden())\n .reduce((width, { elementRef }) => width + elementRef.nativeElement.offsetWidth, 0);\n const _isEdgeItem = isEdgeItem(firstHiddenItem);\n const resultWidth = _isEdgeItem ? 0 : this.resultElementRef()?.nativeElement.offsetWidth || 0;\n if (firstHiddenItemWidth + visibleItemsTotalWidth + resultWidth <= totalWidth) {\n firstHiddenItem.hidden.set(false);\n if (!_isEdgeItem) {\n this.updateItemsVisibility();\n }\n }\n }\n }\n }\n\n /** @TODO Should use `Array.prototype.findLast` after migrating to ES2023 */\n private findLast<T>(array: T[], predicate: (value: T, index: number, array: T[]) => boolean): T | undefined {\n for (let i = array.length - 1; i >= 0; i--) {\n if (predicate(array[i], i, array)) {\n return array[i];\n }\n }\n return undefined;\n }\n}\n","import { NgModule } from '@angular/core';\nimport { KbqOverflowItem, KbqOverflowItems, KbqOverflowItemsResult } from './overflow-items';\n\nconst COMPONENTS = [\n KbqOverflowItems,\n KbqOverflowItem,\n KbqOverflowItemsResult\n];\n\n@NgModule({\n imports: COMPONENTS,\n exports: COMPONENTS\n})\nexport class KbqOverflowItemsModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAsDA;;;;AAIG;MAKU,sBAAsB,CAAA;AAJnC,IAAA,WAAA,GAAA;AAKI;;;;AAIG;AACM,QAAA,IAAA,CAAA,WAAW,GAAG,MAAM,CAA6C,WAAW,CAAC,CAAC;AAC1F,KAAA;iIAPY,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;qHAAtB,sBAAsB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,qCAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;2FAAtB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBAJlC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;A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EAAA,CAAA,CAAA,EAAA;AAAtB,uBAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,sBAAsB,YAT/B,gBAAgB;YAChB,eAAe;AACf,YAAA,sBAAsB,aAFtB,gBAAgB;YAChB,eAAe;YACf,sBAAsB,CAAA,EAAA,CAAA,CAAA,EAAA;kIAOb,sBAAsB,EAAA,CAAA,CAAA,EAAA;;2FAAtB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBAJlC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,UAAU;AACnB,oBAAA,OAAO,EAAE,UAAU;AACtB,iBAAA,CAAA;;;ACZD;;AAEG;;;;"}
1
+ {"version":3,"file":"koobiq-components-overflow-items.mjs","sources":["../../../packages/components/overflow-items/overflow-items.ts","../../../packages/components/overflow-items/module.ts","../../../packages/components/overflow-items/koobiq-components-overflow-items.ts"],"sourcesContent":["import { SharedResizeObserver } from '@angular/cdk/observers/private';\nimport { DOCUMENT } from '@angular/common';\nimport {\n booleanAttribute,\n contentChild,\n contentChildren,\n Directive,\n ElementRef,\n inject,\n input,\n numberAttribute,\n output,\n Renderer2,\n signal\n} from '@angular/core';\nimport { outputToObservable, takeUntilDestroyed, toObservable, toSignal } from '@angular/core/rxjs-interop';\nimport { debounceTime, merge, skip } from 'rxjs';\n\n/**\n * Manages the visibility of the element.\n *\n * @docs-private\n */\n@Directive({\n host: {\n '[attr.aria-hidden]': 'hidden()'\n }\n})\nexport class ElementVisibilityManager {\n private readonly renderer = inject(Renderer2);\n\n /**\n * Reference to the element.\n *\n * @docs-private\n */\n readonly elementRef = inject(ElementRef);\n\n /**\n * Whether the element is hidden.\n *\n * @docs-private\n */\n readonly hidden = signal(false);\n\n /**\n * Hides the element.\n *\n * @docs-private\n */\n hide(): void {\n this.renderer.setStyle(this.elementRef.nativeElement, 'visibility', 'hidden');\n this.renderer.setStyle(this.elementRef.nativeElement, 'position', 'absolute');\n this.hidden.set(true);\n }\n\n /**\n * Shows the element.\n *\n * @docs-private\n */\n show(): void {\n this.renderer.removeStyle(this.elementRef.nativeElement, 'visibility');\n this.renderer.removeStyle(this.elementRef.nativeElement, 'position');\n this.hidden.set(false);\n }\n}\n\n/**\n * Directive for displaying the result of hidden items by the `KbqOverflowItems` directive.\n */\n@Directive({\n standalone: true,\n selector: '[kbqOverflowItemsResult]',\n exportAs: 'kbqOverflowItemsResult',\n host: { class: 'kbq-overflow-items-result' }\n})\nexport class KbqOverflowItemsResult extends ElementVisibilityManager {}\n\n/**\n * Directive for the item that can be hidden by the `KbqOverflowItems` directive.\n */\n@Directive({\n standalone: true,\n selector: '[kbqOverflowItem]',\n exportAs: 'kbqOverflowItem',\n host: { class: 'kbq-overflow-item' }\n})\nexport class KbqOverflowItem extends ElementVisibilityManager {\n /**\n * Unique identifier for the item.\n */\n readonly id = input.required({ alias: 'kbqOverflowItem' });\n}\n\n/**\n * Directive for managing the visibility of items that overflow the container.\n */\n@Directive({\n standalone: true,\n selector: '[kbqOverflowItems]',\n exportAs: 'kbqOverflowItems',\n host: { class: 'kbq-overflow-items' }\n})\nexport class KbqOverflowItems {\n /**\n * `KbqOverflowItem` directive references.\n *\n * @docs-private\n */\n private readonly items = contentChildren(KbqOverflowItem);\n\n /**\n * `KbqOverflowItemsResult` directive reference.\n *\n * @docs-private\n */\n private readonly result = contentChild(KbqOverflowItemsResult);\n\n /**\n * Whether the overflow order should be reversed.\n *\n * @default false\n */\n readonly reverseOverflowOrder = input(false, { transform: booleanAttribute });\n\n /**\n * Debounce time for recalculating items visibility.\n *\n * @default 100\n */\n readonly debounceTime = input(100, { transform: numberAttribute });\n\n /**\n * Emits when the set of hidden items changes.\n */\n readonly changes = output<ReadonlySet<unknown>>();\n\n /**\n * Set of hidden item IDs.\n */\n readonly hiddenItemIDs = toSignal(outputToObservable(this.changes), {\n initialValue: new Set<unknown>([]) as ReadonlySet<unknown>\n });\n\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly resizeObserver = inject(SharedResizeObserver);\n private readonly renderer = inject(Renderer2);\n private readonly document = inject(DOCUMENT);\n\n constructor() {\n this.setStyles();\n\n merge(\n toObservable(this.items),\n toObservable(this.reverseOverflowOrder).pipe(skip(1)),\n this.resizeObserver.observe(this.elementRef.nativeElement)\n )\n .pipe(debounceTime(this.debounceTime()), takeUntilDestroyed())\n .subscribe(() => {\n const hiddenItems = this.calculateItemsVisibility(\n this.items(),\n this.reverseOverflowOrder(),\n this.result(),\n this.elementRef.nativeElement\n );\n const hiddenItemIDs = new Set(hiddenItems.map(({ id }) => id()));\n this.changes.emit(hiddenItemIDs);\n });\n }\n\n /**\n * Calculates the visibility of items, based on the container width and `reverseOverflowOrder` property.\n */\n private calculateItemsVisibility(\n items: readonly KbqOverflowItem[],\n reverseOverflowOrder: boolean,\n result: KbqOverflowItemsResult | undefined,\n { offsetWidth: totalWidth }: HTMLElement\n ): KbqOverflowItem[] {\n result?.hide();\n items.forEach((item) => {\n item.show();\n });\n let itemsWidth = items.reduce(\n (width, { elementRef }) => width + this.getElementWidthWithMargins(elementRef),\n 0\n );\n const startIndex = reverseOverflowOrder ? 0 : items.length - 1;\n const endIndex = reverseOverflowOrder ? items.length : -1;\n const step = reverseOverflowOrder ? 1 : -1;\n const resultWidth = result ? this.getElementWidthWithMargins(result.elementRef) : 0;\n for (let index = startIndex; index !== endIndex; index += step) {\n const current = items[index];\n const currentWidth = this.getElementWidthWithMargins(current.elementRef);\n const _resultWidth = items.some(this.isHiddenItem) ? resultWidth : 0;\n if (itemsWidth + _resultWidth > totalWidth) {\n current.hide();\n itemsWidth -= currentWidth;\n } else {\n const isEdgeElement = reverseOverflowOrder ? index === 0 : index === items.length - 1;\n const _resultWidth = isEdgeElement ? 0 : resultWidth;\n if (itemsWidth + currentWidth + _resultWidth <= totalWidth) {\n current.show();\n itemsWidth += currentWidth;\n }\n }\n }\n const hiddenItems = items.filter(this.isHiddenItem);\n if (hiddenItems.length > 0) {\n result?.show();\n }\n return hiddenItems;\n }\n\n /**\n * Returns the width of the element including margins.\n */\n private getElementWidthWithMargins({ nativeElement }: ElementRef<HTMLElement>): number {\n const { marginLeft, marginRight } = this.getWindow().getComputedStyle(nativeElement);\n return Math.ceil(parseFloat(marginLeft) + nativeElement.offsetWidth + parseFloat(marginRight));\n }\n\n /**\n * This method sets the necessary styles for the directive.\n */\n private setStyles(): void {\n this.renderer.setStyle(this.elementRef.nativeElement, 'position', 'relative');\n this.renderer.setStyle(this.elementRef.nativeElement, 'display', 'flex');\n this.renderer.setStyle(this.elementRef.nativeElement, 'flex-wrap', 'nowrap');\n this.renderer.setStyle(this.elementRef.nativeElement, 'flex-grow', '1');\n this.renderer.setStyle(this.elementRef.nativeElement, 'overflow', 'hidden');\n }\n\n /**\n * Determines if the given item is hidden.\n */\n private isHiddenItem = ({ hidden }: KbqOverflowItem) => hidden();\n\n /**\n * Returns the window object.\n */\n private getWindow(): Window {\n return this.document.defaultView || window;\n }\n}\n","import { NgModule } from '@angular/core';\nimport { KbqOverflowItem, KbqOverflowItems, KbqOverflowItemsResult } from './overflow-items';\n\nconst COMPONENTS = [\n KbqOverflowItems,\n KbqOverflowItem,\n KbqOverflowItemsResult\n];\n\n@NgModule({\n imports: COMPONENTS,\n exports: COMPONENTS\n})\nexport class KbqOverflowItemsModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAkBA;;;;AAIG;MAMU,wBAAwB,CAAA;AALrC,IAAA,WAAA,GAAA;AAMqB,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;AAE9C;;;;AAIG;AACM,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AAEzC;;;;AAIG;AACM,QAAA,IAAA,C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