igniteui-angular 22.0.0-rc.1 → 22.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/igniteui-angular-accordion.mjs +1 -1
- package/fesm2022/igniteui-angular-accordion.mjs.map +1 -1
- package/fesm2022/igniteui-angular-action-strip.mjs +1 -1
- package/fesm2022/igniteui-angular-action-strip.mjs.map +1 -1
- package/fesm2022/igniteui-angular-button-group.mjs +1 -1
- package/fesm2022/igniteui-angular-button-group.mjs.map +1 -1
- package/fesm2022/igniteui-angular-calendar.mjs +1 -1
- package/fesm2022/igniteui-angular-calendar.mjs.map +1 -1
- package/fesm2022/igniteui-angular-card.mjs +6 -6
- package/fesm2022/igniteui-angular-card.mjs.map +1 -1
- package/fesm2022/igniteui-angular-carousel.mjs +6 -6
- package/fesm2022/igniteui-angular-carousel.mjs.map +1 -1
- package/fesm2022/igniteui-angular-chips.mjs +34 -34
- package/fesm2022/igniteui-angular-chips.mjs.map +1 -1
- package/fesm2022/igniteui-angular-core.mjs +6 -6
- package/fesm2022/igniteui-angular-core.mjs.map +1 -1
- package/fesm2022/igniteui-angular-date-picker.mjs +2 -2
- package/fesm2022/igniteui-angular-date-picker.mjs.map +1 -1
- package/fesm2022/igniteui-angular-directives.mjs +12 -12
- package/fesm2022/igniteui-angular-directives.mjs.map +1 -1
- package/fesm2022/igniteui-angular-drop-down.mjs +5 -5
- package/fesm2022/igniteui-angular-drop-down.mjs.map +1 -1
- package/fesm2022/igniteui-angular-grids-core.mjs +35 -23
- package/fesm2022/igniteui-angular-grids-core.mjs.map +1 -1
- package/fesm2022/igniteui-angular-grids-grid.mjs +51 -51
- package/fesm2022/igniteui-angular-grids-grid.mjs.map +1 -1
- package/fesm2022/igniteui-angular-grids-hierarchical-grid.mjs +7 -7
- package/fesm2022/igniteui-angular-grids-hierarchical-grid.mjs.map +1 -1
- package/fesm2022/igniteui-angular-grids-tree-grid.mjs +5 -5
- package/fesm2022/igniteui-angular-grids-tree-grid.mjs.map +1 -1
- package/fesm2022/igniteui-angular-icon.mjs +4 -4
- package/fesm2022/igniteui-angular-icon.mjs.map +1 -1
- package/fesm2022/igniteui-angular-input-group.mjs +18 -18
- package/fesm2022/igniteui-angular-input-group.mjs.map +1 -1
- package/fesm2022/igniteui-angular-list.mjs +5 -5
- package/fesm2022/igniteui-angular-list.mjs.map +1 -1
- package/fesm2022/igniteui-angular-navbar.mjs +5 -5
- package/fesm2022/igniteui-angular-navbar.mjs.map +1 -1
- package/fesm2022/igniteui-angular-paginator.mjs +2 -2
- package/fesm2022/igniteui-angular-paginator.mjs.map +1 -1
- package/fesm2022/igniteui-angular-progressbar.mjs +7 -7
- package/fesm2022/igniteui-angular-progressbar.mjs.map +1 -1
- package/fesm2022/igniteui-angular-query-builder.mjs +2 -2
- package/fesm2022/igniteui-angular-query-builder.mjs.map +1 -1
- package/fesm2022/igniteui-angular-radio.mjs +5 -5
- package/fesm2022/igniteui-angular-radio.mjs.map +1 -1
- package/fesm2022/igniteui-angular-select.mjs +217 -209
- package/fesm2022/igniteui-angular-select.mjs.map +1 -1
- package/fesm2022/igniteui-angular-slider.mjs +17 -17
- package/fesm2022/igniteui-angular-slider.mjs.map +1 -1
- package/fesm2022/igniteui-angular-snackbar.mjs +1 -1
- package/fesm2022/igniteui-angular-snackbar.mjs.map +1 -1
- package/fesm2022/igniteui-angular-splitter.mjs +2 -2
- package/fesm2022/igniteui-angular-splitter.mjs.map +1 -1
- package/fesm2022/igniteui-angular-stepper.mjs +2 -2
- package/fesm2022/igniteui-angular-stepper.mjs.map +1 -1
- package/fesm2022/igniteui-angular-time-picker.mjs +1 -1
- package/fesm2022/igniteui-angular-time-picker.mjs.map +1 -1
- package/fesm2022/igniteui-angular-tree.mjs +1 -1
- package/fesm2022/igniteui-angular-tree.mjs.map +1 -1
- package/input-group/README.md +1 -1
- package/migrations/migration-collection.json +5 -0
- package/migrations/update-22_0_0/index.d.ts +3 -0
- package/migrations/update-22_0_0/index.js +86 -0
- package/migrations/update-22_0_0/index.spec.d.ts +1 -0
- package/migrations/update-22_0_0/index.spec.js +116 -0
- package/package.json +2 -2
- package/skills/igniteui-angular-grids/references/sizing.md +1 -0
- package/skills/igniteui-angular-grids/references/structure.md +1 -0
- package/skills/igniteui-angular-grids/references/types.md +2 -1
- package/types/igniteui-angular-accordion.d.ts +3 -3
- package/types/igniteui-angular-action-strip.d.ts +1 -1
- package/types/igniteui-angular-button-group.d.ts +1 -1
- package/types/igniteui-angular-calendar.d.ts +1 -1
- package/types/igniteui-angular-card.d.ts +6 -6
- package/types/igniteui-angular-carousel.d.ts +6 -6
- package/types/igniteui-angular-chips.d.ts +38 -38
- package/types/igniteui-angular-core.d.ts +9 -9
- package/types/igniteui-angular-date-picker.d.ts +4 -4
- package/types/igniteui-angular-directives.d.ts +15 -15
- package/types/igniteui-angular-drop-down.d.ts +6 -6
- package/types/igniteui-angular-grids-core.d.ts +31 -29
- package/types/igniteui-angular-grids-grid.d.ts +51 -51
- package/types/igniteui-angular-grids-hierarchical-grid.d.ts +7 -7
- package/types/igniteui-angular-grids-tree-grid.d.ts +7 -7
- package/types/igniteui-angular-icon.d.ts +4 -4
- package/types/igniteui-angular-input-group.d.ts +17 -17
- package/types/igniteui-angular-list.d.ts +7 -7
- package/types/igniteui-angular-navbar.d.ts +7 -7
- package/types/igniteui-angular-paginator.d.ts +2 -2
- package/types/igniteui-angular-progressbar.d.ts +7 -7
- package/types/igniteui-angular-query-builder.d.ts +3 -3
- package/types/igniteui-angular-radio.d.ts +5 -5
- package/types/igniteui-angular-select.d.ts +91 -7
- package/types/igniteui-angular-slider.d.ts +17 -17
- package/types/igniteui-angular-snackbar.d.ts +1 -1
- package/types/igniteui-angular-splitter.d.ts +3 -3
- package/types/igniteui-angular-stepper.d.ts +2 -2
- package/types/igniteui-angular-time-picker.d.ts +1 -1
- package/types/igniteui-angular-tree.d.ts +2 -2
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import * as i4 from 'igniteui-angular/input-group';
|
|
2
2
|
import { IGX_INPUT_GROUP_TYPE, IgxInputState, IgxInputGroupComponent, IgxInputDirective, IgxSuffixDirective, IgxReadOnlyInputDirective, IgxHintDirective, IgxPrefixDirective, IgxLabelDirective } from 'igniteui-angular/input-group';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { ChangeDetectionStrategy, Component, Input,
|
|
4
|
+
import { ChangeDetectionStrategy, Component, Input, Directive, inject, Injector, EventEmitter, QueryList, TemplateRef, ElementRef, booleanAttribute, ContentChild, Output, HostBinding, forwardRef, ViewChildren, ContentChildren, ViewChild, NgModule } from '@angular/core';
|
|
5
5
|
import { IgxDropDownGroupComponent, IgxDropDownItemComponent, IgxDropDownItemNavigationDirective, IgxDropDownComponent, IGX_DROPDOWN_BASE } from 'igniteui-angular/drop-down';
|
|
6
6
|
import { NgTemplateOutlet } from '@angular/common';
|
|
7
7
|
import { NgControl, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
8
8
|
import { Subscription, timer, noop } from 'rxjs';
|
|
9
9
|
import { takeUntil } from 'rxjs/operators';
|
|
10
|
-
import { BaseFitPositionStrategy, VerticalAlignment, HorizontalAlignment, Util
|
|
11
|
-
import { __decorate, __param } from 'tslib';
|
|
12
|
-
import { fadeOut, fadeIn } from 'igniteui-angular/animations';
|
|
10
|
+
import { IgxOverlayService, AbsoluteScrollStrategy, AutoPositionStrategy, BaseFitPositionStrategy, VerticalAlignment, HorizontalAlignment, Util } from 'igniteui-angular/core';
|
|
13
11
|
import { IgxToggleDirective } from 'igniteui-angular/directives';
|
|
14
12
|
import { IgxIconComponent } from 'igniteui-angular/icon';
|
|
13
|
+
import { fadeOut, fadeIn } from 'igniteui-angular/animations';
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
16
|
* The `<igx-select-item>` is a container intended for row items in
|
|
@@ -92,197 +91,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImpor
|
|
|
92
91
|
type: Input
|
|
93
92
|
}] } });
|
|
94
93
|
|
|
95
|
-
/** @hidden @internal */
|
|
96
|
-
let SelectPositioningStrategy = class SelectPositioningStrategy extends BaseFitPositionStrategy {
|
|
97
|
-
constructor(select, settings, platform) {
|
|
98
|
-
super();
|
|
99
|
-
this.select = select;
|
|
100
|
-
this.platform = platform;
|
|
101
|
-
this._selectDefaultSettings = {
|
|
102
|
-
horizontalDirection: HorizontalAlignment.Right,
|
|
103
|
-
verticalDirection: VerticalAlignment.Bottom,
|
|
104
|
-
horizontalStartPoint: HorizontalAlignment.Left,
|
|
105
|
-
verticalStartPoint: VerticalAlignment.Top,
|
|
106
|
-
openAnimation: fadeIn,
|
|
107
|
-
closeAnimation: fadeOut
|
|
108
|
-
};
|
|
109
|
-
// Global variables required for cases of !initialCall (page scroll/overlay repositionAll)
|
|
110
|
-
this.global_yOffset = 0;
|
|
111
|
-
this.global_xOffset = 0;
|
|
112
|
-
this.global_styles = {};
|
|
113
|
-
this.settings = Object.assign({}, this._selectDefaultSettings, settings);
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Position the element based on the PositionStrategy implementing this interface.
|
|
117
|
-
*
|
|
118
|
-
* @param contentElement The HTML element to be positioned
|
|
119
|
-
* @param size Size of the element
|
|
120
|
-
* @param document reference to the Document object
|
|
121
|
-
* @param initialCall should be true if this is the initial call to the method
|
|
122
|
-
* @param target attaching target for the component to show
|
|
123
|
-
* ```typescript
|
|
124
|
-
* settings.positionStrategy.position(content, size, document, true);
|
|
125
|
-
* ```
|
|
126
|
-
*/
|
|
127
|
-
position(contentElement, _size, document, initialCall, target) {
|
|
128
|
-
const targetElement = target;
|
|
129
|
-
const rects = super.calculateElementRectangles(contentElement, targetElement);
|
|
130
|
-
// selectFit obj, to be used for both cases of initialCall and !initialCall(page scroll/overlay repositionAll)
|
|
131
|
-
const selectFit = {
|
|
132
|
-
verticalOffset: this.global_yOffset,
|
|
133
|
-
horizontalOffset: this.global_xOffset,
|
|
134
|
-
targetRect: rects.targetRect,
|
|
135
|
-
contentElementRect: rects.elementRect,
|
|
136
|
-
styles: this.global_styles,
|
|
137
|
-
scrollContainer: this.select.scrollContainer,
|
|
138
|
-
scrollContainerRect: this.select.scrollContainer.getBoundingClientRect()
|
|
139
|
-
};
|
|
140
|
-
if (initialCall) {
|
|
141
|
-
this.select.scrollContainer.scrollTop = 0;
|
|
142
|
-
// Fill in the required selectFit object properties.
|
|
143
|
-
selectFit.viewPortRect = Util.getViewportRect(document);
|
|
144
|
-
selectFit.itemElement = this.getInteractionItemElement();
|
|
145
|
-
selectFit.itemRect = selectFit.itemElement.getBoundingClientRect();
|
|
146
|
-
// Calculate input and selected item elements style related variables
|
|
147
|
-
selectFit.styles = this.calculateStyles(selectFit, targetElement);
|
|
148
|
-
selectFit.scrollAmount = this.calculateScrollAmount(selectFit);
|
|
149
|
-
// Calculate how much to offset the overlay container.
|
|
150
|
-
this.calculateYoffset(selectFit);
|
|
151
|
-
this.calculateXoffset(selectFit);
|
|
152
|
-
super.updateViewPortFit(selectFit);
|
|
153
|
-
// container does not fit in viewPort and is out on Top or Bottom
|
|
154
|
-
if (selectFit.fitVertical.back < 0 || selectFit.fitVertical.forward < 0) {
|
|
155
|
-
this.fitInViewport(contentElement, selectFit);
|
|
156
|
-
}
|
|
157
|
-
// Calculate scrollTop independently of the dropdown, as we cover all `igsSelect` specific positioning and
|
|
158
|
-
// scrolling to selected item scenarios here.
|
|
159
|
-
this.select.scrollContainer.scrollTop = selectFit.scrollAmount;
|
|
160
|
-
}
|
|
161
|
-
this.setStyles(contentElement, selectFit);
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Obtain the selected item if there is such one or otherwise use the first one
|
|
165
|
-
*/
|
|
166
|
-
getInteractionItemElement() {
|
|
167
|
-
let itemElement;
|
|
168
|
-
if (this.select.selectedItem) {
|
|
169
|
-
itemElement = this.select.selectedItem.element.nativeElement;
|
|
170
|
-
}
|
|
171
|
-
else {
|
|
172
|
-
itemElement = this.select.getFirstItemElement();
|
|
173
|
-
}
|
|
174
|
-
return itemElement;
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Position the items outer container so selected item text is positioned over input text and if header
|
|
178
|
-
* And/OR footer - both header/footer are visible
|
|
179
|
-
*
|
|
180
|
-
* @param selectFit selectFit to use for computation.
|
|
181
|
-
*/
|
|
182
|
-
fitInViewport(_contentElement, selectFit) {
|
|
183
|
-
const footer = selectFit.scrollContainerRect.bottom - selectFit.contentElementRect.bottom;
|
|
184
|
-
const header = selectFit.scrollContainerRect.top - selectFit.contentElementRect.top;
|
|
185
|
-
const lastItemFitSize = selectFit.targetRect.bottom + selectFit.styles.itemTextToInputTextDiff - footer;
|
|
186
|
-
const firstItemFitSize = selectFit.targetRect.top - selectFit.styles.itemTextToInputTextDiff - header;
|
|
187
|
-
// out of viewPort on Top
|
|
188
|
-
if (selectFit.fitVertical.back < 0) {
|
|
189
|
-
const possibleScrollAmount = selectFit.scrollContainer.scrollHeight -
|
|
190
|
-
selectFit.scrollContainerRect.height - selectFit.scrollAmount;
|
|
191
|
-
if (possibleScrollAmount + selectFit.fitVertical.back > 0 && firstItemFitSize > selectFit.viewPortRect.top) {
|
|
192
|
-
selectFit.scrollAmount -= selectFit.fitVertical.back;
|
|
193
|
-
selectFit.verticalOffset -= selectFit.fitVertical.back;
|
|
194
|
-
this.global_yOffset = selectFit.verticalOffset;
|
|
195
|
-
}
|
|
196
|
-
else {
|
|
197
|
-
selectFit.verticalOffset = 0;
|
|
198
|
-
this.global_yOffset = 0;
|
|
199
|
-
}
|
|
200
|
-
// out of viewPort on Bottom
|
|
201
|
-
}
|
|
202
|
-
else if (selectFit.fitVertical.forward < 0) {
|
|
203
|
-
if (selectFit.scrollAmount + selectFit.fitVertical.forward > 0 && lastItemFitSize < selectFit.viewPortRect.bottom) {
|
|
204
|
-
selectFit.scrollAmount += selectFit.fitVertical.forward;
|
|
205
|
-
selectFit.verticalOffset += selectFit.fitVertical.forward;
|
|
206
|
-
this.global_yOffset = selectFit.verticalOffset;
|
|
207
|
-
}
|
|
208
|
-
else {
|
|
209
|
-
selectFit.verticalOffset = -selectFit.contentElementRect.height + selectFit.targetRect.height;
|
|
210
|
-
this.global_yOffset = selectFit.verticalOffset;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* Sets element's style which effectively positions the provided element
|
|
216
|
-
*
|
|
217
|
-
* @param element Element to position
|
|
218
|
-
* @param selectFit selectFit to use for computation.
|
|
219
|
-
* @param initialCall should be true if this is the initial call to the position method calling setStyles
|
|
220
|
-
*/
|
|
221
|
-
setStyles(contentElement, selectFit) {
|
|
222
|
-
super.setStyle(contentElement, selectFit.targetRect, selectFit.contentElementRect, selectFit);
|
|
223
|
-
contentElement.style.width = `${selectFit.styles.contentElementNewWidth}px`; // manage container based on paddings?
|
|
224
|
-
this.global_styles.contentElementNewWidth = selectFit.styles.contentElementNewWidth;
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Calculate selected item scroll position.
|
|
228
|
-
*/
|
|
229
|
-
calculateScrollAmount(selectFit) {
|
|
230
|
-
const itemElementRect = selectFit.itemRect;
|
|
231
|
-
const scrollContainer = selectFit.scrollContainer;
|
|
232
|
-
const scrollContainerRect = selectFit.scrollContainerRect;
|
|
233
|
-
const scrollDelta = scrollContainerRect.top - itemElementRect.top;
|
|
234
|
-
let scrollPosition = scrollContainer.scrollTop - scrollDelta;
|
|
235
|
-
const dropDownHeight = scrollContainer.clientHeight;
|
|
236
|
-
scrollPosition -= dropDownHeight / 2;
|
|
237
|
-
scrollPosition += itemElementRect.height / 2;
|
|
238
|
-
return Math.round(Math.min(Math.max(0, scrollPosition), scrollContainer.scrollHeight - scrollContainerRect.height));
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Calculate the necessary input and selected item styles to be used for positioning item text over input text.
|
|
242
|
-
* Calculate & Set default items container width.
|
|
243
|
-
*
|
|
244
|
-
* @param selectFit selectFit to use for computation.
|
|
245
|
-
*/
|
|
246
|
-
calculateStyles(selectFit, target) {
|
|
247
|
-
const styles = {};
|
|
248
|
-
const inputElementStyles = window.getComputedStyle(target);
|
|
249
|
-
const itemElementStyles = window.getComputedStyle(selectFit.itemElement);
|
|
250
|
-
const numericInputFontSize = parseFloat(inputElementStyles.fontSize);
|
|
251
|
-
const numericInputPaddingTop = parseFloat(inputElementStyles.paddingTop);
|
|
252
|
-
const numericInputPaddingBottom = parseFloat(inputElementStyles.paddingBottom);
|
|
253
|
-
const numericItemFontSize = parseFloat(itemElementStyles.fontSize);
|
|
254
|
-
const inputTextToInputTop = ((selectFit.targetRect.bottom - numericInputPaddingBottom)
|
|
255
|
-
- (selectFit.targetRect.top + numericInputPaddingTop) - numericInputFontSize) / 2;
|
|
256
|
-
const itemTextToItemTop = (selectFit.itemRect.height - numericItemFontSize) / 2;
|
|
257
|
-
styles.itemTextToInputTextDiff = Math.round(itemTextToItemTop - inputTextToInputTop - numericInputPaddingTop);
|
|
258
|
-
const numericLeftPadding = parseFloat(itemElementStyles.paddingLeft);
|
|
259
|
-
const numericTextIndent = parseFloat(itemElementStyles.textIndent);
|
|
260
|
-
styles.itemTextPadding = numericLeftPadding;
|
|
261
|
-
styles.itemTextIndent = numericTextIndent;
|
|
262
|
-
// 24 is the input's toggle ddl icon width
|
|
263
|
-
styles.contentElementNewWidth = selectFit.targetRect.width + 24 + numericLeftPadding * 2;
|
|
264
|
-
return styles;
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Calculate how much to offset the overlay container for Y-axis.
|
|
268
|
-
*/
|
|
269
|
-
calculateYoffset(selectFit) {
|
|
270
|
-
selectFit.verticalOffset = -(selectFit.itemRect.top - selectFit.contentElementRect.top +
|
|
271
|
-
selectFit.styles.itemTextToInputTextDiff - selectFit.scrollAmount);
|
|
272
|
-
this.global_yOffset = selectFit.verticalOffset;
|
|
273
|
-
}
|
|
274
|
-
/**
|
|
275
|
-
* Calculate how much to offset the overlay container for X-axis.
|
|
276
|
-
*/
|
|
277
|
-
calculateXoffset(selectFit) {
|
|
278
|
-
selectFit.horizontalOffset = selectFit.styles.itemTextIndent - selectFit.styles.itemTextPadding;
|
|
279
|
-
this.global_xOffset = selectFit.horizontalOffset;
|
|
280
|
-
}
|
|
281
|
-
};
|
|
282
|
-
SelectPositioningStrategy = __decorate([
|
|
283
|
-
__param(2, Optional())
|
|
284
|
-
], SelectPositioningStrategy);
|
|
285
|
-
|
|
286
94
|
/** @hidden @internal */
|
|
287
95
|
class IgxSelectItemNavigationDirective extends IgxDropDownItemNavigationDirective {
|
|
288
96
|
constructor() {
|
|
@@ -602,13 +410,13 @@ class IgxSelectComponent extends IgxDropDownComponent {
|
|
|
602
410
|
}
|
|
603
411
|
/**
|
|
604
412
|
* Sets how the select will be styled.
|
|
605
|
-
* The allowed values are `line`, `box` and `border`.
|
|
413
|
+
* The allowed values are `line`, `box` and `border`. Defaults to `box` if no input-group type is set.
|
|
606
414
|
* ```html
|
|
607
|
-
* <igx-select [type]="'
|
|
415
|
+
* <igx-select [type]="'border'"></igx-select>
|
|
608
416
|
* ```
|
|
609
417
|
*/
|
|
610
418
|
get type() {
|
|
611
|
-
return this._type || this._inputGroupType || '
|
|
419
|
+
return this._type || this._inputGroupType || 'box';
|
|
612
420
|
}
|
|
613
421
|
set type(val) {
|
|
614
422
|
this._type = val;
|
|
@@ -680,24 +488,17 @@ class IgxSelectComponent extends IgxDropDownComponent {
|
|
|
680
488
|
if (!this.selectedItem) {
|
|
681
489
|
this.navigateFirst();
|
|
682
490
|
}
|
|
683
|
-
super.open(
|
|
491
|
+
super.open(this.getMergedOverlaySettings(overlaySettings));
|
|
684
492
|
}
|
|
685
493
|
inputGroupClick(event, overlaySettings) {
|
|
686
494
|
const targetElement = event.target;
|
|
687
495
|
if (this.hintElement && targetElement.contains(this.hintElement.nativeElement)) {
|
|
688
496
|
return;
|
|
689
497
|
}
|
|
690
|
-
this.toggle(
|
|
498
|
+
this.toggle(this.getMergedOverlaySettings(overlaySettings));
|
|
691
499
|
}
|
|
692
500
|
/** @hidden @internal */
|
|
693
501
|
ngAfterContentInit() {
|
|
694
|
-
this._overlayDefaults = {
|
|
695
|
-
target: this.getEditElement(),
|
|
696
|
-
modal: false,
|
|
697
|
-
positionStrategy: new SelectPositioningStrategy(this),
|
|
698
|
-
scrollStrategy: new AbsoluteScrollStrategy(),
|
|
699
|
-
excludeFromOutsideClick: [this.inputGroup.element.nativeElement]
|
|
700
|
-
};
|
|
701
502
|
const changes$ = this.children.changes.pipe(takeUntil(this.destroy$)).subscribe(() => {
|
|
702
503
|
this.setSelection(this.items.find(x => x.value === this.value));
|
|
703
504
|
this.cdr.detectChanges();
|
|
@@ -724,7 +525,7 @@ class IgxSelectComponent extends IgxDropDownComponent {
|
|
|
724
525
|
/** @hidden @internal */
|
|
725
526
|
onToggleContentAppended(event) {
|
|
726
527
|
const info = this.overlayService.getOverlayById(event.id);
|
|
727
|
-
if (info?.settings?.positionStrategy
|
|
528
|
+
if (info?.settings?.positionStrategy?.isItemOverlapPositioning) {
|
|
728
529
|
return;
|
|
729
530
|
}
|
|
730
531
|
super.onToggleContentAppended(event);
|
|
@@ -774,6 +575,14 @@ class IgxSelectComponent extends IgxDropDownComponent {
|
|
|
774
575
|
this.ngControl.statusChanges.pipe(takeUntil(this.destroy$)).subscribe(this.onStatusChanged.bind(this));
|
|
775
576
|
this.manageRequiredAsterisk();
|
|
776
577
|
}
|
|
578
|
+
const targetElement = this.inputGroup.element.nativeElement.querySelector('.igx-input-group__bundle');
|
|
579
|
+
this._overlayDefaults = {
|
|
580
|
+
target: targetElement,
|
|
581
|
+
modal: false,
|
|
582
|
+
positionStrategy: new AutoPositionStrategy(),
|
|
583
|
+
scrollStrategy: new AbsoluteScrollStrategy(),
|
|
584
|
+
excludeFromOutsideClick: [targetElement]
|
|
585
|
+
};
|
|
777
586
|
this.cdr.detectChanges();
|
|
778
587
|
}
|
|
779
588
|
/** @hidden @internal */
|
|
@@ -847,6 +656,13 @@ class IgxSelectComponent extends IgxDropDownComponent {
|
|
|
847
656
|
}
|
|
848
657
|
this.cdr.markForCheck();
|
|
849
658
|
}
|
|
659
|
+
getMergedOverlaySettings(overlaySettings) {
|
|
660
|
+
const merged = Object.assign({}, this._overlayDefaults, this.overlaySettings, overlaySettings);
|
|
661
|
+
if (merged.positionStrategy?.isItemOverlapPositioning) {
|
|
662
|
+
merged.target = this.getEditElement();
|
|
663
|
+
}
|
|
664
|
+
return merged;
|
|
665
|
+
}
|
|
850
666
|
setSelection(item) {
|
|
851
667
|
if (item && item.value !== undefined && item.value !== null) {
|
|
852
668
|
this.selection.set(this.id, new Set([item]));
|
|
@@ -924,6 +740,198 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImpor
|
|
|
924
740
|
type: Input
|
|
925
741
|
}] } });
|
|
926
742
|
|
|
743
|
+
/**
|
|
744
|
+
* Positions the select dropdown so that the active item's text overlaps
|
|
745
|
+
* the value displayed in the select input box.
|
|
746
|
+
*/
|
|
747
|
+
class IgxSelectOverlapPositionStrategy extends BaseFitPositionStrategy {
|
|
748
|
+
constructor(select, settings) {
|
|
749
|
+
super();
|
|
750
|
+
this.select = select;
|
|
751
|
+
this._selectDefaultSettings = {
|
|
752
|
+
horizontalDirection: HorizontalAlignment.Right,
|
|
753
|
+
verticalDirection: VerticalAlignment.Bottom,
|
|
754
|
+
horizontalStartPoint: HorizontalAlignment.Left,
|
|
755
|
+
verticalStartPoint: VerticalAlignment.Top,
|
|
756
|
+
openAnimation: fadeIn,
|
|
757
|
+
closeAnimation: fadeOut
|
|
758
|
+
};
|
|
759
|
+
// Global variables required for cases of !initialCall (page scroll/overlay repositionAll)
|
|
760
|
+
this.global_yOffset = 0;
|
|
761
|
+
this.global_xOffset = 0;
|
|
762
|
+
this.global_styles = {};
|
|
763
|
+
/** @hidden @internal */
|
|
764
|
+
this.isItemOverlapPositioning = true;
|
|
765
|
+
this.settings = Object.assign({}, this._selectDefaultSettings, settings);
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* Position the element based on the PositionStrategy implementing this interface.
|
|
769
|
+
*
|
|
770
|
+
* @param contentElement The HTML element to be positioned
|
|
771
|
+
* @param size Size of the element
|
|
772
|
+
* @param document reference to the Document object
|
|
773
|
+
* @param initialCall should be true if this is the initial call to the method
|
|
774
|
+
* @param target attaching target for the component to show
|
|
775
|
+
* ```typescript
|
|
776
|
+
* settings.positionStrategy.position(content, size, document, true);
|
|
777
|
+
* ```
|
|
778
|
+
*/
|
|
779
|
+
position(contentElement, _size, document, initialCall, target) {
|
|
780
|
+
const targetElement = target;
|
|
781
|
+
const rects = super.calculateElementRectangles(contentElement, targetElement);
|
|
782
|
+
// selectFit obj, to be used for both cases of initialCall and !initialCall(page scroll/overlay repositionAll)
|
|
783
|
+
const selectFit = {
|
|
784
|
+
verticalOffset: this.global_yOffset,
|
|
785
|
+
horizontalOffset: this.global_xOffset,
|
|
786
|
+
targetRect: rects.targetRect,
|
|
787
|
+
contentElementRect: rects.elementRect,
|
|
788
|
+
styles: this.global_styles,
|
|
789
|
+
scrollContainer: this.select.scrollContainer,
|
|
790
|
+
scrollContainerRect: this.select.scrollContainer.getBoundingClientRect()
|
|
791
|
+
};
|
|
792
|
+
if (initialCall) {
|
|
793
|
+
this.select.scrollContainer.scrollTop = 0;
|
|
794
|
+
// Fill in the required selectFit object properties.
|
|
795
|
+
selectFit.viewPortRect = Util.getViewportRect(document);
|
|
796
|
+
selectFit.itemElement = this.getInteractionItemElement();
|
|
797
|
+
selectFit.itemRect = selectFit.itemElement.getBoundingClientRect();
|
|
798
|
+
// Calculate input and selected item elements style related variables
|
|
799
|
+
selectFit.styles = this.calculateStyles(selectFit, targetElement);
|
|
800
|
+
selectFit.scrollAmount = this.calculateScrollAmount(selectFit);
|
|
801
|
+
// Calculate how much to offset the overlay container.
|
|
802
|
+
this.calculateYoffset(selectFit);
|
|
803
|
+
this.calculateXoffset(selectFit);
|
|
804
|
+
super.updateViewPortFit(selectFit);
|
|
805
|
+
// container does not fit in viewPort and is out on Top or Bottom
|
|
806
|
+
if (selectFit.fitVertical.back < 0 || selectFit.fitVertical.forward < 0) {
|
|
807
|
+
this.fitInViewport(contentElement, selectFit);
|
|
808
|
+
}
|
|
809
|
+
// Calculate scrollTop independently of the dropdown, as we cover all `igsSelect` specific positioning and
|
|
810
|
+
// scrolling to selected item scenarios here.
|
|
811
|
+
this.select.scrollContainer.scrollTop = selectFit.scrollAmount;
|
|
812
|
+
}
|
|
813
|
+
this.setStyles(contentElement, selectFit);
|
|
814
|
+
}
|
|
815
|
+
/**
|
|
816
|
+
* Obtain the selected item if there is such one or otherwise use the first one
|
|
817
|
+
*/
|
|
818
|
+
getInteractionItemElement() {
|
|
819
|
+
let itemElement;
|
|
820
|
+
if (this.select.selectedItem) {
|
|
821
|
+
itemElement = this.select.selectedItem.element.nativeElement;
|
|
822
|
+
}
|
|
823
|
+
else {
|
|
824
|
+
itemElement = this.select.getFirstItemElement();
|
|
825
|
+
}
|
|
826
|
+
return itemElement;
|
|
827
|
+
}
|
|
828
|
+
/**
|
|
829
|
+
* Position the items outer container so selected item text is positioned over input text and if header
|
|
830
|
+
* And/OR footer - both header/footer are visible
|
|
831
|
+
*
|
|
832
|
+
* @param selectFit selectFit to use for computation.
|
|
833
|
+
*/
|
|
834
|
+
fitInViewport(_contentElement, selectFit) {
|
|
835
|
+
const footer = selectFit.scrollContainerRect.bottom - selectFit.contentElementRect.bottom;
|
|
836
|
+
const header = selectFit.scrollContainerRect.top - selectFit.contentElementRect.top;
|
|
837
|
+
const lastItemFitSize = selectFit.targetRect.bottom + selectFit.styles.itemTextToInputTextDiff - footer;
|
|
838
|
+
const firstItemFitSize = selectFit.targetRect.top - selectFit.styles.itemTextToInputTextDiff - header;
|
|
839
|
+
// out of viewPort on Top
|
|
840
|
+
if (selectFit.fitVertical.back < 0) {
|
|
841
|
+
const possibleScrollAmount = selectFit.scrollContainer.scrollHeight -
|
|
842
|
+
selectFit.scrollContainerRect.height - selectFit.scrollAmount;
|
|
843
|
+
if (possibleScrollAmount + selectFit.fitVertical.back > 0 && firstItemFitSize > selectFit.viewPortRect.top) {
|
|
844
|
+
selectFit.scrollAmount -= selectFit.fitVertical.back;
|
|
845
|
+
selectFit.verticalOffset -= selectFit.fitVertical.back;
|
|
846
|
+
this.global_yOffset = selectFit.verticalOffset;
|
|
847
|
+
}
|
|
848
|
+
else {
|
|
849
|
+
selectFit.verticalOffset = 0;
|
|
850
|
+
this.global_yOffset = 0;
|
|
851
|
+
}
|
|
852
|
+
// out of viewPort on Bottom
|
|
853
|
+
}
|
|
854
|
+
else if (selectFit.fitVertical.forward < 0) {
|
|
855
|
+
if (selectFit.scrollAmount + selectFit.fitVertical.forward > 0 && lastItemFitSize < selectFit.viewPortRect.bottom) {
|
|
856
|
+
selectFit.scrollAmount += selectFit.fitVertical.forward;
|
|
857
|
+
selectFit.verticalOffset += selectFit.fitVertical.forward;
|
|
858
|
+
this.global_yOffset = selectFit.verticalOffset;
|
|
859
|
+
}
|
|
860
|
+
else {
|
|
861
|
+
selectFit.verticalOffset = -selectFit.contentElementRect.height + selectFit.targetRect.height;
|
|
862
|
+
this.global_yOffset = selectFit.verticalOffset;
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* Sets element's style which effectively positions the provided element
|
|
868
|
+
*
|
|
869
|
+
* @param element Element to position
|
|
870
|
+
* @param selectFit selectFit to use for computation.
|
|
871
|
+
* @param initialCall should be true if this is the initial call to the position method calling setStyles
|
|
872
|
+
*/
|
|
873
|
+
setStyles(contentElement, selectFit) {
|
|
874
|
+
super.setStyle(contentElement, selectFit.targetRect, selectFit.contentElementRect, selectFit);
|
|
875
|
+
contentElement.style.width = `${selectFit.styles.contentElementNewWidth}px`; // manage container based on paddings?
|
|
876
|
+
this.global_styles.contentElementNewWidth = selectFit.styles.contentElementNewWidth;
|
|
877
|
+
}
|
|
878
|
+
/**
|
|
879
|
+
* Calculate selected item scroll position.
|
|
880
|
+
*/
|
|
881
|
+
calculateScrollAmount(selectFit) {
|
|
882
|
+
const itemElementRect = selectFit.itemRect;
|
|
883
|
+
const scrollContainer = selectFit.scrollContainer;
|
|
884
|
+
const scrollContainerRect = selectFit.scrollContainerRect;
|
|
885
|
+
const scrollDelta = scrollContainerRect.top - itemElementRect.top;
|
|
886
|
+
let scrollPosition = scrollContainer.scrollTop - scrollDelta;
|
|
887
|
+
const dropDownHeight = scrollContainer.clientHeight;
|
|
888
|
+
scrollPosition -= dropDownHeight / 2;
|
|
889
|
+
scrollPosition += itemElementRect.height / 2;
|
|
890
|
+
return Math.round(Math.min(Math.max(0, scrollPosition), scrollContainer.scrollHeight - scrollContainerRect.height));
|
|
891
|
+
}
|
|
892
|
+
/**
|
|
893
|
+
* Calculate the necessary input and selected item styles to be used for positioning item text over input text.
|
|
894
|
+
* Calculate & Set default items container width.
|
|
895
|
+
*
|
|
896
|
+
* @param selectFit selectFit to use for computation.
|
|
897
|
+
*/
|
|
898
|
+
calculateStyles(selectFit, target) {
|
|
899
|
+
const styles = {};
|
|
900
|
+
const inputElementStyles = window.getComputedStyle(target);
|
|
901
|
+
const itemElementStyles = window.getComputedStyle(selectFit.itemElement);
|
|
902
|
+
const numericInputFontSize = parseFloat(inputElementStyles.fontSize);
|
|
903
|
+
const numericInputPaddingTop = parseFloat(inputElementStyles.paddingTop);
|
|
904
|
+
const numericInputPaddingBottom = parseFloat(inputElementStyles.paddingBottom);
|
|
905
|
+
const numericItemFontSize = parseFloat(itemElementStyles.fontSize);
|
|
906
|
+
const inputTextToInputTop = ((selectFit.targetRect.bottom - numericInputPaddingBottom)
|
|
907
|
+
- (selectFit.targetRect.top + numericInputPaddingTop) - numericInputFontSize) / 2;
|
|
908
|
+
const itemTextToItemTop = (selectFit.itemRect.height - numericItemFontSize) / 2;
|
|
909
|
+
styles.itemTextToInputTextDiff = Math.round(itemTextToItemTop - inputTextToInputTop - numericInputPaddingTop);
|
|
910
|
+
const numericLeftPadding = parseFloat(itemElementStyles.paddingLeft);
|
|
911
|
+
const numericTextIndent = parseFloat(itemElementStyles.textIndent);
|
|
912
|
+
styles.itemTextPadding = numericLeftPadding;
|
|
913
|
+
styles.itemTextIndent = numericTextIndent;
|
|
914
|
+
// 24 is the input's toggle ddl icon width
|
|
915
|
+
styles.contentElementNewWidth = selectFit.targetRect.width + 24 + numericLeftPadding * 2;
|
|
916
|
+
return styles;
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* Calculate how much to offset the overlay container for Y-axis.
|
|
920
|
+
*/
|
|
921
|
+
calculateYoffset(selectFit) {
|
|
922
|
+
selectFit.verticalOffset = -(selectFit.itemRect.top - selectFit.contentElementRect.top +
|
|
923
|
+
selectFit.styles.itemTextToInputTextDiff - selectFit.scrollAmount);
|
|
924
|
+
this.global_yOffset = selectFit.verticalOffset;
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* Calculate how much to offset the overlay container for X-axis.
|
|
928
|
+
*/
|
|
929
|
+
calculateXoffset(selectFit) {
|
|
930
|
+
selectFit.horizontalOffset = selectFit.styles.itemTextIndent - selectFit.styles.itemTextPadding;
|
|
931
|
+
this.global_xOffset = selectFit.horizontalOffset;
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
|
|
927
935
|
/* NOTE: Select directives collection for ease-of-use import in standalone components scenario */
|
|
928
936
|
const IGX_SELECT_DIRECTIVES = [
|
|
929
937
|
IgxSelectComponent,
|
|
@@ -964,5 +972,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImpor
|
|
|
964
972
|
* Generated bundle index. Do not edit.
|
|
965
973
|
*/
|
|
966
974
|
|
|
967
|
-
export { IGX_SELECT_DIRECTIVES, IgxSelectComponent, IgxSelectFooterDirective, IgxSelectGroupComponent, IgxSelectHeaderDirective, IgxSelectItemComponent, IgxSelectModule, IgxSelectToggleIconDirective };
|
|
975
|
+
export { IGX_SELECT_DIRECTIVES, IgxSelectComponent, IgxSelectFooterDirective, IgxSelectGroupComponent, IgxSelectHeaderDirective, IgxSelectItemComponent, IgxSelectModule, IgxSelectOverlapPositionStrategy, IgxSelectToggleIconDirective };
|
|
968
976
|
//# sourceMappingURL=igniteui-angular-select.mjs.map
|