@skyux/ag-grid 7.0.0-beta.0 → 7.0.0-beta.10

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 i1$1 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$2 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$3 from '@angular/forms';
15
16
  import { UntypedFormGroup, UntypedFormControl, ReactiveFormsModule, FormsModule } from '@angular/forms';
16
17
  import * as i2$1 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$2 from '@skyux/autonumeric';
23
23
  import { SkyAutonumericModule } from '@skyux/autonumeric';
@@ -82,13 +82,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", 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: "14.2.0", 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: "14.2.0", 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: "14.0.0", version: "14.2.0", 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", dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.λ3, selector: "[skyViewkeeper]", inputs: ["skyViewkeeper"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
170
217
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", 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,
@@ -689,9 +739,6 @@ const RESOURCES = {
689
739
  sky_ag_grid_cell_editor_autocomplete_aria_label: {
690
740
  message: 'Editable autocomplete {0} for row {1}',
691
741
  },
692
- sky_ag_grid_cell_renderer_currency_aria_label: {
693
- message: 'Editable currency {0} for row {1}',
694
- },
695
742
  sky_ag_grid_cell_renderer_number_validator_message: {
696
743
  message: 'Enter a valid number.',
697
744
  },
@@ -1528,10 +1575,10 @@ class SkyAgGridCellRendererCurrencyComponent {
1528
1575
  }
1529
1576
  }
1530
1577
  SkyAgGridCellRendererCurrencyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyAgGridCellRendererCurrencyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1531
- SkyAgGridCellRendererCurrencyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: SkyAgGridCellRendererCurrencyComponent, selector: "sky-ag-grid-cell-renderer-currency", inputs: { params: "params" }, ngImport: i0, template: "<span\n [attr.aria-label]=\"\n 'sky_ag_grid_cell_renderer_currency_aria_label'\n | skyLibResources: columnHeader:rowNumber\n \"\n [style.width.px]=\"columnWidth\"\n [style.height.px]=\"rowHeightWithoutBorders\"\n>\n {{ value | skyNumeric: skyComponentProperties }}\n</span>\n", styles: ["input{border:none;padding-left:11px}\n"], dependencies: [{ kind: "pipe", type: i3.SkyLibResourcesPipe, name: "skyLibResources" }, { kind: "pipe", type: i1.SkyNumericPipe, name: "skyNumeric" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1578
+ SkyAgGridCellRendererCurrencyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: SkyAgGridCellRendererCurrencyComponent, selector: "sky-ag-grid-cell-renderer-currency", inputs: { params: "params" }, ngImport: i0, template: "<span\n [style.width.px]=\"columnWidth\"\n [style.height.px]=\"rowHeightWithoutBorders\"\n>\n {{ value | skyNumeric: skyComponentProperties }}\n</span>\n", styles: ["input{border:none;padding-left:11px}\n"], dependencies: [{ kind: "pipe", type: i1.SkyNumericPipe, name: "skyNumeric" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1532
1579
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyAgGridCellRendererCurrencyComponent, decorators: [{
1533
1580
  type: Component,
1534
- args: [{ selector: 'sky-ag-grid-cell-renderer-currency', changeDetection: ChangeDetectionStrategy.OnPush, template: "<span\n [attr.aria-label]=\"\n 'sky_ag_grid_cell_renderer_currency_aria_label'\n | skyLibResources: columnHeader:rowNumber\n \"\n [style.width.px]=\"columnWidth\"\n [style.height.px]=\"rowHeightWithoutBorders\"\n>\n {{ value | skyNumeric: skyComponentProperties }}\n</span>\n", styles: ["input{border:none;padding-left:11px}\n"] }]
1581
+ args: [{ selector: 'sky-ag-grid-cell-renderer-currency', changeDetection: ChangeDetectionStrategy.OnPush, template: "<span\n [style.width.px]=\"columnWidth\"\n [style.height.px]=\"rowHeightWithoutBorders\"\n>\n {{ value | skyNumeric: skyComponentProperties }}\n</span>\n", styles: ["input{border:none;padding-left:11px}\n"] }]
1535
1582
  }], propDecorators: { params: [{
1536
1583
  type: Input
1537
1584
  }] } });