@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,264 @@ 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
|
+
var _a;
|
|
300
|
+
if (!this.config.enableKeyboardNavigation) {
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
this._dir = ((_a = this._rtlService) === null || _a === void 0 ? void 0 : _a.rtl.value) ? 'rtl' : 'ltr';
|
|
304
|
+
this._keyboardEventsManager = new FocusKeyManager(this._overflowItems)
|
|
305
|
+
.withWrap()
|
|
306
|
+
.withHorizontalOrientation(this._dir)
|
|
307
|
+
.skipPredicate((item) => !item.focusable || item.hidden);
|
|
308
|
+
}
|
|
309
|
+
/** @hidden Rtl change subscription */
|
|
310
|
+
_subscribeToRtl() {
|
|
311
|
+
if (!this._rtlService || !this.config.enableKeyboardNavigation) {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
this._subscription.add(this._rtlService.rtl.subscribe((isRtl) => {
|
|
315
|
+
this._dir = isRtl ? 'rtl' : 'ltr';
|
|
316
|
+
this._keyboardEventsManager = this._keyboardEventsManager.withHorizontalOrientation(this._dir);
|
|
317
|
+
}));
|
|
318
|
+
}
|
|
319
|
+
/** @hidden */
|
|
320
|
+
_getForcedItemsIndexes() {
|
|
321
|
+
return this._allItems
|
|
322
|
+
.map((item, index) => (item.overflowItem.forceVisibility ? index : -1))
|
|
323
|
+
.filter((i) => i > -1);
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* @hidden
|
|
327
|
+
* Returns combined width of the element including margins.
|
|
328
|
+
* @param element Element to calculate width of.
|
|
329
|
+
*/
|
|
330
|
+
_getElementWidth(element) {
|
|
331
|
+
const elementStyle = getComputedStyle(element);
|
|
332
|
+
const elementWidth = element.getBoundingClientRect().width;
|
|
333
|
+
const elementSize = elementWidth + parseFloat(elementStyle.marginLeft) + parseFloat(elementStyle.marginRight);
|
|
334
|
+
return Math.ceil(elementSize);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
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 });
|
|
338
|
+
OverflowLayoutService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: OverflowLayoutService });
|
|
339
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: OverflowLayoutService, decorators: [{
|
|
340
|
+
type: Injectable
|
|
341
|
+
}], ctorParameters: function () {
|
|
342
|
+
return [{ type: i0.ElementRef }, { type: i1.RtlService, decorators: [{
|
|
343
|
+
type: Optional
|
|
344
|
+
}] }];
|
|
345
|
+
} });
|
|
346
|
+
|
|
82
347
|
const FD_OVERFLOW_CONTAINER = new InjectionToken('FdOverflowContainer');
|
|
83
348
|
|
|
84
349
|
const FD_OVERFLOW_EXPAND = new InjectionToken('FdOverflowLayoutExpand');
|
|
@@ -154,11 +419,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
154
419
|
|
|
155
420
|
class OverflowLayoutComponent {
|
|
156
421
|
/** @hidden */
|
|
157
|
-
constructor(_cdr, _zone, _elRef, _rtlService) {
|
|
422
|
+
constructor(_cdr, _zone, _elRef, _overflowLayoutService, _rtlService) {
|
|
158
423
|
this._cdr = _cdr;
|
|
159
424
|
this._zone = _zone;
|
|
160
425
|
this._elRef = _elRef;
|
|
426
|
+
this._overflowLayoutService = _overflowLayoutService;
|
|
161
427
|
this._rtlService = _rtlService;
|
|
428
|
+
/** Direction of the fitting items calculation. */
|
|
429
|
+
this.showMorePosition = 'right';
|
|
430
|
+
/** Whether to render hidden items in reverse order. */
|
|
431
|
+
this.reverseHiddenItems = false;
|
|
432
|
+
/** Whether to enable keyboard navigation. */
|
|
433
|
+
this.enableKeyboardNavigation = true;
|
|
162
434
|
/**
|
|
163
435
|
* Event, triggered when amount of visible items has been changed.
|
|
164
436
|
*/
|
|
@@ -176,16 +448,14 @@ class OverflowLayoutComponent {
|
|
|
176
448
|
/** @hidden */
|
|
177
449
|
this._initialClass = 'fd-overflow-layout';
|
|
178
450
|
/** @hidden */
|
|
179
|
-
this._listenToItemResize = true;
|
|
180
|
-
/** @hidden */
|
|
181
451
|
this._subscription = new Subscription();
|
|
182
452
|
/** @hidden */
|
|
183
453
|
this._fillTrigger$ = new Subject();
|
|
184
454
|
/** @hidden */
|
|
185
|
-
this._dir = 'ltr';
|
|
186
|
-
/** @hidden */
|
|
187
455
|
this._maxVisibleItems = Infinity;
|
|
188
|
-
|
|
456
|
+
/** @hidden */
|
|
457
|
+
this._canListenToResize = false;
|
|
458
|
+
this._subscription.add(this._fillTrigger$.pipe(debounceTime(30)).subscribe(() => this._overflowLayoutService.fitVisibleItems()));
|
|
189
459
|
}
|
|
190
460
|
/**
|
|
191
461
|
* Maximum amount of visible items.
|
|
@@ -204,26 +474,16 @@ class OverflowLayoutComponent {
|
|
|
204
474
|
* Triggers layout recalculation of the items.
|
|
205
475
|
*/
|
|
206
476
|
triggerRecalculation() {
|
|
477
|
+
if (!this._canListenToResize) {
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
this._overflowLayoutService.setConfig(this._getConfig());
|
|
207
481
|
this._fillTrigger$.next();
|
|
208
482
|
}
|
|
209
483
|
/** @hidden */
|
|
210
484
|
ngOnDestroy() {
|
|
211
485
|
this._subscription.unsubscribe();
|
|
212
486
|
}
|
|
213
|
-
/** @hidden */
|
|
214
|
-
_keyUpHandler(event) {
|
|
215
|
-
if (KeyUtil.isKeyCode(event, TAB)) {
|
|
216
|
-
const index = this._allItems.findIndex((item) => { var _a; return ((_a = item.overflowItem) === null || _a === void 0 ? void 0 : _a.focusable) && item.elementRef.nativeElement === event.target; });
|
|
217
|
-
if (index !== -1) {
|
|
218
|
-
this._keyboardEventsManager.setActiveItem(index);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
if (KeyUtil.isKeyCode(event, [DOWN_ARROW, UP_ARROW, LEFT_ARROW, RIGHT_ARROW])) {
|
|
222
|
-
event.preventDefault();
|
|
223
|
-
// passing the event to key manager so, we get a change fired
|
|
224
|
-
this._keyboardEventsManager.onKeydown(event);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
487
|
/**
|
|
228
488
|
* Sets current focused element.
|
|
229
489
|
* @param element Element that needs to be focused.
|
|
@@ -231,7 +491,7 @@ class OverflowLayoutComponent {
|
|
|
231
491
|
setFocusedElement(element) {
|
|
232
492
|
const index = this._overflowItems.toArray().findIndex((item) => item === element);
|
|
233
493
|
if (index !== -1) {
|
|
234
|
-
this._keyboardEventsManager.setActiveItem(index);
|
|
494
|
+
this._overflowLayoutService._keyboardEventsManager.setActiveItem(index);
|
|
235
495
|
}
|
|
236
496
|
}
|
|
237
497
|
/**
|
|
@@ -254,170 +514,99 @@ class OverflowLayoutComponent {
|
|
|
254
514
|
}
|
|
255
515
|
/** @hidden */
|
|
256
516
|
ngAfterViewInit() {
|
|
257
|
-
this.
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
this.
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
517
|
+
this._subscription.add(this._overflowLayoutService.detectChanges.subscribe(() => {
|
|
518
|
+
this._cdr.detectChanges();
|
|
519
|
+
}));
|
|
520
|
+
this._subscription.add(this._overflowLayoutService.onResult.subscribe((result) => {
|
|
521
|
+
this._hiddenItems = result.hiddenItems;
|
|
522
|
+
this._showMore = result.showMore;
|
|
523
|
+
this.hiddenItemsCount.emit(result.hiddenItems.length);
|
|
524
|
+
this.visibleItemsCount.emit(this._allItems.filter((i) => !i.hidden).length);
|
|
525
|
+
this._cdr.detectChanges();
|
|
526
|
+
}));
|
|
264
527
|
this._subscription.add(this._items.changes.subscribe(() => {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
});
|
|
528
|
+
this._allItems = this._items.toArray();
|
|
529
|
+
this._cdr.detectChanges();
|
|
268
530
|
}));
|
|
269
|
-
this.
|
|
531
|
+
this._allItems = this._items.toArray();
|
|
532
|
+
this._cdr.detectChanges();
|
|
533
|
+
this._overflowLayoutService.startListening(this._getConfig());
|
|
534
|
+
this._canListenToResize = true;
|
|
270
535
|
}
|
|
271
536
|
/** @hidden */
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
.
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
537
|
+
_getConfig() {
|
|
538
|
+
return {
|
|
539
|
+
visibleItems: this._visibleItems,
|
|
540
|
+
items: this._items,
|
|
541
|
+
itemsWrapper: this._itemsWrapper.nativeElement,
|
|
542
|
+
showMoreContainer: this._showMoreContainer.nativeElement,
|
|
543
|
+
layoutContainerElement: this._layoutContainer.nativeElement,
|
|
544
|
+
maxVisibleItems: this.maxVisibleItems,
|
|
545
|
+
direction: this.showMorePosition,
|
|
546
|
+
enableKeyboardNavigation: this.enableKeyboardNavigation,
|
|
547
|
+
reverseHiddenItems: this.reverseHiddenItems
|
|
548
|
+
};
|
|
280
549
|
}
|
|
281
550
|
/** @hidden */
|
|
282
|
-
|
|
283
|
-
this.
|
|
284
|
-
this._allItems = this._items.toArray();
|
|
285
|
-
this._visibleItems.forEach((i) => (i.containerRef.hidden = false));
|
|
286
|
-
this._allItems.forEach((item, index) => {
|
|
287
|
-
item.hidden = false;
|
|
288
|
-
item.index = index;
|
|
289
|
-
});
|
|
290
|
-
this._cdr.detectChanges();
|
|
291
|
-
const containerWidth = this._elRef.nativeElement.getBoundingClientRect().width;
|
|
292
|
-
const itemsContainerWidth = this._itemsWrapper.nativeElement.getBoundingClientRect().width;
|
|
293
|
-
if (containerWidth >= itemsContainerWidth &&
|
|
294
|
-
this._visibleItems.length <= this.maxVisibleItems &&
|
|
295
|
-
this._hiddenItems.length === 0) {
|
|
296
|
-
this._showMore = false;
|
|
297
|
-
this._cdr.detectChanges();
|
|
298
|
-
this._listenToItemResize = true;
|
|
551
|
+
_keyUpHandler(event) {
|
|
552
|
+
if (!this.enableKeyboardNavigation) {
|
|
299
553
|
return;
|
|
300
554
|
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
this._cdr.detectChanges();
|
|
306
|
-
const showMoreContainerWidth = this._showMoreContainer.nativeElement.getBoundingClientRect().width;
|
|
307
|
-
let layoutWidth = this._layoutContainer.nativeElement.getBoundingClientRect().width;
|
|
308
|
-
// Try to find all forced visible items
|
|
309
|
-
const forcedItemsIndexes = this._getForcedItemsIndexes();
|
|
310
|
-
forcedItemsIndexes.forEach((itemIndex) => {
|
|
311
|
-
const container = this._visibleItems.get(itemIndex);
|
|
312
|
-
if (!container) {
|
|
313
|
-
return;
|
|
555
|
+
if (KeyUtil.isKeyCode(event, TAB)) {
|
|
556
|
+
const index = this._allItems.findIndex((item) => { var _a; return ((_a = item.overflowItem) === null || _a === void 0 ? void 0 : _a.focusable) && item.elementRef.nativeElement === event.target; });
|
|
557
|
+
if (index !== -1) {
|
|
558
|
+
this._overflowLayoutService._keyboardEventsManager.setActiveItem(index);
|
|
314
559
|
}
|
|
315
|
-
const elementSize = this._getElementWidth(container.elementRef.nativeElement);
|
|
316
|
-
layoutWidth -= elementSize;
|
|
317
|
-
});
|
|
318
|
-
if (layoutWidth < 0 && forcedItemsIndexes.length > 0) {
|
|
319
|
-
console.warn('There is no enough space to fit all forced visible items into the container. Please adjust their visibility accordingly.');
|
|
320
560
|
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
itemRef.hidden = true;
|
|
326
|
-
return;
|
|
327
|
-
}
|
|
328
|
-
const elementSize = this._getElementWidth(item.elementRef.nativeElement);
|
|
329
|
-
const combinedWidth = fittingElmsWidth + elementSize;
|
|
330
|
-
if ((combinedWidth <= layoutWidth ||
|
|
331
|
-
(item === this._visibleItems.last && combinedWidth <= layoutWidth + showMoreContainerWidth)) &&
|
|
332
|
-
fittingElmCount < this.maxVisibleItems) {
|
|
333
|
-
fittingElmsWidth += elementSize;
|
|
334
|
-
fittingElmCount++;
|
|
335
|
-
}
|
|
336
|
-
else if (!itemRef.overflowItem.forceVisibility) {
|
|
337
|
-
shouldHideItems = true;
|
|
338
|
-
item.containerRef.hidden = true;
|
|
339
|
-
itemRef.hidden = true;
|
|
340
|
-
}
|
|
341
|
-
});
|
|
342
|
-
this._hiddenItems = this._allItems.filter((i) => i.hidden);
|
|
343
|
-
this.visibleItemsCount.emit(this._allItems.filter((i) => !i.hidden).length);
|
|
344
|
-
this.hiddenItemsCount.emit(this._hiddenItems.length);
|
|
345
|
-
this._showMore = this._hiddenItems.length > 0;
|
|
346
|
-
this._cdr.detectChanges();
|
|
347
|
-
this._listenToItemResize = true;
|
|
348
|
-
}
|
|
349
|
-
/** @hidden */
|
|
350
|
-
_setFocusKeyManager() {
|
|
351
|
-
var _a;
|
|
352
|
-
this._dir = ((_a = this._rtlService) === null || _a === void 0 ? void 0 : _a.rtl.value) ? 'rtl' : 'ltr';
|
|
353
|
-
this._keyboardEventsManager = new FocusKeyManager(this._overflowItems)
|
|
354
|
-
.withWrap()
|
|
355
|
-
.withHorizontalOrientation(this._dir)
|
|
356
|
-
.skipPredicate((item) => !item.focusable || item.hidden);
|
|
357
|
-
}
|
|
358
|
-
/** @hidden Rtl change subscription */
|
|
359
|
-
_subscribeToRtl() {
|
|
360
|
-
if (!this._rtlService) {
|
|
361
|
-
return;
|
|
561
|
+
if (KeyUtil.isKeyCode(event, [DOWN_ARROW, UP_ARROW, LEFT_ARROW, RIGHT_ARROW])) {
|
|
562
|
+
event.preventDefault();
|
|
563
|
+
// passing the event to key manager so, we get a change fired
|
|
564
|
+
this._overflowLayoutService._keyboardEventsManager.onKeydown(event);
|
|
362
565
|
}
|
|
363
|
-
const rtlSub = this._rtlService.rtl.subscribe((isRtl) => {
|
|
364
|
-
this._dir = isRtl ? 'rtl' : 'ltr';
|
|
365
|
-
this._keyboardEventsManager = this._keyboardEventsManager.withHorizontalOrientation(isRtl ? 'rtl' : 'ltr');
|
|
366
|
-
});
|
|
367
|
-
this._subscription.add(rtlSub);
|
|
368
|
-
}
|
|
369
|
-
/** @hidden */
|
|
370
|
-
_getForcedItemsIndexes() {
|
|
371
|
-
return this._allItems
|
|
372
|
-
.map((item, index) => (item.overflowItem.forceVisibility ? index : -1))
|
|
373
|
-
.filter((i) => i > -1);
|
|
374
|
-
}
|
|
375
|
-
/**
|
|
376
|
-
* @hidden
|
|
377
|
-
* Returns combined width of the element including margins.
|
|
378
|
-
* @param element Element to calculate width of.
|
|
379
|
-
*/
|
|
380
|
-
_getElementWidth(element) {
|
|
381
|
-
const elementStyle = getComputedStyle(element);
|
|
382
|
-
const elementWidth = element.getBoundingClientRect().width;
|
|
383
|
-
const elementSize = elementWidth + parseFloat(elementStyle.marginLeft) + parseFloat(elementStyle.marginRight);
|
|
384
|
-
return elementSize;
|
|
385
566
|
}
|
|
386
567
|
}
|
|
387
|
-
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 });
|
|
388
|
-
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: [
|
|
568
|
+
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 });
|
|
569
|
+
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: [
|
|
389
570
|
{
|
|
390
571
|
provide: FD_OVERFLOW_CONTAINER,
|
|
391
572
|
useExisting: OverflowLayoutComponent
|
|
392
|
-
}
|
|
393
|
-
|
|
573
|
+
},
|
|
574
|
+
OverflowLayoutService
|
|
575
|
+
], 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 });
|
|
394
576
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: OverflowLayoutComponent, decorators: [{
|
|
395
577
|
type: Component,
|
|
396
578
|
args: [{ selector: 'fd-overflow-layout', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
397
579
|
{
|
|
398
580
|
provide: FD_OVERFLOW_CONTAINER,
|
|
399
581
|
useExisting: OverflowLayoutComponent
|
|
400
|
-
}
|
|
401
|
-
|
|
582
|
+
},
|
|
583
|
+
OverflowLayoutService
|
|
584
|
+
], 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"] }]
|
|
402
585
|
}], ctorParameters: function () {
|
|
403
|
-
return [{ type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: i0.ElementRef }, { type: i1.RtlService, decorators: [{
|
|
586
|
+
return [{ type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: i0.ElementRef }, { type: OverflowLayoutService }, { type: i1.RtlService, decorators: [{
|
|
404
587
|
type: Optional
|
|
405
588
|
}] }];
|
|
406
589
|
}, propDecorators: { maxVisibleItems: [{
|
|
407
590
|
type: Input
|
|
591
|
+
}], showMorePosition: [{
|
|
592
|
+
type: Input
|
|
593
|
+
}], reverseHiddenItems: [{
|
|
594
|
+
type: Input
|
|
595
|
+
}], enableKeyboardNavigation: [{
|
|
596
|
+
type: Input
|
|
408
597
|
}], visibleItemsCount: [{
|
|
409
598
|
type: Output
|
|
410
599
|
}], hiddenItemsCount: [{
|
|
411
600
|
type: Output
|
|
412
601
|
}], _items: [{
|
|
413
602
|
type: ContentChildren,
|
|
414
|
-
args: [FD_OVERFLOW_ITEM_REF]
|
|
603
|
+
args: [FD_OVERFLOW_ITEM_REF, { descendants: true }]
|
|
415
604
|
}], _moreButton: [{
|
|
416
605
|
type: ContentChild,
|
|
417
606
|
args: [FD_OVERFLOW_EXPAND]
|
|
418
607
|
}], _overflowItems: [{
|
|
419
608
|
type: ContentChildren,
|
|
420
|
-
args: [FD_OVERFLOW_ITEM]
|
|
609
|
+
args: [FD_OVERFLOW_ITEM, { descendants: true }]
|
|
421
610
|
}], _visibleItems: [{
|
|
422
611
|
type: ViewChildren,
|
|
423
612
|
args: [OverflowLayoutItemContainerDirective]
|
|
@@ -445,10 +634,19 @@ class OverflowItemRefDirective {
|
|
|
445
634
|
/** @hidden */
|
|
446
635
|
constructor(templateRef) {
|
|
447
636
|
this.templateRef = templateRef;
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
637
|
+
this._hidden = false;
|
|
638
|
+
/** Whether the item is softly hidden. */
|
|
639
|
+
this.softHidden = true;
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* Whether the item is hidden.
|
|
643
|
+
*/
|
|
644
|
+
get hidden() {
|
|
645
|
+
return this._hidden;
|
|
646
|
+
}
|
|
647
|
+
set hidden(value) {
|
|
648
|
+
this._hidden = value;
|
|
649
|
+
this.overflowItem.hiddenChange.emit(value);
|
|
452
650
|
}
|
|
453
651
|
/** @hidden */
|
|
454
652
|
static ngTemplateContextGuard(dir, ctx) {
|
|
@@ -473,7 +671,7 @@ class OverflowItemRefDirective {
|
|
|
473
671
|
}
|
|
474
672
|
}
|
|
475
673
|
OverflowItemRefDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: OverflowItemRefDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
476
|
-
OverflowItemRefDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: OverflowItemRefDirective, selector: "[fdOverflowItemRef]", providers: [
|
|
674
|
+
OverflowItemRefDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: OverflowItemRefDirective, selector: "[fdOverflowItemRef]", inputs: { item: ["fdOverflowItemRef", "item"] }, providers: [
|
|
477
675
|
{
|
|
478
676
|
provide: FD_OVERFLOW_ITEM_REF,
|
|
479
677
|
useExisting: OverflowItemRefDirective
|
|
@@ -490,7 +688,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
490
688
|
}
|
|
491
689
|
]
|
|
492
690
|
}]
|
|
493
|
-
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; }
|
|
691
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; }, propDecorators: { item: [{
|
|
692
|
+
type: Input,
|
|
693
|
+
args: ['fdOverflowItemRef']
|
|
694
|
+
}] } });
|
|
494
695
|
|
|
495
696
|
/**
|
|
496
697
|
* Structural directive which is responsible for rendering the "More" button and handling further logic.
|
|
@@ -506,7 +707,7 @@ class OverflowExpandDirective {
|
|
|
506
707
|
}
|
|
507
708
|
}
|
|
508
709
|
OverflowExpandDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: OverflowExpandDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
509
|
-
OverflowExpandDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: OverflowExpandDirective, selector: "[fdOverflowExpand]", providers: [
|
|
710
|
+
OverflowExpandDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: OverflowExpandDirective, selector: "[fdOverflowExpand]", inputs: { fdOverflowExpandItems: "fdOverflowExpandItems" }, providers: [
|
|
510
711
|
{
|
|
511
712
|
provide: FD_OVERFLOW_EXPAND,
|
|
512
713
|
useExisting: OverflowExpandDirective
|
|
@@ -523,7 +724,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
523
724
|
}
|
|
524
725
|
]
|
|
525
726
|
}]
|
|
526
|
-
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; }
|
|
727
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; }, propDecorators: { fdOverflowExpandItems: [{
|
|
728
|
+
type: Input
|
|
729
|
+
}] } });
|
|
527
730
|
|
|
528
731
|
/**
|
|
529
732
|
* Directive to mark element as part of for Overflow Layout Component items.
|
|
@@ -536,6 +739,10 @@ class OverflowLayoutItemDirective {
|
|
|
536
739
|
this._overflowItemRef = _overflowItemRef;
|
|
537
740
|
/** Whether the item should be focusable. */
|
|
538
741
|
this.focusable = false;
|
|
742
|
+
/**
|
|
743
|
+
* Event emitted when `hidden` property has been changed.
|
|
744
|
+
*/
|
|
745
|
+
this.hiddenChange = new EventEmitter();
|
|
539
746
|
/** @hidden */
|
|
540
747
|
this._forceVisibility = false;
|
|
541
748
|
}
|
|
@@ -557,6 +764,9 @@ class OverflowLayoutItemDirective {
|
|
|
557
764
|
var _a;
|
|
558
765
|
return ((_a = this._overflowItemRef) === null || _a === void 0 ? void 0 : _a.hidden) === true;
|
|
559
766
|
}
|
|
767
|
+
set hidden(value) {
|
|
768
|
+
this.hiddenChange.emit(value);
|
|
769
|
+
}
|
|
560
770
|
/** @hidden */
|
|
561
771
|
get _tabindex() {
|
|
562
772
|
return this.focusable ? 0 : -1;
|
|
@@ -586,7 +796,7 @@ class OverflowLayoutItemDirective {
|
|
|
586
796
|
}
|
|
587
797
|
}
|
|
588
798
|
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 });
|
|
589
|
-
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: [
|
|
799
|
+
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: [
|
|
590
800
|
{
|
|
591
801
|
provide: FD_OVERFLOW_ITEM,
|
|
592
802
|
useExisting: OverflowLayoutItemDirective
|
|
@@ -616,6 +826,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
616
826
|
type: Input
|
|
617
827
|
}], forceVisibility: [{
|
|
618
828
|
type: Input
|
|
829
|
+
}], hiddenChange: [{
|
|
830
|
+
type: Output
|
|
619
831
|
}], _tabindex: [{
|
|
620
832
|
type: HostBinding,
|
|
621
833
|
args: ['attr.tabindex']
|
|
@@ -668,5 +880,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImpor
|
|
|
668
880
|
* Generated bundle index. Do not edit.
|
|
669
881
|
*/
|
|
670
882
|
|
|
671
|
-
export { FD_OVERFLOW_EXPAND, FD_OVERFLOW_ITEM, FD_OVERFLOW_ITEM_REF, OverflowExpandDirective, OverflowItemContainerRefDirective, OverflowItemRefDirective, OverflowLayoutComponent, OverflowLayoutItemDirective, OverflowLayoutModule, OverflowLayoutPopoverContentDirective };
|
|
883
|
+
export { FD_OVERFLOW_CONTAINER, FD_OVERFLOW_EXPAND, FD_OVERFLOW_ITEM, FD_OVERFLOW_ITEM_REF, OverflowExpandDirective, OverflowItemContainerRefDirective, OverflowItemRefDirective, OverflowLayoutComponent, OverflowLayoutItemDirective, OverflowLayoutListeningResult, OverflowLayoutModule, OverflowLayoutPopoverContentDirective, OverflowLayoutService };
|
|
672
884
|
//# sourceMappingURL=fundamental-ngx-core-overflow-layout.mjs.map
|