@skyux/ag-grid 6.20.0 → 6.22.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.
@@ -1,7 +1,7 @@
1
1
  import * as i2 from '@angular/common';
2
- import { CommonModule } from '@angular/common';
2
+ import { DOCUMENT, CommonModule } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
- import { Injectable, Component, ChangeDetectionStrategy, ContentChild, Directive, Input, ContentChildren, TemplateRef, ViewChildren, ViewChild, EventEmitter, Output, NgModule, ElementRef, ViewEncapsulation, Optional, HostBinding } from '@angular/core';
4
+ import { Injectable, Component, ChangeDetectionStrategy, Inject, ContentChild, Directive, Input, ContentChildren, TemplateRef, ViewChildren, ViewChild, EventEmitter, Output, NgModule, ElementRef, ViewEncapsulation, Optional, HostBinding } from '@angular/core';
5
5
  import * as i1 from '@skyux/core';
6
6
  import { SkyAffixAutoFitContext, SkyNumericModule, SkyViewkeeperModule } from '@skyux/core';
7
7
  import * as i1$1 from '@skyux/data-manager';
@@ -11,13 +11,13 @@ import { SkyInlineDeleteModule } from '@skyux/layout';
11
11
  import { AgGridAngular, AgGridModule } from 'ag-grid-angular';
12
12
  import { Subject, fromEvent } from 'rxjs';
13
13
  import { takeUntil, filter, first } from 'rxjs/operators';
14
+ import { __classPrivateFieldGet, __classPrivateFieldSet } from 'tslib';
14
15
  import * as i1$4 from '@angular/forms';
15
16
  import { FormGroup, FormControl, ReactiveFormsModule, FormsModule } from '@angular/forms';
16
17
  import * as i1$3 from '@skyux/lookup';
17
18
  import { SkyAutocompleteModule, SkyLookupModule } from '@skyux/lookup';
18
19
  import * as i3 from '@skyux/i18n';
19
20
  import { getLibStringForLocale, SkyI18nModule, SKY_LIB_RESOURCES_PROVIDERS } from '@skyux/i18n';
20
- import { __classPrivateFieldSet, __classPrivateFieldGet } from 'tslib';
21
21
  import { KeyCode, PopupComponent, Events, RowNode } from 'ag-grid-community';
22
22
  import * as i2$1 from '@skyux/autonumeric';
23
23
  import { SkyAutonumericModule } from '@skyux/autonumeric';
@@ -82,13 +82,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
82
82
  }]
83
83
  }], ctorParameters: function () { return [{ type: i1.SkyCoreAdapterService }]; } });
84
84
 
85
+ var _SkyAgGridWrapperComponent_instances, _SkyAgGridWrapperComponent_ngUnsubscribe, _SkyAgGridWrapperComponent_moveHorizontalScroll;
85
86
  let idIndex = 0;
86
87
  class SkyAgGridWrapperComponent {
87
- constructor(adapterService, changeDetector, elementRef) {
88
+ constructor(adapterService, changeDetector, elementRef, document) {
88
89
  this.adapterService = adapterService;
89
90
  this.changeDetector = changeDetector;
90
91
  this.elementRef = elementRef;
92
+ this.document = document;
93
+ _SkyAgGridWrapperComponent_instances.add(this);
91
94
  this._viewkeeperClasses = [];
95
+ _SkyAgGridWrapperComponent_ngUnsubscribe.set(this, new Subject());
92
96
  idIndex++;
93
97
  this.afterAnchorId = 'sky-ag-grid-nav-anchor-after-' + idIndex;
94
98
  this.beforeAnchorId = 'sky-ag-grid-nav-anchor-before-' + idIndex;
@@ -111,6 +115,23 @@ class SkyAgGridWrapperComponent {
111
115
  this.viewkeeperClasses.push('.ag-header');
112
116
  }
113
117
  }
118
+ this.agGrid.gridReady.pipe(takeUntil(__classPrivateFieldGet(this, _SkyAgGridWrapperComponent_ngUnsubscribe, "f"))).subscribe(() => {
119
+ __classPrivateFieldGet(this, _SkyAgGridWrapperComponent_instances, "m", _SkyAgGridWrapperComponent_moveHorizontalScroll).call(this);
120
+ });
121
+ this.agGrid.firstDataRendered
122
+ .pipe(takeUntil(__classPrivateFieldGet(this, _SkyAgGridWrapperComponent_ngUnsubscribe, "f")))
123
+ .subscribe(() => {
124
+ __classPrivateFieldGet(this, _SkyAgGridWrapperComponent_instances, "m", _SkyAgGridWrapperComponent_moveHorizontalScroll).call(this);
125
+ });
126
+ this.agGrid.rowDataChanged
127
+ .pipe(takeUntil(__classPrivateFieldGet(this, _SkyAgGridWrapperComponent_ngUnsubscribe, "f")))
128
+ .subscribe(() => {
129
+ __classPrivateFieldGet(this, _SkyAgGridWrapperComponent_instances, "m", _SkyAgGridWrapperComponent_moveHorizontalScroll).call(this);
130
+ });
131
+ }
132
+ ngOnDestroy() {
133
+ __classPrivateFieldGet(this, _SkyAgGridWrapperComponent_ngUnsubscribe, "f").next();
134
+ __classPrivateFieldGet(this, _SkyAgGridWrapperComponent_ngUnsubscribe, "f").complete();
114
135
  }
115
136
  /**
116
137
  * Prevent closing a modal when focused in AG Grid.
@@ -165,12 +186,41 @@ class SkyAgGridWrapperComponent {
165
186
  }
166
187
  }
167
188
  }
168
- SkyAgGridWrapperComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyAgGridWrapperComponent, deps: [{ token: SkyAgGridAdapterService }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
189
+ _SkyAgGridWrapperComponent_ngUnsubscribe = new WeakMap(), _SkyAgGridWrapperComponent_instances = new WeakSet(), _SkyAgGridWrapperComponent_moveHorizontalScroll = function _SkyAgGridWrapperComponent_moveHorizontalScroll() {
190
+ if (this.agGrid && this.agGrid.api) {
191
+ const toTop = !!this.agGrid.gridOptions.context?.enableTopScroll;
192
+ const root = this.elementRef.nativeElement.querySelector('.ag-root');
193
+ const header = root.querySelector('.ag-header');
194
+ const floatingBottom = root.querySelector('.ag-floating-bottom');
195
+ const scrollbar = root.querySelector('.ag-body-horizontal-scroll');
196
+ if (header && floatingBottom && scrollbar) {
197
+ if (scrollbar.style.height !==
198
+ scrollbar.style.getPropertyValue('--sky-ag-body-horizontal-scroll-width')) {
199
+ scrollbar.style.setProperty('--sky-ag-body-horizontal-scroll-width', scrollbar.style.height);
200
+ }
201
+ const isTop = !!root.children[1].matches('.ag-body-horizontal-scroll');
202
+ if (toTop && !isTop) {
203
+ const fragment = this.document.createDocumentFragment();
204
+ fragment.appendChild(scrollbar);
205
+ header.after(fragment);
206
+ }
207
+ else if (!toTop && isTop) {
208
+ const fragment = this.document.createDocumentFragment();
209
+ fragment.appendChild(scrollbar);
210
+ floatingBottom.after(fragment);
211
+ }
212
+ }
213
+ }
214
+ };
215
+ SkyAgGridWrapperComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyAgGridWrapperComponent, deps: [{ token: SkyAgGridAdapterService }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Component });
169
216
  SkyAgGridWrapperComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.2", type: SkyAgGridWrapperComponent, selector: "sky-ag-grid-wrapper", queries: [{ propertyName: "agGrid", first: true, predicate: AgGridAngular, descendants: true, static: true }], ngImport: i0, template: "<span\n class=\"nav-anchor\"\n tabindex=\"0\"\n [id]=\"beforeAnchorId\"\n (focusin)=\"onAnchorFocus($event)\"\n>\n</span>\n<div\n class=\"sky-ag-grid\"\n [ngClass]=\"{\n 'sky-ag-grid-top-scrollbar':\n agGrid?.gridOptions?.context &&\n agGrid?.gridOptions?.context['enableTopScroll']\n }\"\n tabindex=\"0\"\n [id]=\"gridId\"\n [skyViewkeeper]=\"viewkeeperClasses\"\n (keydown)=\"onGridKeydown($event)\"\n (keyup.escape)=\"onKeyUpEscape($event)\"\n>\n <ng-content></ng-content>\n</div>\n<span\n tabindex=\"0\"\n class=\"nav-anchor\"\n [id]=\"afterAnchorId\"\n (focusin)=\"onAnchorFocus($event)\"\n>\n</span>\n", directives: [{ type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.λ3, selector: "[skyViewkeeper]", inputs: ["skyViewkeeper"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
170
217
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyAgGridWrapperComponent, decorators: [{
171
218
  type: Component,
172
219
  args: [{ selector: 'sky-ag-grid-wrapper', changeDetection: ChangeDetectionStrategy.OnPush, template: "<span\n class=\"nav-anchor\"\n tabindex=\"0\"\n [id]=\"beforeAnchorId\"\n (focusin)=\"onAnchorFocus($event)\"\n>\n</span>\n<div\n class=\"sky-ag-grid\"\n [ngClass]=\"{\n 'sky-ag-grid-top-scrollbar':\n agGrid?.gridOptions?.context &&\n agGrid?.gridOptions?.context['enableTopScroll']\n }\"\n tabindex=\"0\"\n [id]=\"gridId\"\n [skyViewkeeper]=\"viewkeeperClasses\"\n (keydown)=\"onGridKeydown($event)\"\n (keyup.escape)=\"onKeyUpEscape($event)\"\n>\n <ng-content></ng-content>\n</div>\n<span\n tabindex=\"0\"\n class=\"nav-anchor\"\n [id]=\"afterAnchorId\"\n (focusin)=\"onAnchorFocus($event)\"\n>\n</span>\n" }]
173
- }], ctorParameters: function () { return [{ type: SkyAgGridAdapterService }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }]; }, propDecorators: { agGrid: [{
220
+ }], ctorParameters: function () { return [{ type: SkyAgGridAdapterService }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: Document, decorators: [{
221
+ type: Inject,
222
+ args: [DOCUMENT]
223
+ }] }]; }, propDecorators: { agGrid: [{
174
224
  type: ContentChild,
175
225
  args: [AgGridAngular, {
176
226
  static: true,