@fundamental-ngx/core 0.35.3 → 0.35.4-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/action-bar/package.json +1 -1
- package/action-sheet/package.json +1 -1
- package/alert/package.json +1 -1
- package/avatar/package.json +1 -1
- package/avatar-group/package.json +1 -1
- package/bar/package.json +1 -1
- package/breadcrumb/breadcrumb-item.component.d.ts +20 -13
- package/breadcrumb/breadcrumb.component.d.ts +46 -34
- package/breadcrumb/breadcrumb.module.d.ts +3 -1
- package/breadcrumb/esm2020/breadcrumb-item.component.mjs +44 -23
- package/breadcrumb/esm2020/breadcrumb.component.mjs +93 -88
- package/breadcrumb/esm2020/breadcrumb.module.mjs +12 -4
- package/breadcrumb/fesm2015/fundamental-ngx-core-breadcrumb.mjs +147 -114
- package/breadcrumb/fesm2015/fundamental-ngx-core-breadcrumb.mjs.map +1 -1
- package/breadcrumb/fesm2020/fundamental-ngx-core-breadcrumb.mjs +144 -111
- package/breadcrumb/fesm2020/fundamental-ngx-core-breadcrumb.mjs.map +1 -1
- package/breadcrumb/package.json +1 -1
- package/busy-indicator/package.json +1 -1
- package/button/package.json +1 -1
- package/calendar/package.json +1 -1
- package/card/package.json +1 -1
- package/carousel/package.json +1 -1
- package/checkbox/package.json +1 -1
- package/combobox/package.json +1 -1
- package/content-density/package.json +3 -3
- package/date-picker/package.json +1 -1
- package/datetime/package.json +1 -1
- package/datetime-picker/package.json +1 -1
- package/dialog/package.json +1 -1
- package/dynamic-page/package.json +1 -1
- package/dynamic-side-content/package.json +1 -1
- package/esm2020/breadcrumb/breadcrumb-item.component.mjs +44 -23
- package/esm2020/breadcrumb/breadcrumb.component.mjs +93 -88
- package/esm2020/breadcrumb/breadcrumb.module.mjs +12 -4
- package/esm2020/overflow-layout/directives/overflow-expand.directive.mjs +6 -4
- package/esm2020/overflow-layout/directives/overflow-item-container-ref.directive.mjs +2 -2
- package/esm2020/overflow-layout/directives/overflow-item-ref.directive.mjs +20 -8
- package/esm2020/overflow-layout/directives/overflow-layout-item-container.directive.mjs +30 -3
- package/esm2020/overflow-layout/directives/overflow-layout-item.directive.mjs +12 -3
- package/esm2020/overflow-layout/index.mjs +3 -1
- package/esm2020/overflow-layout/interfaces/overflow-expand.interface.mjs +1 -1
- package/esm2020/overflow-layout/interfaces/overflow-item-ref.interface.mjs +1 -1
- package/esm2020/overflow-layout/interfaces/overflow-item.interface.mjs +1 -1
- package/esm2020/overflow-layout/overflow-layout.component.mjs +83 -157
- package/esm2020/overflow-layout/overflow-layout.service.mjs +241 -0
- package/esm2020/time/time-column/time-column.component.mjs +7 -8
- package/esm2020/utils/functions/resize-observable.mjs +9 -2
- package/facets/package.json +1 -1
- package/feed-input/package.json +1 -1
- package/feed-list-item/package.json +1 -1
- package/fesm2015/fundamental-ngx-core-breadcrumb.mjs +147 -114
- package/fesm2015/fundamental-ngx-core-breadcrumb.mjs.map +1 -1
- package/fesm2015/fundamental-ngx-core-overflow-layout.mjs +378 -166
- package/fesm2015/fundamental-ngx-core-overflow-layout.mjs.map +1 -1
- package/fesm2015/fundamental-ngx-core-time.mjs +6 -7
- package/fesm2015/fundamental-ngx-core-time.mjs.map +1 -1
- package/fesm2015/fundamental-ngx-core-utils.mjs +8 -1
- package/fesm2015/fundamental-ngx-core-utils.mjs.map +1 -1
- package/fesm2020/fundamental-ngx-core-breadcrumb.mjs +144 -111
- package/fesm2020/fundamental-ngx-core-breadcrumb.mjs.map +1 -1
- package/fesm2020/fundamental-ngx-core-overflow-layout.mjs +375 -165
- package/fesm2020/fundamental-ngx-core-overflow-layout.mjs.map +1 -1
- package/fesm2020/fundamental-ngx-core-time.mjs +6 -7
- package/fesm2020/fundamental-ngx-core-time.mjs.map +1 -1
- package/fesm2020/fundamental-ngx-core-utils.mjs +8 -1
- package/fesm2020/fundamental-ngx-core-utils.mjs.map +1 -1
- package/file-uploader/package.json +1 -1
- package/fixed-card-layout/package.json +1 -1
- package/flexible-column-layout/package.json +1 -1
- package/form/package.json +1 -1
- package/formatted-text/package.json +1 -1
- package/grid-list/package.json +1 -1
- package/icon/package.json +1 -1
- package/illustrated-message/package.json +1 -1
- package/infinite-scroll/package.json +1 -1
- package/info-label/package.json +1 -1
- package/inline-help/package.json +1 -1
- package/input-group/package.json +1 -1
- package/layout-grid/package.json +1 -1
- package/layout-panel/package.json +1 -1
- package/link/package.json +1 -1
- package/list/package.json +1 -1
- package/menu/package.json +1 -1
- package/message-box/package.json +1 -1
- package/message-strip/package.json +1 -1
- package/message-toast/package.json +1 -1
- package/micro-process-flow/package.json +1 -1
- package/mobile-mode/package.json +1 -1
- package/multi-input/package.json +1 -1
- package/nested-list/package.json +1 -1
- package/notification/package.json +1 -1
- package/object-identifier/package.json +1 -1
- package/object-marker/package.json +1 -1
- package/object-number/package.json +1 -1
- package/object-status/package.json +1 -1
- package/overflow-layout/directives/overflow-expand.directive.d.ts +6 -5
- package/overflow-layout/directives/overflow-item-ref.directive.d.ts +16 -6
- package/overflow-layout/directives/overflow-layout-item-container.directive.d.ts +13 -1
- package/overflow-layout/directives/overflow-layout-item.directive.d.ts +7 -2
- package/overflow-layout/esm2020/directives/overflow-expand.directive.mjs +6 -4
- package/overflow-layout/esm2020/directives/overflow-item-container-ref.directive.mjs +2 -2
- package/overflow-layout/esm2020/directives/overflow-item-ref.directive.mjs +20 -8
- package/overflow-layout/esm2020/directives/overflow-layout-item-container.directive.mjs +30 -3
- package/overflow-layout/esm2020/directives/overflow-layout-item.directive.mjs +12 -3
- package/overflow-layout/esm2020/index.mjs +3 -1
- package/overflow-layout/esm2020/interfaces/overflow-expand.interface.mjs +1 -1
- package/overflow-layout/esm2020/interfaces/overflow-item-ref.interface.mjs +1 -1
- package/overflow-layout/esm2020/interfaces/overflow-item.interface.mjs +1 -1
- package/overflow-layout/esm2020/overflow-layout.component.mjs +83 -157
- package/overflow-layout/esm2020/overflow-layout.service.mjs +241 -0
- package/overflow-layout/fesm2015/fundamental-ngx-core-overflow-layout.mjs +378 -166
- package/overflow-layout/fesm2015/fundamental-ngx-core-overflow-layout.mjs.map +1 -1
- package/overflow-layout/fesm2020/fundamental-ngx-core-overflow-layout.mjs +375 -165
- package/overflow-layout/fesm2020/fundamental-ngx-core-overflow-layout.mjs.map +1 -1
- package/overflow-layout/index.d.ts +2 -0
- package/overflow-layout/interfaces/overflow-expand.interface.d.ts +4 -4
- package/overflow-layout/interfaces/overflow-item-ref.interface.d.ts +14 -3
- package/overflow-layout/interfaces/overflow-item.interface.d.ts +2 -1
- package/overflow-layout/overflow-layout.component.d.ts +19 -31
- package/overflow-layout/overflow-layout.service.d.ts +90 -0
- package/overflow-layout/package.json +14 -13
- package/overflow-layout/tokens/overflow-expand.token.d.ts +1 -1
- package/overflow-layout/tokens/overflow-item-ref.token.d.ts +1 -1
- package/package.json +1 -1
- package/pagination/package.json +1 -1
- package/panel/package.json +1 -1
- package/popover/package.json +1 -1
- package/product-switch/package.json +1 -1
- package/progress-indicator/package.json +1 -1
- package/quick-view/package.json +1 -1
- package/radio/package.json +1 -1
- package/rating-indicator/package.json +1 -1
- package/resizable-card-layout/package.json +1 -1
- package/scroll-spy/package.json +1 -1
- package/scrollbar/package.json +1 -1
- package/segmented-button/package.json +1 -1
- package/select/package.json +1 -1
- package/shared/package.json +1 -1
- package/shellbar/package.json +1 -1
- package/side-navigation/package.json +1 -1
- package/slider/package.json +1 -1
- package/split-button/package.json +1 -1
- package/splitter/package.json +1 -1
- package/status-indicator/package.json +1 -1
- package/step-input/package.json +1 -1
- package/switch/package.json +1 -1
- package/table/package.json +1 -1
- package/tabs/package.json +1 -1
- package/text/package.json +1 -1
- package/theming/package.json +1 -1
- package/tile/package.json +1 -1
- package/time/esm2020/time-column/time-column.component.mjs +7 -8
- package/time/fesm2015/fundamental-ngx-core-time.mjs +6 -7
- package/time/fesm2015/fundamental-ngx-core-time.mjs.map +1 -1
- package/time/fesm2020/fundamental-ngx-core-time.mjs +6 -7
- package/time/fesm2020/fundamental-ngx-core-time.mjs.map +1 -1
- package/time/package.json +1 -1
- package/time/time-column/time-column.component.d.ts +1 -0
- package/time-picker/package.json +1 -1
- package/timeline/package.json +1 -1
- package/title/package.json +1 -1
- package/token/package.json +1 -1
- package/toolbar/package.json +1 -1
- package/tree/package.json +1 -1
- package/upload-collection/package.json +1 -1
- package/utils/esm2020/functions/resize-observable.mjs +9 -2
- package/utils/fesm2015/fundamental-ngx-core-utils.mjs +8 -1
- package/utils/fesm2015/fundamental-ngx-core-utils.mjs.map +1 -1
- package/utils/fesm2020/fundamental-ngx-core-utils.mjs +8 -1
- package/utils/fesm2020/fundamental-ngx-core-utils.mjs.map +1 -1
- package/utils/package.json +1 -1
- package/vertical-navigation/package.json +1 -1
- package/wizard/package.json +1 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Directive, HostBinding, ContentChild, InjectionToken, Inject,
|
|
3
|
-
import * as
|
|
2
|
+
import { Directive, HostBinding, Input, ContentChild, Injectable, Optional, InjectionToken, Inject, HostListener, EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, Output, ContentChildren, ViewChildren, ViewChild, SkipSelf, NgModule } from '@angular/core';
|
|
3
|
+
import * as i5 from '@angular/common';
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
|
-
import * as
|
|
5
|
+
import * as i3 from '@fundamental-ngx/core/popover';
|
|
6
6
|
import { PopoverModule } from '@fundamental-ngx/core/popover';
|
|
7
|
-
import * as
|
|
7
|
+
import * as i4 from '@fundamental-ngx/core/button';
|
|
8
8
|
import { ButtonModule } from '@fundamental-ngx/core/button';
|
|
9
|
-
import { FocusKeyManager } from '@angular/cdk/a11y';
|
|
10
9
|
import { TAB, DOWN_ARROW, UP_ARROW, LEFT_ARROW, RIGHT_ARROW } from '@angular/cdk/keycodes';
|
|
11
10
|
import * as i1 from '@fundamental-ngx/core/utils';
|
|
12
|
-
import {
|
|
13
|
-
import { Subscription, Subject,
|
|
11
|
+
import { resizeObservable, KeyUtil } from '@fundamental-ngx/core/utils';
|
|
12
|
+
import { Subscription, Subject, skip, filter, distinctUntilChanged, debounceTime } from 'rxjs';
|
|
13
|
+
import { FocusKeyManager } from '@angular/cdk/a11y';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Directive to hide component without actual destroying of the component instance.
|
|
@@ -41,7 +41,7 @@ class OverflowItemContainerRefDirective {
|
|
|
41
41
|
this._viewRef = this._viewContainerRef.detach();
|
|
42
42
|
this._detached = true;
|
|
43
43
|
}
|
|
44
|
-
else if (!value && this._viewRef && this._detached) {
|
|
44
|
+
else if (!value && this._viewRef && !this._viewRef.destroyed && this._detached) {
|
|
45
45
|
this._viewRef = this._viewContainerRef.insert(this._viewRef);
|
|
46
46
|
this._detached = false;
|
|
47
47
|
}
|
|
@@ -62,10 +62,22 @@ class OverflowLayoutItemContainerDirective {
|
|
|
62
62
|
this.elementRef = elementRef;
|
|
63
63
|
/** @hidden */
|
|
64
64
|
this._initialClass = 'fd-overflow-layout__item';
|
|
65
|
+
/**
|
|
66
|
+
* Whether this item is the first one in the array.
|
|
67
|
+
*/
|
|
68
|
+
this.last = false;
|
|
69
|
+
/**
|
|
70
|
+
* Whether this item is the last one in the array.
|
|
71
|
+
*/
|
|
72
|
+
this.first = false;
|
|
73
|
+
/**
|
|
74
|
+
* Whether this item is softly hidden. Used during free space calculation without flickering of the items.
|
|
75
|
+
*/
|
|
76
|
+
this.softHidden = true;
|
|
65
77
|
}
|
|
66
78
|
}
|
|
67
79
|
OverflowLayoutItemContainerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: OverflowLayoutItemContainerDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
68
|
-
OverflowLayoutItemContainerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: OverflowLayoutItemContainerDirective, selector: "[fdOverflowLayoutItemContainer]", host: { properties: { "class": "this._initialClass" } }, queries: [{ propertyName: "containerRef", first: true, predicate: OverflowItemContainerRefDirective, descendants: true }], ngImport: i0 });
|
|
80
|
+
OverflowLayoutItemContainerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: OverflowLayoutItemContainerDirective, selector: "[fdOverflowLayoutItemContainer]", inputs: { last: "last", first: "first", softHidden: "softHidden" }, host: { properties: { "class": "this._initialClass", "class.fd-overflow-layout__item--last": "this.last", "class.fd-overflow-layout__item--first": "this.first", "class.fd-overflow-layout__item--soft-hidden": "this.softHidden" } }, queries: [{ propertyName: "containerRef", first: true, predicate: OverflowItemContainerRefDirective, descendants: true }], ngImport: i0 });
|
|
69
81
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: OverflowLayoutItemContainerDirective, decorators: [{
|
|
70
82
|
type: Directive,
|
|
71
83
|
args: [{
|
|
@@ -74,11 +86,261 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
74
86
|
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { _initialClass: [{
|
|
75
87
|
type: HostBinding,
|
|
76
88
|
args: ['class']
|
|
89
|
+
}], last: [{
|
|
90
|
+
type: Input
|
|
91
|
+
}, {
|
|
92
|
+
type: HostBinding,
|
|
93
|
+
args: ['class.fd-overflow-layout__item--last']
|
|
94
|
+
}], first: [{
|
|
95
|
+
type: Input
|
|
96
|
+
}, {
|
|
97
|
+
type: HostBinding,
|
|
98
|
+
args: ['class.fd-overflow-layout__item--first']
|
|
99
|
+
}], softHidden: [{
|
|
100
|
+
type: Input
|
|
101
|
+
}, {
|
|
102
|
+
type: HostBinding,
|
|
103
|
+
args: ['class.fd-overflow-layout__item--soft-hidden']
|
|
77
104
|
}], containerRef: [{
|
|
78
105
|
type: ContentChild,
|
|
79
106
|
args: [OverflowItemContainerRefDirective]
|
|
80
107
|
}] } });
|
|
81
108
|
|
|
109
|
+
class OverflowLayoutListeningResult {
|
|
110
|
+
constructor() {
|
|
111
|
+
this.showMore = false;
|
|
112
|
+
this.items = [];
|
|
113
|
+
this.hiddenItems = [];
|
|
114
|
+
this.visibleItems = [];
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
class OverflowLayoutService {
|
|
118
|
+
/** @hidden */
|
|
119
|
+
constructor(_elRef, _rtlService) {
|
|
120
|
+
this._elRef = _elRef;
|
|
121
|
+
this._rtlService = _rtlService;
|
|
122
|
+
/**
|
|
123
|
+
* Overflow Layout calculation result.
|
|
124
|
+
*/
|
|
125
|
+
this.result = new OverflowLayoutListeningResult();
|
|
126
|
+
/** @hidden */
|
|
127
|
+
this._listenToItemResize = true;
|
|
128
|
+
/** @hidden */
|
|
129
|
+
this._subscription = new Subscription();
|
|
130
|
+
/** @hidden */
|
|
131
|
+
this._allItems = [];
|
|
132
|
+
/** @hidden */
|
|
133
|
+
this._hiddenItems = [];
|
|
134
|
+
/** @hidden */
|
|
135
|
+
this._overflowItems = [];
|
|
136
|
+
/** @hidden */
|
|
137
|
+
this._detectChanges$ = new Subject();
|
|
138
|
+
/** @hidden */
|
|
139
|
+
this._result$ = new Subject();
|
|
140
|
+
/** @hidden */
|
|
141
|
+
this._dir = 'ltr';
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Observable which emits when changes detection is required.
|
|
145
|
+
*/
|
|
146
|
+
get detectChanges() {
|
|
147
|
+
return this._detectChanges$.asObservable();
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Observable which emits when new calculation result is available.
|
|
151
|
+
*/
|
|
152
|
+
get onResult() {
|
|
153
|
+
return this._result$.asObservable();
|
|
154
|
+
}
|
|
155
|
+
/** @hidden */
|
|
156
|
+
ngOnDestroy() {
|
|
157
|
+
this._subscription.unsubscribe();
|
|
158
|
+
}
|
|
159
|
+
startListening(config) {
|
|
160
|
+
this.setConfig(config);
|
|
161
|
+
this.fitVisibleItems();
|
|
162
|
+
this._setFocusKeyManager();
|
|
163
|
+
this._listenToChanges();
|
|
164
|
+
this._subscribeToRtl();
|
|
165
|
+
}
|
|
166
|
+
setConfig(config) {
|
|
167
|
+
this.config = config;
|
|
168
|
+
}
|
|
169
|
+
_emitResult() {
|
|
170
|
+
this._result$.next(this.result);
|
|
171
|
+
}
|
|
172
|
+
/** @hidden */
|
|
173
|
+
_listenToChanges() {
|
|
174
|
+
this._subscription.add(this.config.items.changes.subscribe(() => {
|
|
175
|
+
setTimeout(() => {
|
|
176
|
+
this.fitVisibleItems();
|
|
177
|
+
});
|
|
178
|
+
}));
|
|
179
|
+
this._listenToSizeChanges(this._elRef.nativeElement, this.config.itemsWrapper);
|
|
180
|
+
}
|
|
181
|
+
/** @hidden */
|
|
182
|
+
_listenToSizeChanges(...elements) {
|
|
183
|
+
elements.forEach((element) => this._subscription.add(resizeObservable(element)
|
|
184
|
+
.pipe(skip(1), filter(() => this._listenToItemResize), distinctUntilChanged(), debounceTime(30))
|
|
185
|
+
.subscribe(() => {
|
|
186
|
+
setTimeout(() => {
|
|
187
|
+
this.fitVisibleItems();
|
|
188
|
+
});
|
|
189
|
+
})));
|
|
190
|
+
}
|
|
191
|
+
/** @hidden */
|
|
192
|
+
fitVisibleItems() {
|
|
193
|
+
this._listenToItemResize = false;
|
|
194
|
+
this._allItems = this.config.items.toArray();
|
|
195
|
+
let allItems = this.config.items.toArray();
|
|
196
|
+
allItems.forEach((item, index) => {
|
|
197
|
+
// Softly hide previously completely hidden item in order to correctly calculate it's size.
|
|
198
|
+
item.softHidden = true;
|
|
199
|
+
item.hidden = false;
|
|
200
|
+
item.index = index;
|
|
201
|
+
item.first = index === 0;
|
|
202
|
+
item.last = index === allItems.length - 1;
|
|
203
|
+
});
|
|
204
|
+
this._detectChanges$.next();
|
|
205
|
+
allItems = this.config.direction === 'right' ? allItems : allItems.reverse();
|
|
206
|
+
const visibleContainerItems = this.config.direction === 'right'
|
|
207
|
+
? this.config.visibleItems.toArray()
|
|
208
|
+
: this.config.visibleItems.toArray().reverse();
|
|
209
|
+
visibleContainerItems.forEach((i) => (i.containerRef.hidden = false));
|
|
210
|
+
this.result.showMore = false;
|
|
211
|
+
this._emitResult();
|
|
212
|
+
const containerWidth = this._elRef.nativeElement.getBoundingClientRect().width;
|
|
213
|
+
const itemsContainerWidth = this.config.itemsWrapper.getBoundingClientRect().width;
|
|
214
|
+
if (containerWidth >= itemsContainerWidth &&
|
|
215
|
+
this.config.visibleItems.length <= this.config.maxVisibleItems &&
|
|
216
|
+
this._hiddenItems.length === 0) {
|
|
217
|
+
// Make all items fully visible.
|
|
218
|
+
allItems.forEach((item) => {
|
|
219
|
+
item.softHidden = false;
|
|
220
|
+
});
|
|
221
|
+
this.result.showMore = false;
|
|
222
|
+
this.result.hiddenItems = this._hiddenItems;
|
|
223
|
+
this._emitResult();
|
|
224
|
+
this._listenToItemResize = true;
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
this.result.showMore = true;
|
|
228
|
+
this._emitResult();
|
|
229
|
+
let fittingElmCount = 0;
|
|
230
|
+
let fittingElmsWidth = 0;
|
|
231
|
+
let shouldHideItems = false;
|
|
232
|
+
const showMoreContainerWidth = Math.ceil(this.config.showMoreContainer.getBoundingClientRect().width);
|
|
233
|
+
let layoutWidth = Math.ceil(this.config.layoutContainerElement.getBoundingClientRect().width);
|
|
234
|
+
// Try to find all forced visible items
|
|
235
|
+
const forcedItemsIndexes = this._getForcedItemsIndexes();
|
|
236
|
+
forcedItemsIndexes.forEach((itemIndex) => {
|
|
237
|
+
const container = this.config.visibleItems.get(itemIndex);
|
|
238
|
+
if (!container) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
const elementSize = this._getElementWidth(container.elementRef.nativeElement);
|
|
242
|
+
layoutWidth -= elementSize;
|
|
243
|
+
});
|
|
244
|
+
if (layoutWidth < 0 && forcedItemsIndexes.length > 0) {
|
|
245
|
+
console.warn('There is no enough space to fit all forced visible items into the container. Please adjust their visibility accordingly.');
|
|
246
|
+
}
|
|
247
|
+
this._detectChanges$.next();
|
|
248
|
+
visibleContainerItems.forEach((item, index) => {
|
|
249
|
+
const itemRef = allItems[index];
|
|
250
|
+
if (shouldHideItems && !itemRef.overflowItem.forceVisibility) {
|
|
251
|
+
item.containerRef.hidden = true;
|
|
252
|
+
item.softHidden = false;
|
|
253
|
+
itemRef.hidden = true;
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
const elementSize = this._getElementWidth(item.elementRef.nativeElement);
|
|
257
|
+
const combinedWidth = fittingElmsWidth + elementSize;
|
|
258
|
+
const condition = (combinedWidth <= layoutWidth ||
|
|
259
|
+
(item === this.config.visibleItems.last &&
|
|
260
|
+
combinedWidth <= layoutWidth + showMoreContainerWidth)) &&
|
|
261
|
+
fittingElmCount < this.config.maxVisibleItems;
|
|
262
|
+
if (condition) {
|
|
263
|
+
fittingElmsWidth += elementSize;
|
|
264
|
+
fittingElmCount++;
|
|
265
|
+
}
|
|
266
|
+
else if (!itemRef.overflowItem.forceVisibility) {
|
|
267
|
+
shouldHideItems = true;
|
|
268
|
+
item.softHidden = false;
|
|
269
|
+
item.containerRef.hidden = true;
|
|
270
|
+
itemRef.hidden = true;
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
// Reverse original order back.
|
|
274
|
+
allItems = this.config.direction === 'right' ? allItems : allItems.reverse();
|
|
275
|
+
allItems.forEach((item) => {
|
|
276
|
+
item.softHidden = false;
|
|
277
|
+
});
|
|
278
|
+
let hiddenItems = allItems.filter((i) => i.hidden);
|
|
279
|
+
hiddenItems = !this.config.reverseHiddenItems ? hiddenItems.reverse() : hiddenItems;
|
|
280
|
+
const visibleItems = allItems.filter((i) => !i.hidden);
|
|
281
|
+
visibleItems.forEach((item, index) => {
|
|
282
|
+
item.index = index;
|
|
283
|
+
item.first = index === 0;
|
|
284
|
+
item.last = index === visibleItems.length - 1;
|
|
285
|
+
});
|
|
286
|
+
this._hiddenItems = hiddenItems.map((item, index) => {
|
|
287
|
+
item.first = index === 0;
|
|
288
|
+
item.last = index === hiddenItems.length - 1;
|
|
289
|
+
item.index = index;
|
|
290
|
+
return item;
|
|
291
|
+
});
|
|
292
|
+
this.result.showMore = this._hiddenItems.length > 0;
|
|
293
|
+
this.result.hiddenItems = this._hiddenItems;
|
|
294
|
+
this._emitResult();
|
|
295
|
+
this._listenToItemResize = true;
|
|
296
|
+
}
|
|
297
|
+
/** @hidden */
|
|
298
|
+
_setFocusKeyManager() {
|
|
299
|
+
if (!this.config.enableKeyboardNavigation) {
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
this._dir = this._rtlService?.rtl.value ? 'rtl' : 'ltr';
|
|
303
|
+
this._keyboardEventsManager = new FocusKeyManager(this._overflowItems)
|
|
304
|
+
.withWrap()
|
|
305
|
+
.withHorizontalOrientation(this._dir)
|
|
306
|
+
.skipPredicate((item) => !item.focusable || item.hidden);
|
|
307
|
+
}
|
|
308
|
+
/** @hidden Rtl change subscription */
|
|
309
|
+
_subscribeToRtl() {
|
|
310
|
+
if (!this._rtlService || !this.config.enableKeyboardNavigation) {
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
this._subscription.add(this._rtlService.rtl.subscribe((isRtl) => {
|
|
314
|
+
this._dir = isRtl ? 'rtl' : 'ltr';
|
|
315
|
+
this._keyboardEventsManager = this._keyboardEventsManager.withHorizontalOrientation(this._dir);
|
|
316
|
+
}));
|
|
317
|
+
}
|
|
318
|
+
/** @hidden */
|
|
319
|
+
_getForcedItemsIndexes() {
|
|
320
|
+
return this._allItems
|
|
321
|
+
.map((item, index) => (item.overflowItem.forceVisibility ? index : -1))
|
|
322
|
+
.filter((i) => i > -1);
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* @hidden
|
|
326
|
+
* Returns combined width of the element including margins.
|
|
327
|
+
* @param element Element to calculate width of.
|
|
328
|
+
*/
|
|
329
|
+
_getElementWidth(element) {
|
|
330
|
+
const elementStyle = getComputedStyle(element);
|
|
331
|
+
const elementWidth = element.getBoundingClientRect().width;
|
|
332
|
+
const elementSize = elementWidth + parseFloat(elementStyle.marginLeft) + parseFloat(elementStyle.marginRight);
|
|
333
|
+
return Math.ceil(elementSize);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
OverflowLayoutService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: OverflowLayoutService, deps: [{ token: i0.ElementRef }, { token: i1.RtlService, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
337
|
+
OverflowLayoutService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: OverflowLayoutService });
|
|
338
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: OverflowLayoutService, decorators: [{
|
|
339
|
+
type: Injectable
|
|
340
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.RtlService, decorators: [{
|
|
341
|
+
type: Optional
|
|
342
|
+
}] }]; } });
|
|
343
|
+
|
|
82
344
|
const FD_OVERFLOW_CONTAINER = new InjectionToken('FdOverflowContainer');
|
|
83
345
|
|
|
84
346
|
const FD_OVERFLOW_EXPAND = new InjectionToken('FdOverflowLayoutExpand');
|
|
@@ -151,11 +413,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
151
413
|
|
|
152
414
|
class OverflowLayoutComponent {
|
|
153
415
|
/** @hidden */
|
|
154
|
-
constructor(_cdr, _zone, _elRef, _rtlService) {
|
|
416
|
+
constructor(_cdr, _zone, _elRef, _overflowLayoutService, _rtlService) {
|
|
155
417
|
this._cdr = _cdr;
|
|
156
418
|
this._zone = _zone;
|
|
157
419
|
this._elRef = _elRef;
|
|
420
|
+
this._overflowLayoutService = _overflowLayoutService;
|
|
158
421
|
this._rtlService = _rtlService;
|
|
422
|
+
/** Direction of the fitting items calculation. */
|
|
423
|
+
this.showMorePosition = 'right';
|
|
424
|
+
/** Whether to render hidden items in reverse order. */
|
|
425
|
+
this.reverseHiddenItems = false;
|
|
426
|
+
/** Whether to enable keyboard navigation. */
|
|
427
|
+
this.enableKeyboardNavigation = true;
|
|
159
428
|
/**
|
|
160
429
|
* Event, triggered when amount of visible items has been changed.
|
|
161
430
|
*/
|
|
@@ -173,16 +442,14 @@ class OverflowLayoutComponent {
|
|
|
173
442
|
/** @hidden */
|
|
174
443
|
this._initialClass = 'fd-overflow-layout';
|
|
175
444
|
/** @hidden */
|
|
176
|
-
this._listenToItemResize = true;
|
|
177
|
-
/** @hidden */
|
|
178
445
|
this._subscription = new Subscription();
|
|
179
446
|
/** @hidden */
|
|
180
447
|
this._fillTrigger$ = new Subject();
|
|
181
448
|
/** @hidden */
|
|
182
|
-
this._dir = 'ltr';
|
|
183
|
-
/** @hidden */
|
|
184
449
|
this._maxVisibleItems = Infinity;
|
|
185
|
-
|
|
450
|
+
/** @hidden */
|
|
451
|
+
this._canListenToResize = false;
|
|
452
|
+
this._subscription.add(this._fillTrigger$.pipe(debounceTime(30)).subscribe(() => this._overflowLayoutService.fitVisibleItems()));
|
|
186
453
|
}
|
|
187
454
|
/**
|
|
188
455
|
* Maximum amount of visible items.
|
|
@@ -201,26 +468,16 @@ class OverflowLayoutComponent {
|
|
|
201
468
|
* Triggers layout recalculation of the items.
|
|
202
469
|
*/
|
|
203
470
|
triggerRecalculation() {
|
|
471
|
+
if (!this._canListenToResize) {
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
474
|
+
this._overflowLayoutService.setConfig(this._getConfig());
|
|
204
475
|
this._fillTrigger$.next();
|
|
205
476
|
}
|
|
206
477
|
/** @hidden */
|
|
207
478
|
ngOnDestroy() {
|
|
208
479
|
this._subscription.unsubscribe();
|
|
209
480
|
}
|
|
210
|
-
/** @hidden */
|
|
211
|
-
_keyUpHandler(event) {
|
|
212
|
-
if (KeyUtil.isKeyCode(event, TAB)) {
|
|
213
|
-
const index = this._allItems.findIndex((item) => item.overflowItem?.focusable && item.elementRef.nativeElement === event.target);
|
|
214
|
-
if (index !== -1) {
|
|
215
|
-
this._keyboardEventsManager.setActiveItem(index);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
if (KeyUtil.isKeyCode(event, [DOWN_ARROW, UP_ARROW, LEFT_ARROW, RIGHT_ARROW])) {
|
|
219
|
-
event.preventDefault();
|
|
220
|
-
// passing the event to key manager so, we get a change fired
|
|
221
|
-
this._keyboardEventsManager.onKeydown(event);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
481
|
/**
|
|
225
482
|
* Sets current focused element.
|
|
226
483
|
* @param element Element that needs to be focused.
|
|
@@ -228,7 +485,7 @@ class OverflowLayoutComponent {
|
|
|
228
485
|
setFocusedElement(element) {
|
|
229
486
|
const index = this._overflowItems.toArray().findIndex((item) => item === element);
|
|
230
487
|
if (index !== -1) {
|
|
231
|
-
this._keyboardEventsManager.setActiveItem(index);
|
|
488
|
+
this._overflowLayoutService._keyboardEventsManager.setActiveItem(index);
|
|
232
489
|
}
|
|
233
490
|
}
|
|
234
491
|
/**
|
|
@@ -250,167 +507,97 @@ class OverflowLayoutComponent {
|
|
|
250
507
|
}
|
|
251
508
|
/** @hidden */
|
|
252
509
|
ngAfterViewInit() {
|
|
253
|
-
this.
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
this.
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
510
|
+
this._subscription.add(this._overflowLayoutService.detectChanges.subscribe(() => {
|
|
511
|
+
this._cdr.detectChanges();
|
|
512
|
+
}));
|
|
513
|
+
this._subscription.add(this._overflowLayoutService.onResult.subscribe((result) => {
|
|
514
|
+
this._hiddenItems = result.hiddenItems;
|
|
515
|
+
this._showMore = result.showMore;
|
|
516
|
+
this.hiddenItemsCount.emit(result.hiddenItems.length);
|
|
517
|
+
this.visibleItemsCount.emit(this._allItems.filter((i) => !i.hidden).length);
|
|
518
|
+
this._cdr.detectChanges();
|
|
519
|
+
}));
|
|
260
520
|
this._subscription.add(this._items.changes.subscribe(() => {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
});
|
|
521
|
+
this._allItems = this._items.toArray();
|
|
522
|
+
this._cdr.detectChanges();
|
|
264
523
|
}));
|
|
265
|
-
this.
|
|
524
|
+
this._allItems = this._items.toArray();
|
|
525
|
+
this._cdr.detectChanges();
|
|
526
|
+
this._overflowLayoutService.startListening(this._getConfig());
|
|
527
|
+
this._canListenToResize = true;
|
|
266
528
|
}
|
|
267
529
|
/** @hidden */
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
.
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
530
|
+
_getConfig() {
|
|
531
|
+
return {
|
|
532
|
+
visibleItems: this._visibleItems,
|
|
533
|
+
items: this._items,
|
|
534
|
+
itemsWrapper: this._itemsWrapper.nativeElement,
|
|
535
|
+
showMoreContainer: this._showMoreContainer.nativeElement,
|
|
536
|
+
layoutContainerElement: this._layoutContainer.nativeElement,
|
|
537
|
+
maxVisibleItems: this.maxVisibleItems,
|
|
538
|
+
direction: this.showMorePosition,
|
|
539
|
+
enableKeyboardNavigation: this.enableKeyboardNavigation,
|
|
540
|
+
reverseHiddenItems: this.reverseHiddenItems
|
|
541
|
+
};
|
|
276
542
|
}
|
|
277
543
|
/** @hidden */
|
|
278
|
-
|
|
279
|
-
this.
|
|
280
|
-
this._allItems = this._items.toArray();
|
|
281
|
-
this._visibleItems.forEach((i) => (i.containerRef.hidden = false));
|
|
282
|
-
this._allItems.forEach((item, index) => {
|
|
283
|
-
item.hidden = false;
|
|
284
|
-
item.index = index;
|
|
285
|
-
});
|
|
286
|
-
this._cdr.detectChanges();
|
|
287
|
-
const containerWidth = this._elRef.nativeElement.getBoundingClientRect().width;
|
|
288
|
-
const itemsContainerWidth = this._itemsWrapper.nativeElement.getBoundingClientRect().width;
|
|
289
|
-
if (containerWidth >= itemsContainerWidth &&
|
|
290
|
-
this._visibleItems.length <= this.maxVisibleItems &&
|
|
291
|
-
this._hiddenItems.length === 0) {
|
|
292
|
-
this._showMore = false;
|
|
293
|
-
this._cdr.detectChanges();
|
|
294
|
-
this._listenToItemResize = true;
|
|
544
|
+
_keyUpHandler(event) {
|
|
545
|
+
if (!this.enableKeyboardNavigation) {
|
|
295
546
|
return;
|
|
296
547
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
this._cdr.detectChanges();
|
|
302
|
-
const showMoreContainerWidth = this._showMoreContainer.nativeElement.getBoundingClientRect().width;
|
|
303
|
-
let layoutWidth = this._layoutContainer.nativeElement.getBoundingClientRect().width;
|
|
304
|
-
// Try to find all forced visible items
|
|
305
|
-
const forcedItemsIndexes = this._getForcedItemsIndexes();
|
|
306
|
-
forcedItemsIndexes.forEach((itemIndex) => {
|
|
307
|
-
const container = this._visibleItems.get(itemIndex);
|
|
308
|
-
if (!container) {
|
|
309
|
-
return;
|
|
548
|
+
if (KeyUtil.isKeyCode(event, TAB)) {
|
|
549
|
+
const index = this._allItems.findIndex((item) => item.overflowItem?.focusable && item.elementRef.nativeElement === event.target);
|
|
550
|
+
if (index !== -1) {
|
|
551
|
+
this._overflowLayoutService._keyboardEventsManager.setActiveItem(index);
|
|
310
552
|
}
|
|
311
|
-
const elementSize = this._getElementWidth(container.elementRef.nativeElement);
|
|
312
|
-
layoutWidth -= elementSize;
|
|
313
|
-
});
|
|
314
|
-
if (layoutWidth < 0 && forcedItemsIndexes.length > 0) {
|
|
315
|
-
console.warn('There is no enough space to fit all forced visible items into the container. Please adjust their visibility accordingly.');
|
|
316
553
|
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
itemRef.hidden = true;
|
|
322
|
-
return;
|
|
323
|
-
}
|
|
324
|
-
const elementSize = this._getElementWidth(item.elementRef.nativeElement);
|
|
325
|
-
const combinedWidth = fittingElmsWidth + elementSize;
|
|
326
|
-
if ((combinedWidth <= layoutWidth ||
|
|
327
|
-
(item === this._visibleItems.last && combinedWidth <= layoutWidth + showMoreContainerWidth)) &&
|
|
328
|
-
fittingElmCount < this.maxVisibleItems) {
|
|
329
|
-
fittingElmsWidth += elementSize;
|
|
330
|
-
fittingElmCount++;
|
|
331
|
-
}
|
|
332
|
-
else if (!itemRef.overflowItem.forceVisibility) {
|
|
333
|
-
shouldHideItems = true;
|
|
334
|
-
item.containerRef.hidden = true;
|
|
335
|
-
itemRef.hidden = true;
|
|
336
|
-
}
|
|
337
|
-
});
|
|
338
|
-
this._hiddenItems = this._allItems.filter((i) => i.hidden);
|
|
339
|
-
this.visibleItemsCount.emit(this._allItems.filter((i) => !i.hidden).length);
|
|
340
|
-
this.hiddenItemsCount.emit(this._hiddenItems.length);
|
|
341
|
-
this._showMore = this._hiddenItems.length > 0;
|
|
342
|
-
this._cdr.detectChanges();
|
|
343
|
-
this._listenToItemResize = true;
|
|
344
|
-
}
|
|
345
|
-
/** @hidden */
|
|
346
|
-
_setFocusKeyManager() {
|
|
347
|
-
this._dir = this._rtlService?.rtl.value ? 'rtl' : 'ltr';
|
|
348
|
-
this._keyboardEventsManager = new FocusKeyManager(this._overflowItems)
|
|
349
|
-
.withWrap()
|
|
350
|
-
.withHorizontalOrientation(this._dir)
|
|
351
|
-
.skipPredicate((item) => !item.focusable || item.hidden);
|
|
352
|
-
}
|
|
353
|
-
/** @hidden Rtl change subscription */
|
|
354
|
-
_subscribeToRtl() {
|
|
355
|
-
if (!this._rtlService) {
|
|
356
|
-
return;
|
|
554
|
+
if (KeyUtil.isKeyCode(event, [DOWN_ARROW, UP_ARROW, LEFT_ARROW, RIGHT_ARROW])) {
|
|
555
|
+
event.preventDefault();
|
|
556
|
+
// passing the event to key manager so, we get a change fired
|
|
557
|
+
this._overflowLayoutService._keyboardEventsManager.onKeydown(event);
|
|
357
558
|
}
|
|
358
|
-
const rtlSub = this._rtlService.rtl.subscribe((isRtl) => {
|
|
359
|
-
this._dir = isRtl ? 'rtl' : 'ltr';
|
|
360
|
-
this._keyboardEventsManager = this._keyboardEventsManager.withHorizontalOrientation(isRtl ? 'rtl' : 'ltr');
|
|
361
|
-
});
|
|
362
|
-
this._subscription.add(rtlSub);
|
|
363
|
-
}
|
|
364
|
-
/** @hidden */
|
|
365
|
-
_getForcedItemsIndexes() {
|
|
366
|
-
return this._allItems
|
|
367
|
-
.map((item, index) => (item.overflowItem.forceVisibility ? index : -1))
|
|
368
|
-
.filter((i) => i > -1);
|
|
369
|
-
}
|
|
370
|
-
/**
|
|
371
|
-
* @hidden
|
|
372
|
-
* Returns combined width of the element including margins.
|
|
373
|
-
* @param element Element to calculate width of.
|
|
374
|
-
*/
|
|
375
|
-
_getElementWidth(element) {
|
|
376
|
-
const elementStyle = getComputedStyle(element);
|
|
377
|
-
const elementWidth = element.getBoundingClientRect().width;
|
|
378
|
-
const elementSize = elementWidth + parseFloat(elementStyle.marginLeft) + parseFloat(elementStyle.marginRight);
|
|
379
|
-
return elementSize;
|
|
380
559
|
}
|
|
381
560
|
}
|
|
382
|
-
OverflowLayoutComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: OverflowLayoutComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: i0.ElementRef }, { token: i1.RtlService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
383
|
-
OverflowLayoutComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.4", type: OverflowLayoutComponent, selector: "fd-overflow-layout", inputs: { maxVisibleItems: "maxVisibleItems" }, outputs: { visibleItemsCount: "visibleItemsCount", hiddenItemsCount: "hiddenItemsCount" }, host: { listeners: { "keyup": "_keyUpHandler($event)" }, properties: { "class": "this._initialClass" } }, providers: [
|
|
561
|
+
OverflowLayoutComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: OverflowLayoutComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: i0.ElementRef }, { token: OverflowLayoutService }, { token: i1.RtlService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
562
|
+
OverflowLayoutComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.4", type: OverflowLayoutComponent, selector: "fd-overflow-layout", inputs: { maxVisibleItems: "maxVisibleItems", showMorePosition: "showMorePosition", reverseHiddenItems: "reverseHiddenItems", enableKeyboardNavigation: "enableKeyboardNavigation" }, outputs: { visibleItemsCount: "visibleItemsCount", hiddenItemsCount: "hiddenItemsCount" }, host: { listeners: { "keyup": "_keyUpHandler($event)" }, properties: { "class": "this._initialClass" } }, providers: [
|
|
384
563
|
{
|
|
385
564
|
provide: FD_OVERFLOW_CONTAINER,
|
|
386
565
|
useExisting: OverflowLayoutComponent
|
|
387
|
-
}
|
|
388
|
-
|
|
566
|
+
},
|
|
567
|
+
OverflowLayoutService
|
|
568
|
+
], queries: [{ propertyName: "_moreButton", first: true, predicate: FD_OVERFLOW_EXPAND, descendants: true }, { propertyName: "_items", predicate: FD_OVERFLOW_ITEM_REF, descendants: true }, { propertyName: "_overflowItems", predicate: FD_OVERFLOW_ITEM, descendants: true }], viewQueries: [{ propertyName: "_itemsWrapper", first: true, predicate: ["itemsWrapper"], descendants: true }, { propertyName: "_layoutContainer", first: true, predicate: ["layoutContainer"], descendants: true }, { propertyName: "_showMoreContainer", first: true, predicate: ["showMoreContainer"], descendants: true }, { propertyName: "_visibleItems", predicate: OverflowLayoutItemContainerDirective, descendants: true }], ngImport: i0, template: "<ng-template [ngIf]=\"showMorePosition === 'left'\">\n <ng-template [ngTemplateOutlet]=\"showMore\"></ng-template>\n</ng-template>\n\n<div class=\"fd-overflow-layout__items-container\" #layoutContainer>\n <div class=\"fd-overflow-layout__items\" #itemsWrapper>\n <ng-container *ngFor=\"let item of _allItems; trackBy: _itemsTrackFn\">\n <div fdOverflowLayoutItemContainer [first]=\"item.first\" [last]=\"item.last\" [softHidden]=\"item.softHidden\">\n <ng-container *fdOverflowItemContainerRef>\n <ng-template\n [ngTemplateOutlet]=\"item.templateRef\"\n [ngTemplateOutletContext]=\"{\n $implicit: item.hidden,\n index: item.index,\n first: item.first,\n last: item.last\n }\"\n ></ng-template>\n </ng-container>\n </div>\n </ng-container>\n </div>\n</div>\n\n<ng-template [ngIf]=\"showMorePosition === 'right'\">\n <ng-template [ngTemplateOutlet]=\"showMore\"></ng-template>\n</ng-template>\n\n<ng-template #showMore>\n <div class=\"fd-overflow-layout__more\" [style.display]=\"_showMore ? 'block' : 'none'\" #showMoreContainer>\n <ng-template #defaultShowMore>\n <fd-popover\n (isOpenChange)=\"_onPopoverStateChange($event)\"\n placement=\"bottom\"\n [focusTrapped]=\"true\"\n [focusAutoCapture]=\"true\"\n [maxWidth]=\"312\"\n >\n <fd-popover-control>\n <button\n fd-button\n [fdMenu]=\"true\"\n i18n=\"@overflowLayout.moreItemsButton|Overflow Layout more button text\"\n fdType=\"transparent\"\n >\n {{ _hiddenItems.length }} more\n </button>\n </fd-popover-control>\n <fd-popover-body>\n <div fdOverflowLayoutPopoverContent [items]=\"_hiddenItems\">\n <ng-container *ngFor=\"let item of _hiddenItems\">\n <ng-template\n [ngTemplateOutlet]=\"item.templateRef\"\n [ngTemplateOutletContext]=\"{\n $implicit: item.hidden,\n index: item.index,\n first: item.first,\n last: item.last\n }\"\n ></ng-template>\n </ng-container>\n </div>\n </fd-popover-body>\n </fd-popover>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"_moreButton?.templateRef || defaultShowMore\"\n [ngTemplateOutletContext]=\"{ $implicit: _hiddenItems }\"\n ></ng-template>\n </div>\n</ng-template>\n", styles: [".fd-overflow-layout{font-size:var(--sapFontSize);line-height:var(--sapContent_LineHeight);color:var(--sapTextColor);font-family:var(--sapFontFamily);font-weight:400;box-sizing:border-box;padding:0;margin:0;border:0;display:flex;align-items:center;width:100%}.fd-overflow-layout:before,.fd-overflow-layout:after{box-sizing:inherit;font-size:inherit}.fd-overflow-layout__items{font-size:var(--sapFontSize);line-height:var(--sapContent_LineHeight);color:var(--sapTextColor);font-family:var(--sapFontFamily);font-weight:400;box-sizing:border-box;padding:0;margin:0;border:0;display:flex;align-items:center}.fd-overflow-layout__items:before,.fd-overflow-layout__items:after{box-sizing:inherit;font-size:inherit}.fd-overflow-layout__more{font-size:var(--sapFontSize);line-height:var(--sapContent_LineHeight);color:var(--sapTextColor);font-family:var(--sapFontFamily);font-weight:400;box-sizing:border-box;padding:0;margin:0;border:0;display:flex;align-items:center}.fd-overflow-layout__more:before,.fd-overflow-layout__more:after{box-sizing:inherit;font-size:inherit}.fd-overflow-layout__items-container{font-size:var(--sapFontSize);line-height:var(--sapContent_LineHeight);color:var(--sapTextColor);font-family:var(--sapFontFamily);font-weight:400;box-sizing:border-box;padding:0;margin:0;border:0;display:flex;align-items:center;width:0;flex:1 auto}.fd-overflow-layout__items-container:before,.fd-overflow-layout__items-container:after{box-sizing:inherit;font-size:inherit}.fd-overflow-layout__popover-container{font-size:var(--sapFontSize);line-height:var(--sapContent_LineHeight);color:var(--sapTextColor);font-family:var(--sapFontFamily);font-weight:400;box-sizing:border-box;padding:0;margin:0;border:0;display:block;white-space:normal}.fd-overflow-layout__popover-container:before,.fd-overflow-layout__popover-container:after{box-sizing:inherit;font-size:inherit}.fd-overflow-layout__item--soft-hidden{opacity:0!important}\n"], components: [{ type: i3.PopoverComponent, selector: "fd-popover", inputs: ["title", "trigger", "fixedPosition", "id", "mobile", "mobileConfig"] }, { type: i3.PopoverControlComponent, selector: "fd-popover-control" }, { type: i4.ButtonComponent, selector: "button[fd-button], a[fd-button]", inputs: ["class"], exportAs: ["fd-button"] }, { type: i3.PopoverBodyComponent, selector: "fd-popover-body" }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: OverflowLayoutItemContainerDirective, selector: "[fdOverflowLayoutItemContainer]", inputs: ["last", "first", "softHidden"] }, { type: OverflowItemContainerRefDirective, selector: "[fdOverflowItemContainerRef]" }, { type: OverflowLayoutPopoverContentDirective, selector: "[fdOverflowLayoutPopoverContent]", inputs: ["items"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
389
569
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: OverflowLayoutComponent, decorators: [{
|
|
390
570
|
type: Component,
|
|
391
571
|
args: [{ selector: 'fd-overflow-layout', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
392
572
|
{
|
|
393
573
|
provide: FD_OVERFLOW_CONTAINER,
|
|
394
574
|
useExisting: OverflowLayoutComponent
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
|
|
575
|
+
},
|
|
576
|
+
OverflowLayoutService
|
|
577
|
+
], template: "<ng-template [ngIf]=\"showMorePosition === 'left'\">\n <ng-template [ngTemplateOutlet]=\"showMore\"></ng-template>\n</ng-template>\n\n<div class=\"fd-overflow-layout__items-container\" #layoutContainer>\n <div class=\"fd-overflow-layout__items\" #itemsWrapper>\n <ng-container *ngFor=\"let item of _allItems; trackBy: _itemsTrackFn\">\n <div fdOverflowLayoutItemContainer [first]=\"item.first\" [last]=\"item.last\" [softHidden]=\"item.softHidden\">\n <ng-container *fdOverflowItemContainerRef>\n <ng-template\n [ngTemplateOutlet]=\"item.templateRef\"\n [ngTemplateOutletContext]=\"{\n $implicit: item.hidden,\n index: item.index,\n first: item.first,\n last: item.last\n }\"\n ></ng-template>\n </ng-container>\n </div>\n </ng-container>\n </div>\n</div>\n\n<ng-template [ngIf]=\"showMorePosition === 'right'\">\n <ng-template [ngTemplateOutlet]=\"showMore\"></ng-template>\n</ng-template>\n\n<ng-template #showMore>\n <div class=\"fd-overflow-layout__more\" [style.display]=\"_showMore ? 'block' : 'none'\" #showMoreContainer>\n <ng-template #defaultShowMore>\n <fd-popover\n (isOpenChange)=\"_onPopoverStateChange($event)\"\n placement=\"bottom\"\n [focusTrapped]=\"true\"\n [focusAutoCapture]=\"true\"\n [maxWidth]=\"312\"\n >\n <fd-popover-control>\n <button\n fd-button\n [fdMenu]=\"true\"\n i18n=\"@overflowLayout.moreItemsButton|Overflow Layout more button text\"\n fdType=\"transparent\"\n >\n {{ _hiddenItems.length }} more\n </button>\n </fd-popover-control>\n <fd-popover-body>\n <div fdOverflowLayoutPopoverContent [items]=\"_hiddenItems\">\n <ng-container *ngFor=\"let item of _hiddenItems\">\n <ng-template\n [ngTemplateOutlet]=\"item.templateRef\"\n [ngTemplateOutletContext]=\"{\n $implicit: item.hidden,\n index: item.index,\n first: item.first,\n last: item.last\n }\"\n ></ng-template>\n </ng-container>\n </div>\n </fd-popover-body>\n </fd-popover>\n </ng-template>\n <ng-template\n [ngTemplateOutlet]=\"_moreButton?.templateRef || defaultShowMore\"\n [ngTemplateOutletContext]=\"{ $implicit: _hiddenItems }\"\n ></ng-template>\n </div>\n</ng-template>\n", styles: [".fd-overflow-layout{font-size:var(--sapFontSize);line-height:var(--sapContent_LineHeight);color:var(--sapTextColor);font-family:var(--sapFontFamily);font-weight:400;box-sizing:border-box;padding:0;margin:0;border:0;display:flex;align-items:center;width:100%}.fd-overflow-layout:before,.fd-overflow-layout:after{box-sizing:inherit;font-size:inherit}.fd-overflow-layout__items{font-size:var(--sapFontSize);line-height:var(--sapContent_LineHeight);color:var(--sapTextColor);font-family:var(--sapFontFamily);font-weight:400;box-sizing:border-box;padding:0;margin:0;border:0;display:flex;align-items:center}.fd-overflow-layout__items:before,.fd-overflow-layout__items:after{box-sizing:inherit;font-size:inherit}.fd-overflow-layout__more{font-size:var(--sapFontSize);line-height:var(--sapContent_LineHeight);color:var(--sapTextColor);font-family:var(--sapFontFamily);font-weight:400;box-sizing:border-box;padding:0;margin:0;border:0;display:flex;align-items:center}.fd-overflow-layout__more:before,.fd-overflow-layout__more:after{box-sizing:inherit;font-size:inherit}.fd-overflow-layout__items-container{font-size:var(--sapFontSize);line-height:var(--sapContent_LineHeight);color:var(--sapTextColor);font-family:var(--sapFontFamily);font-weight:400;box-sizing:border-box;padding:0;margin:0;border:0;display:flex;align-items:center;width:0;flex:1 auto}.fd-overflow-layout__items-container:before,.fd-overflow-layout__items-container:after{box-sizing:inherit;font-size:inherit}.fd-overflow-layout__popover-container{font-size:var(--sapFontSize);line-height:var(--sapContent_LineHeight);color:var(--sapTextColor);font-family:var(--sapFontFamily);font-weight:400;box-sizing:border-box;padding:0;margin:0;border:0;display:block;white-space:normal}.fd-overflow-layout__popover-container:before,.fd-overflow-layout__popover-container:after{box-sizing:inherit;font-size:inherit}.fd-overflow-layout__item--soft-hidden{opacity:0!important}\n"] }]
|
|
578
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: i0.ElementRef }, { type: OverflowLayoutService }, { type: i1.RtlService, decorators: [{
|
|
398
579
|
type: Optional
|
|
399
580
|
}] }]; }, propDecorators: { maxVisibleItems: [{
|
|
400
581
|
type: Input
|
|
582
|
+
}], showMorePosition: [{
|
|
583
|
+
type: Input
|
|
584
|
+
}], reverseHiddenItems: [{
|
|
585
|
+
type: Input
|
|
586
|
+
}], enableKeyboardNavigation: [{
|
|
587
|
+
type: Input
|
|
401
588
|
}], visibleItemsCount: [{
|
|
402
589
|
type: Output
|
|
403
590
|
}], hiddenItemsCount: [{
|
|
404
591
|
type: Output
|
|
405
592
|
}], _items: [{
|
|
406
593
|
type: ContentChildren,
|
|
407
|
-
args: [FD_OVERFLOW_ITEM_REF]
|
|
594
|
+
args: [FD_OVERFLOW_ITEM_REF, { descendants: true }]
|
|
408
595
|
}], _moreButton: [{
|
|
409
596
|
type: ContentChild,
|
|
410
597
|
args: [FD_OVERFLOW_EXPAND]
|
|
411
598
|
}], _overflowItems: [{
|
|
412
599
|
type: ContentChildren,
|
|
413
|
-
args: [FD_OVERFLOW_ITEM]
|
|
600
|
+
args: [FD_OVERFLOW_ITEM, { descendants: true }]
|
|
414
601
|
}], _visibleItems: [{
|
|
415
602
|
type: ViewChildren,
|
|
416
603
|
args: [OverflowLayoutItemContainerDirective]
|
|
@@ -438,10 +625,19 @@ class OverflowItemRefDirective {
|
|
|
438
625
|
/** @hidden */
|
|
439
626
|
constructor(templateRef) {
|
|
440
627
|
this.templateRef = templateRef;
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
628
|
+
this._hidden = false;
|
|
629
|
+
/** Whether the item is softly hidden. */
|
|
630
|
+
this.softHidden = true;
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* Whether the item is hidden.
|
|
634
|
+
*/
|
|
635
|
+
get hidden() {
|
|
636
|
+
return this._hidden;
|
|
637
|
+
}
|
|
638
|
+
set hidden(value) {
|
|
639
|
+
this._hidden = value;
|
|
640
|
+
this.overflowItem.hiddenChange.emit(value);
|
|
445
641
|
}
|
|
446
642
|
/** @hidden */
|
|
447
643
|
static ngTemplateContextGuard(dir, ctx) {
|
|
@@ -466,7 +662,7 @@ class OverflowItemRefDirective {
|
|
|
466
662
|
}
|
|
467
663
|
}
|
|
468
664
|
OverflowItemRefDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: OverflowItemRefDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
469
|
-
OverflowItemRefDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: OverflowItemRefDirective, selector: "[fdOverflowItemRef]", providers: [
|
|
665
|
+
OverflowItemRefDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: OverflowItemRefDirective, selector: "[fdOverflowItemRef]", inputs: { item: ["fdOverflowItemRef", "item"] }, providers: [
|
|
470
666
|
{
|
|
471
667
|
provide: FD_OVERFLOW_ITEM_REF,
|
|
472
668
|
useExisting: OverflowItemRefDirective
|
|
@@ -483,7 +679,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
483
679
|
}
|
|
484
680
|
]
|
|
485
681
|
}]
|
|
486
|
-
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; }
|
|
682
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; }, propDecorators: { item: [{
|
|
683
|
+
type: Input,
|
|
684
|
+
args: ['fdOverflowItemRef']
|
|
685
|
+
}] } });
|
|
487
686
|
|
|
488
687
|
/**
|
|
489
688
|
* Structural directive which is responsible for rendering the "More" button and handling further logic.
|
|
@@ -499,7 +698,7 @@ class OverflowExpandDirective {
|
|
|
499
698
|
}
|
|
500
699
|
}
|
|
501
700
|
OverflowExpandDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: OverflowExpandDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
502
|
-
OverflowExpandDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: OverflowExpandDirective, selector: "[fdOverflowExpand]", providers: [
|
|
701
|
+
OverflowExpandDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: OverflowExpandDirective, selector: "[fdOverflowExpand]", inputs: { fdOverflowExpandItems: "fdOverflowExpandItems" }, providers: [
|
|
503
702
|
{
|
|
504
703
|
provide: FD_OVERFLOW_EXPAND,
|
|
505
704
|
useExisting: OverflowExpandDirective
|
|
@@ -516,7 +715,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
516
715
|
}
|
|
517
716
|
]
|
|
518
717
|
}]
|
|
519
|
-
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; }
|
|
718
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; }, propDecorators: { fdOverflowExpandItems: [{
|
|
719
|
+
type: Input
|
|
720
|
+
}] } });
|
|
520
721
|
|
|
521
722
|
/**
|
|
522
723
|
* Directive to mark element as part of for Overflow Layout Component items.
|
|
@@ -529,6 +730,10 @@ class OverflowLayoutItemDirective {
|
|
|
529
730
|
this._overflowItemRef = _overflowItemRef;
|
|
530
731
|
/** Whether the item should be focusable. */
|
|
531
732
|
this.focusable = false;
|
|
733
|
+
/**
|
|
734
|
+
* Event emitted when `hidden` property has been changed.
|
|
735
|
+
*/
|
|
736
|
+
this.hiddenChange = new EventEmitter();
|
|
532
737
|
/** @hidden */
|
|
533
738
|
this._forceVisibility = false;
|
|
534
739
|
}
|
|
@@ -549,6 +754,9 @@ class OverflowLayoutItemDirective {
|
|
|
549
754
|
get hidden() {
|
|
550
755
|
return this._overflowItemRef?.hidden === true;
|
|
551
756
|
}
|
|
757
|
+
set hidden(value) {
|
|
758
|
+
this.hiddenChange.emit(value);
|
|
759
|
+
}
|
|
552
760
|
/** @hidden */
|
|
553
761
|
get _tabindex() {
|
|
554
762
|
return this.focusable ? 0 : -1;
|
|
@@ -576,7 +784,7 @@ class OverflowLayoutItemDirective {
|
|
|
576
784
|
}
|
|
577
785
|
}
|
|
578
786
|
OverflowLayoutItemDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: OverflowLayoutItemDirective, deps: [{ token: OverflowLayoutComponent }, { token: i0.ElementRef }, { token: FD_OVERFLOW_ITEM_REF, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
579
|
-
OverflowLayoutItemDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: OverflowLayoutItemDirective, selector: "[fdOverflowLayoutItem]", inputs: { focusable: "focusable", forceVisibility: "forceVisibility" }, host: { listeners: { "focus": "onFocus()" }, properties: { "attr.tabindex": "this._tabindex" } }, providers: [
|
|
787
|
+
OverflowLayoutItemDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: OverflowLayoutItemDirective, selector: "[fdOverflowLayoutItem]", inputs: { focusable: "focusable", forceVisibility: "forceVisibility" }, outputs: { hiddenChange: "hiddenChange" }, host: { listeners: { "focus": "onFocus()" }, properties: { "attr.tabindex": "this._tabindex" } }, providers: [
|
|
580
788
|
{
|
|
581
789
|
provide: FD_OVERFLOW_ITEM,
|
|
582
790
|
useExisting: OverflowLayoutItemDirective
|
|
@@ -604,6 +812,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
604
812
|
type: Input
|
|
605
813
|
}], forceVisibility: [{
|
|
606
814
|
type: Input
|
|
815
|
+
}], hiddenChange: [{
|
|
816
|
+
type: Output
|
|
607
817
|
}], _tabindex: [{
|
|
608
818
|
type: HostBinding,
|
|
609
819
|
args: ['attr.tabindex']
|
|
@@ -656,5 +866,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
656
866
|
* Generated bundle index. Do not edit.
|
|
657
867
|
*/
|
|
658
868
|
|
|
659
|
-
export { FD_OVERFLOW_EXPAND, FD_OVERFLOW_ITEM, FD_OVERFLOW_ITEM_REF, OverflowExpandDirective, OverflowItemContainerRefDirective, OverflowItemRefDirective, OverflowLayoutComponent, OverflowLayoutItemDirective, OverflowLayoutModule, OverflowLayoutPopoverContentDirective };
|
|
869
|
+
export { FD_OVERFLOW_CONTAINER, FD_OVERFLOW_EXPAND, FD_OVERFLOW_ITEM, FD_OVERFLOW_ITEM_REF, OverflowExpandDirective, OverflowItemContainerRefDirective, OverflowItemRefDirective, OverflowLayoutComponent, OverflowLayoutItemDirective, OverflowLayoutListeningResult, OverflowLayoutModule, OverflowLayoutPopoverContentDirective, OverflowLayoutService };
|
|
660
870
|
//# sourceMappingURL=fundamental-ngx-core-overflow-layout.mjs.map
|