@ieeesa-npm/presentation 0.33.19 → 0.33.20
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/esm2022/lib/assets/constants.json +1 -1
- package/esm2022/lib/components/autocomplete/autocomplete.component.mjs +19 -54
- package/esm2022/lib/components/date-picker/date-picker.component.mjs +17 -34
- package/esm2022/lib/components/dynamic-form/dynamic-form.component.mjs +3 -3
- package/esm2022/lib/components/select/select.component.mjs +77 -46
- package/esm2022/lib/components/time-picker/time-picker.component.mjs +21 -36
- package/esm2022/lib/services/form-overlay-bounds.service.mjs +175 -0
- package/esm2022/public-api.mjs +2 -1
- package/fesm2022/ieeesa-npm-presentation.mjs +316 -183
- package/fesm2022/ieeesa-npm-presentation.mjs.map +1 -1
- package/lib/components/autocomplete/autocomplete.component.d.ts +3 -3
- package/lib/components/date-picker/date-picker.component.d.ts +3 -1
- package/lib/components/select/select.component.d.ts +20 -1
- package/lib/components/time-picker/time-picker.component.d.ts +3 -1
- package/lib/services/form-overlay-bounds.service.d.ts +85 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
- package/src/lib/assets/constants.json +1 -1
|
@@ -6,6 +6,7 @@ import { FormField } from '../../models/form-field.model';
|
|
|
6
6
|
import { AutoCompleteOption } from '../../models/autocomplete-option.model';
|
|
7
7
|
import { SelectOption } from '@ieeesa-npm/models';
|
|
8
8
|
import { FormUtilityService } from '../../services/form-utility.service';
|
|
9
|
+
import { FormOverlayBoundsService } from '../../services/form-overlay-bounds.service';
|
|
9
10
|
import * as i0 from "@angular/core";
|
|
10
11
|
/**
|
|
11
12
|
* Provides auto suggestion for the entered input by filtering the options from the given list of options.
|
|
@@ -17,6 +18,7 @@ import * as i0 from "@angular/core";
|
|
|
17
18
|
*/
|
|
18
19
|
export declare class AutocompleteComponent implements OnInit, FormField, OnDestroy, AfterViewInit {
|
|
19
20
|
private formUtilityService;
|
|
21
|
+
private formOverlayBounds;
|
|
20
22
|
private elementRef;
|
|
21
23
|
config: FieldConfig;
|
|
22
24
|
group: FormGroup;
|
|
@@ -31,11 +33,10 @@ export declare class AutocompleteComponent implements OnInit, FormField, OnDestr
|
|
|
31
33
|
autoComplete: ElementRef;
|
|
32
34
|
destroy$: Subject<boolean>;
|
|
33
35
|
autocompleteConstInfo: any;
|
|
34
|
-
constructor(formUtilityService: FormUtilityService, elementRef: ElementRef<HTMLElement>);
|
|
36
|
+
constructor(formUtilityService: FormUtilityService, formOverlayBounds: FormOverlayBoundsService, elementRef: ElementRef<HTMLElement>);
|
|
35
37
|
private formOverlayScrollContainer?;
|
|
36
38
|
private readonly preferredAutocompleteOverlayHeight;
|
|
37
39
|
private readonly overlayWheelListener;
|
|
38
|
-
private readonly formScrollListener;
|
|
39
40
|
/**
|
|
40
41
|
* Implementation of ngOnInit lifecycle hook method to initialize components instance properties.
|
|
41
42
|
* @memberof AutocompleteComponent
|
|
@@ -82,7 +83,6 @@ export declare class AutocompleteComponent implements OnInit, FormField, OnDestr
|
|
|
82
83
|
onAutocompleteClose(): void;
|
|
83
84
|
private setOverlayClipBounds;
|
|
84
85
|
private getFormOverlayScrollContainer;
|
|
85
|
-
private updateOverlayClipBounds;
|
|
86
86
|
private makeRoomForAutocompleteOverlay;
|
|
87
87
|
private clearOverlayClipBounds;
|
|
88
88
|
static ɵfac: i0.ɵɵFactoryDeclaration<AutocompleteComponent, never>;
|
|
@@ -7,6 +7,7 @@ import { CalendarType } from '../../models/calendar.model';
|
|
|
7
7
|
import { DatepickerService } from '../../services/datepicker.service';
|
|
8
8
|
import { FormField } from '../../models/form-field.model';
|
|
9
9
|
import { FormUtilityService } from '../../services/form-utility.service';
|
|
10
|
+
import { FormOverlayBoundsService } from '../../services/form-overlay-bounds.service';
|
|
10
11
|
import { SelectedDate } from '../../models/selected-date.model';
|
|
11
12
|
import * as i0 from "@angular/core";
|
|
12
13
|
export declare class CustomDateAdapter extends MomentDateAdapter {
|
|
@@ -32,6 +33,7 @@ export declare class DatePickerComponent implements FormField, OnInit, OnDestroy
|
|
|
32
33
|
private changeDetectorRef;
|
|
33
34
|
private datepickerService;
|
|
34
35
|
private formUtilityService;
|
|
36
|
+
private formOverlayBounds;
|
|
35
37
|
private elementRef;
|
|
36
38
|
config: FieldConfig;
|
|
37
39
|
group: FormGroup;
|
|
@@ -84,7 +86,7 @@ export declare class DatePickerComponent implements FormField, OnInit, OnDestroy
|
|
|
84
86
|
buttonActionsInfo: any;
|
|
85
87
|
private formOverlayScrollContainer?;
|
|
86
88
|
private readonly overlayWheelListener;
|
|
87
|
-
constructor(fb: FormBuilder, changeDetectorRef: ChangeDetectorRef, datepickerService: DatepickerService, formUtilityService: FormUtilityService, elementRef: ElementRef<HTMLElement>);
|
|
89
|
+
constructor(fb: FormBuilder, changeDetectorRef: ChangeDetectorRef, datepickerService: DatepickerService, formUtilityService: FormUtilityService, formOverlayBounds: FormOverlayBoundsService, elementRef: ElementRef<HTMLElement>);
|
|
88
90
|
/**
|
|
89
91
|
* Implementation of ngOnInit lifecycle hook method to creates config if its undefined and sets components instance variables if config is defined. Sets the form group value if form group is defined.
|
|
90
92
|
* @memberof DatePickerComponent
|
|
@@ -5,6 +5,7 @@ import { FieldConfig } from '../../models/field-config.model';
|
|
|
5
5
|
import { SearchType } from '../../models/search.model';
|
|
6
6
|
import { SearchComponent } from '../../components/search/search.component';
|
|
7
7
|
import { FormUtilityService } from '../../services/form-utility.service';
|
|
8
|
+
import { FormOverlayBoundsService } from '../../services/form-overlay-bounds.service';
|
|
8
9
|
import { SelectOpenedState } from '../../models/select-opened-state.model';
|
|
9
10
|
import * as i0 from "@angular/core";
|
|
10
11
|
/**
|
|
@@ -17,6 +18,7 @@ import * as i0 from "@angular/core";
|
|
|
17
18
|
*/
|
|
18
19
|
export declare class SelectComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
19
20
|
private formUtilityService;
|
|
21
|
+
private formOverlayBounds;
|
|
20
22
|
private elementRef;
|
|
21
23
|
formFields: QueryList<SearchComponent>;
|
|
22
24
|
group: FormGroup;
|
|
@@ -30,7 +32,10 @@ export declare class SelectComponent implements OnInit, AfterViewInit, OnDestroy
|
|
|
30
32
|
private _isSortNeeded;
|
|
31
33
|
private unsortedDropdownOptions;
|
|
32
34
|
private formOverlayScrollContainer?;
|
|
35
|
+
private isTopSelectPanelPinned;
|
|
36
|
+
private pinnedPanelMaxHeight;
|
|
33
37
|
private readonly overlayWheelListener;
|
|
38
|
+
private readonly repositionPinnedPanel;
|
|
34
39
|
/**
|
|
35
40
|
* Takes isSortNeeded as input to check if the passed options are sorted or not.
|
|
36
41
|
* @memberof SelectComponent
|
|
@@ -60,7 +65,7 @@ export declare class SelectComponent implements OnInit, AfterViewInit, OnDestroy
|
|
|
60
65
|
optionSelected: EventEmitter<SelectOption>;
|
|
61
66
|
optionSearched: EventEmitter<string>;
|
|
62
67
|
dropdownOpenedChange: EventEmitter<SelectOpenedState>;
|
|
63
|
-
constructor(formUtilityService: FormUtilityService, elementRef: ElementRef<HTMLElement>);
|
|
68
|
+
constructor(formUtilityService: FormUtilityService, formOverlayBounds: FormOverlayBoundsService, elementRef: ElementRef<HTMLElement>);
|
|
64
69
|
/**
|
|
65
70
|
* Initializes components instance properties from config if its defined otherwise creates form group and config.
|
|
66
71
|
* @memberof SelectComponent
|
|
@@ -87,7 +92,21 @@ export declare class SelectComponent implements OnInit, AfterViewInit, OnDestroy
|
|
|
87
92
|
private setOverlayClipBounds;
|
|
88
93
|
private getFormOverlayScrollContainer;
|
|
89
94
|
private clearOverlayClipBounds;
|
|
95
|
+
/**
|
|
96
|
+
* Material flips the panel above its field when it will not fit below. Inside a
|
|
97
|
+
* form that pushes the panel over the form's heading and pinned tab strip, so
|
|
98
|
+
* when the field is near the top of the usable band the panel is forced back
|
|
99
|
+
* below the field and capped to the space left inside the band.
|
|
100
|
+
* @memberof SelectComponent
|
|
101
|
+
*/
|
|
90
102
|
private keepTopSelectPanelInsideFormBody;
|
|
103
|
+
/**
|
|
104
|
+
* Positions the pinned panel just below its field, recomputed from the current
|
|
105
|
+
* trigger and band so it tracks the field as the page/form scrolls instead of
|
|
106
|
+
* staying at a stale fixed offset.
|
|
107
|
+
* @memberof SelectComponent
|
|
108
|
+
*/
|
|
109
|
+
private pinTopSelectPanel;
|
|
91
110
|
/**
|
|
92
111
|
* Takes the index and the current option as arguments and needs to return the unique identifier for this option.
|
|
93
112
|
* @param {number} index
|
|
@@ -2,8 +2,10 @@ import { ElementRef, EventEmitter, OnDestroy } from '@angular/core';
|
|
|
2
2
|
import { FormGroup } from '@angular/forms';
|
|
3
3
|
import { FieldConfig } from '../../models/field-config.model';
|
|
4
4
|
import { SelectedTime } from '../../models/selected-time.model';
|
|
5
|
+
import { FormOverlayBoundsService } from '../../services/form-overlay-bounds.service';
|
|
5
6
|
import * as i0 from "@angular/core";
|
|
6
7
|
export declare class TimePickerComponent implements OnDestroy {
|
|
8
|
+
private formOverlayBounds;
|
|
7
9
|
private elementRef;
|
|
8
10
|
config: FieldConfig;
|
|
9
11
|
group: FormGroup;
|
|
@@ -12,7 +14,7 @@ export declare class TimePickerComponent implements OnDestroy {
|
|
|
12
14
|
picker: ElementRef;
|
|
13
15
|
private formOverlayScrollContainer?;
|
|
14
16
|
private readonly overlayWheelListener;
|
|
15
|
-
constructor(elementRef: ElementRef<HTMLElement>);
|
|
17
|
+
constructor(formOverlayBounds: FormOverlayBoundsService, elementRef: ElementRef<HTMLElement>);
|
|
16
18
|
/**
|
|
17
19
|
* Handles form time selection event
|
|
18
20
|
* @type {void}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
/**
|
|
3
|
+
* Keeps a field overlay — a select panel, autocomplete list, date picker or time
|
|
4
|
+
* picker — inside the bounds of the form it belongs to.
|
|
5
|
+
*
|
|
6
|
+
* Without this, the CDK positions these panels against the viewport, so a panel
|
|
7
|
+
* that cannot fit below its field flips upward and is drawn over the form's
|
|
8
|
+
* heading and pinned tab strip, visually escaping the form.
|
|
9
|
+
*
|
|
10
|
+
* Containment is expressed as a clip band published on the document element and
|
|
11
|
+
* consumed by each overlay's stylesheet:
|
|
12
|
+
* --ieeesa-form-overlay-clip-top distance from the viewport top to the band
|
|
13
|
+
* --ieeesa-form-overlay-clip-bottom distance from the band to the viewport bottom
|
|
14
|
+
* plus an `ieeesa-form-overlay-open` class that activates those rules.
|
|
15
|
+
*
|
|
16
|
+
* The band is the form's field area intersected with the space the form's own
|
|
17
|
+
* pinned chrome leaves free, so a panel never covers the tab strip / step header
|
|
18
|
+
* above it or the action bar below it. It is recalculated on scroll and resize:
|
|
19
|
+
* the form scrolls with the page, so a band measured only when the panel opened
|
|
20
|
+
* would drift and clip the panel away as the user scrolled.
|
|
21
|
+
* @export
|
|
22
|
+
* @class FormOverlayBoundsService
|
|
23
|
+
*/
|
|
24
|
+
export declare class FormOverlayBoundsService {
|
|
25
|
+
private static readonly OPEN_CLASS;
|
|
26
|
+
private static readonly CLIP_TOP_PROPERTY;
|
|
27
|
+
private static readonly CLIP_BOTTOM_PROPERTY;
|
|
28
|
+
/** Field areas an overlay can be contained within, most specific first. */
|
|
29
|
+
private static readonly FIELD_AREA_SELECTORS;
|
|
30
|
+
/** Chrome pinned above the field area, which a panel must not cover. */
|
|
31
|
+
private static readonly PINNED_ABOVE_SELECTORS;
|
|
32
|
+
/** Chrome pinned below the field area, which a panel must not cover. */
|
|
33
|
+
private static readonly PINNED_BELOW_SELECTORS;
|
|
34
|
+
private fieldArea?;
|
|
35
|
+
private updateBand?;
|
|
36
|
+
/**
|
|
37
|
+
* Returns the form field area the given host element sits in, or null when the
|
|
38
|
+
* host is not inside a form (a filter popover, a dialog) and so needs no
|
|
39
|
+
* containment.
|
|
40
|
+
* @param {HTMLElement} host
|
|
41
|
+
* @return {(HTMLElement | null)}
|
|
42
|
+
* @memberof FormOverlayBoundsService
|
|
43
|
+
*/
|
|
44
|
+
getFieldArea(host: HTMLElement): HTMLElement | null;
|
|
45
|
+
/**
|
|
46
|
+
* Starts containing overlays to the form the host element belongs to, and keeps
|
|
47
|
+
* the band current until `release` is called.
|
|
48
|
+
* @param {HTMLElement} host
|
|
49
|
+
* @return {(HTMLElement | null)} the field area, or null when not in a form
|
|
50
|
+
* @memberof FormOverlayBoundsService
|
|
51
|
+
*/
|
|
52
|
+
contain(host: HTMLElement): HTMLElement | null;
|
|
53
|
+
/**
|
|
54
|
+
* Returns the band an overlay is currently confined to, in viewport
|
|
55
|
+
* coordinates. Callers use it to position a panel inside the form.
|
|
56
|
+
* @return {({ top: number; bottom: number } | null)}
|
|
57
|
+
* @memberof FormOverlayBoundsService
|
|
58
|
+
*/
|
|
59
|
+
getBand(): {
|
|
60
|
+
top: number;
|
|
61
|
+
bottom: number;
|
|
62
|
+
} | null;
|
|
63
|
+
/**
|
|
64
|
+
* Stops containing overlays and removes the published band, so unrelated
|
|
65
|
+
* overlays are positioned normally.
|
|
66
|
+
* @memberof FormOverlayBoundsService
|
|
67
|
+
*/
|
|
68
|
+
release(): void;
|
|
69
|
+
/**
|
|
70
|
+
* Measures the usable band: the field area, trimmed by any of the form's own
|
|
71
|
+
* chrome that is currently pinned over it.
|
|
72
|
+
* @param {HTMLElement} fieldArea
|
|
73
|
+
* @return {{ top: number; bottom: number }}
|
|
74
|
+
* @memberof FormOverlayBoundsService
|
|
75
|
+
*/
|
|
76
|
+
private measureBand;
|
|
77
|
+
/**
|
|
78
|
+
* Publishes the band as clip custom properties for the overlay stylesheets.
|
|
79
|
+
* @param {HTMLElement} fieldArea
|
|
80
|
+
* @memberof FormOverlayBoundsService
|
|
81
|
+
*/
|
|
82
|
+
private publishBand;
|
|
83
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FormOverlayBoundsService, never>;
|
|
84
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<FormOverlayBoundsService>;
|
|
85
|
+
}
|
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -111,6 +111,7 @@ export * from './lib/models/home-group-selection.model';
|
|
|
111
111
|
export * from './lib/models/credit-selection.model';
|
|
112
112
|
export * from './lib/services/datepicker.service';
|
|
113
113
|
export * from './lib/services/form-utility.service';
|
|
114
|
+
export * from './lib/services/form-overlay-bounds.service';
|
|
114
115
|
export * from './lib/services/file-upload.service';
|
|
115
116
|
export * from './lib/services/break-point-observer.service';
|
|
116
117
|
export * from './lib/pipes/safe.pipe';
|