@sebgroup/green-angular 2.0.4 → 2.1.1

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,21 +1,20 @@
1
1
  import * as i1 from '@angular/common';
2
2
  import { CommonModule, DOCUMENT } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
- import { EventEmitter, Component, Input, Output, ContentChildren, NgModule, ChangeDetectionStrategy, HostBinding, InjectionToken, Directive, Optional, Inject, ViewChild, HostListener, inject, Renderer2, ViewContainerRef, ChangeDetectorRef, TemplateRef, Injector, ContentChild, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
4
+ import { EventEmitter, Component, Input, Output, ContentChildren, NgModule, ChangeDetectionStrategy, HostBinding, inject, Renderer2, ViewContainerRef, ChangeDetectorRef, TemplateRef, Directive, ViewChild, CUSTOM_ELEMENTS_SCHEMA, Injector, Inject, ContentChild, InjectionToken } from '@angular/core';
5
5
  import { randomId, months, years, createDatepicker, calculateDegrees, sliderColors, getSliderTrackBackground, PaginationI18n } from '@sebgroup/extract';
6
- import * as i2 from 'rxjs';
7
- import { Subject, fromEvent, interval } from 'rxjs';
8
- import { takeUntil, throttle } from 'rxjs/operators';
9
- import * as i2$1 from '@angular/forms';
6
+ import { getScopedTagName } from '@sebgroup/green-core';
7
+ import { registerTransitionalStyles } from '@sebgroup/green-core/transitional-styles';
8
+ import * as i2 from '@angular/forms';
10
9
  import { NgControl, NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
11
10
  import { startOfDay, endOfDay } from 'date-fns';
12
- import { registerTransitionalStyles } from '@sebgroup/green-core/transitional-styles';
13
- import { getScopedTagName } from '@sebgroup/green-core';
14
11
  import * as i1$1 from '@angular/cdk/a11y';
15
12
  import { A11yModule } from '@angular/cdk/a11y';
16
13
  import { disableBodyScroll, enableBodyScroll } from 'body-scroll-lock';
17
14
  import * as i1$2 from '@angular/router';
18
15
  import { RouterModule } from '@angular/router';
16
+ import { Subject, fromEvent, interval } from 'rxjs';
17
+ import { takeUntil, throttle } from 'rxjs/operators';
19
18
 
20
19
  class NggAccordionListItemComponent {
21
20
  constructor() {
@@ -272,151 +271,90 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
272
271
  }]
273
272
  }] });
274
273
 
275
- const ON_SCROLL_TOKEN = new InjectionToken('ON_SCROLL_TOKEN');
276
- class NggOnScrollDirective {
277
- constructor(elementRef) {
278
- this.elementRef = elementRef;
279
- this.onScroll$ = new Subject();
280
- this.destroy$ = new Subject();
281
- }
282
- ngAfterViewInit() {
283
- if (this.elementRef) {
284
- fromEvent(this.elementRef?.nativeElement, 'scroll')
285
- .pipe(takeUntil(this.destroy$), throttle(() => interval(30)))
286
- .subscribe(() => {
287
- this.onScroll$.next();
288
- });
289
- }
274
+ class NggCoreElementDirective {
275
+ constructor() {
276
+ this.viewRef = null;
277
+ this.document = inject(DOCUMENT);
278
+ this.renderer = inject(Renderer2);
279
+ this.vcr = inject(ViewContainerRef);
280
+ this.cdr = inject(ChangeDetectorRef);
281
+ this.template = inject((TemplateRef));
290
282
  }
291
- ngOnDestroy() {
292
- this.destroy$.next(null);
293
- this.destroy$.complete();
283
+ ngOnInit() {
284
+ this.vcr.clear();
285
+ const originalCreateElement = this.renderer.createElement;
286
+ this.renderer.createElement = (name, _namespace) => {
287
+ return this.document.createElement(getScopedTagName(name));
288
+ };
289
+ this.viewRef = this.vcr.createEmbeddedView(this.template);
290
+ this.renderer.createElement = originalCreateElement;
291
+ this.cdr.markForCheck();
294
292
  }
295
293
  }
296
- NggOnScrollDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NggOnScrollDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
297
- NggOnScrollDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: NggOnScrollDirective, selector: "[nggOnScroll]", providers: [
298
- {
299
- provide: ON_SCROLL_TOKEN,
300
- useFactory: (component) => component?.onScroll$,
301
- deps: [NggOnScrollDirective],
302
- },
303
- ], ngImport: i0 });
304
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NggOnScrollDirective, decorators: [{
294
+ NggCoreElementDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NggCoreElementDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
295
+ NggCoreElementDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: NggCoreElementDirective, selector: "[nggCoreElement]", ngImport: i0 });
296
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NggCoreElementDirective, decorators: [{
305
297
  type: Directive,
306
298
  args: [{
307
- selector: '[nggOnScroll]',
308
- providers: [
309
- {
310
- provide: ON_SCROLL_TOKEN,
311
- useFactory: (component) => component?.onScroll$,
312
- deps: [NggOnScrollDirective],
313
- },
314
- ],
299
+ selector: '[nggCoreElement]',
315
300
  }]
316
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
317
-
318
- const CONTEXT_MENU_TOP = '0px';
319
- const CONTEXT_MENU_LEFT = '0px';
301
+ }] });
320
302
 
321
303
  class NggContextMenuComponent {
322
- constructor(changeDetectorRef, elementRef, closeContextMenu) {
323
- this.changeDetectorRef = changeDetectorRef;
304
+ constructor(elementRef) {
324
305
  this.elementRef = elementRef;
325
- this.closeContextMenu = closeContextMenu;
306
+ /**
307
+ * Placement of the popover relative to the anchor element.
308
+ */
326
309
  this.direction = 'ltr';
310
+ /**
311
+ * List of items to be displayed in the context menu.
312
+ */
327
313
  this.menuItems = [];
314
+ /**
315
+ * Custom menu item template.
316
+ */
328
317
  this.menuItemTemplate = null;
318
+ /**
319
+ * Custom menu trigger template.
320
+ */
329
321
  this.menuAnchorTemplate = null;
322
+ /**
323
+ * @deprecated
324
+ * This property no longer has any effect and will be removed in a future version.
325
+ */
330
326
  this.closeOnScroll = false;
327
+ /**
328
+ * Emits when a menu item is clicked.
329
+ */
331
330
  this.contextMenuItemClicked = new EventEmitter();
332
331
  this.isActive = false;
333
- this.top = CONTEXT_MENU_TOP;
334
- this.left = CONTEXT_MENU_LEFT;
335
- }
336
- onDocumentClick(target) {
337
- if (!this.isActive) {
338
- return;
339
- }
340
- if (!this.elementRef.nativeElement.contains(target)) {
341
- this.close();
342
- }
343
- }
344
- ngOnInit() {
345
- this.resizeObserver = new ResizeObserver(() => {
346
- this.close();
347
- });
348
- this.resizeObserver.observe(document.body);
349
- }
350
- ngAfterViewInit() {
351
- if (this.closeOnScroll) {
352
- this.menuCloseSubscription = this.closeContextMenu?.subscribe(() => this.close());
353
- }
332
+ registerTransitionalStyles();
354
333
  }
355
- ngOnDestroy() {
356
- this.resizeObserver?.unobserve(document.body);
357
- this.menuCloseSubscription?.unsubscribe();
334
+ get placement() {
335
+ return this.direction === 'ltr' ? 'bottom-start' : 'bottom-end';
358
336
  }
359
337
  open() {
360
338
  if (this.isActive) {
361
339
  this.close();
362
340
  return;
363
341
  }
364
- const buttonRect = this.anchor?.nativeElement.getBoundingClientRect();
365
- const gapBetweenButtonAndPopover = 3;
366
- const left = this.calculateLeft(this.direction, buttonRect);
367
- const top = buttonRect.bottom + gapBetweenButtonAndPopover;
368
- this.left = `${left}px`;
369
- this.top = `${top}px`;
370
342
  this.isActive = true;
371
343
  }
372
344
  close() {
373
345
  this.isActive = false;
374
- this.top = CONTEXT_MENU_TOP;
375
- this.left = CONTEXT_MENU_LEFT;
376
- this.changeDetectorRef.markForCheck();
377
346
  }
378
347
  onItemClick(item) {
379
348
  this.contextMenuItemClicked.emit(item);
380
349
  this.close();
381
350
  }
382
- onMenuItemKeyDown(event, menuItem) {
383
- switch (event.key) {
384
- case 'Enter':
385
- case ' ':
386
- event.preventDefault();
387
- this.onItemClick(menuItem);
388
- break;
389
- default:
390
- break;
391
- }
392
- }
393
- calculateLeft(direction, buttonRect) {
394
- const popover = this.popover?.nativeElement;
395
- const popoverWidth = popover?.offsetWidth || 0;
396
- switch (direction) {
397
- case 'rtl':
398
- return popoverWidth <= buttonRect.left
399
- ? buttonRect.right - popoverWidth
400
- : buttonRect.left;
401
- case 'ltr':
402
- default:
403
- return buttonRect.right + popoverWidth <= window.innerWidth
404
- ? buttonRect.left
405
- : buttonRect.right - popoverWidth;
406
- }
407
- }
408
351
  }
409
- NggContextMenuComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NggContextMenuComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: ON_SCROLL_TOKEN, optional: true }], target: i0.ɵɵFactoryTarget.Component });
410
- NggContextMenuComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: NggContextMenuComponent, selector: "ngg-context-menu", inputs: { direction: "direction", menuItems: "menuItems", menuItemTemplate: "menuItemTemplate", menuAnchorTemplate: "menuAnchorTemplate", closeOnScroll: "closeOnScroll" }, outputs: { contextMenuItemClicked: "contextMenuItemClicked" }, host: { listeners: { "document:click": "onDocumentClick($event.target)" } }, viewQueries: [{ propertyName: "popover", first: true, predicate: ["contextMenuPopover"], descendants: true }, { propertyName: "anchor", first: true, predicate: ["contextMenuAnchor"], descendants: true }], ngImport: i0, template: "<button\n #contextMenuAnchor\n class=\"ghost small px-3 border-0\"\n [class.active]=\"isActive\"\n (click)=\"open()\"\n>\n <ng-container\n [ngTemplateOutlet]=\"menuAnchorTemplate ?? defaultButtonTemplate\"\n >\n </ng-container>\n</button>\n\n<div class=\"context-menu-overlay\">\n <div\n class=\"popover popover-context-menu\"\n [class.active]=\"isActive\"\n [style.top]=\"top\"\n [style.left]=\"left\"\n #contextMenuPopover\n >\n <ul role=\"listbox\">\n <li\n *ngFor=\"let menuItem of menuItems\"\n (click)=\"onItemClick(menuItem)\"\n tabindex=\"0\"\n (keydown)=\"onMenuItemKeyDown($event, menuItem)\"\n >\n <ng-container\n [ngTemplateOutlet]=\"menuItemTemplate ?? defaultMenuItemTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"\n >\n </ng-container>\n </li>\n </ul>\n </div>\n</div>\n\n<ng-template #defaultMenuItemTemplate let-menuItem>\n <span>{{ menuItem.label }}</span>\n</ng-template>\n\n<ng-template #defaultButtonTemplate>\n <i class=\"sg-icon sg-icon-ellipsis\">Open context menu</i>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
352
+ NggContextMenuComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NggContextMenuComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
353
+ NggContextMenuComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: NggContextMenuComponent, selector: "ngg-context-menu", inputs: { direction: "direction", menuItems: "menuItems", menuItemTemplate: "menuItemTemplate", menuAnchorTemplate: "menuAnchorTemplate", closeOnScroll: "closeOnScroll" }, outputs: { contextMenuItemClicked: "contextMenuItemClicked" }, viewQueries: [{ propertyName: "popover", first: true, predicate: ["contextMenuPopover"], descendants: true }, { propertyName: "anchor", first: true, predicate: ["contextMenuAnchor"], descendants: true }], ngImport: i0, template: "<gds-context-menu\n *nggCoreElement\n data-testid=\"context-menu\"\n [placement]=\"placement\"\n [open]=\"isActive\"\n>\n <span slot=\"trigger\">\n <ng-container\n [ngTemplateOutlet]=\"menuAnchorTemplate ?? defaultButtonTemplate\"\n >\n </ng-container>\n </span>\n <ng-container *ngFor=\"let menuItem of menuItems\">\n <gds-menu-item *nggCoreElement (click)=\"onItemClick(menuItem)\">\n <ng-container\n [ngTemplateOutlet]=\"menuItemTemplate ?? defaultMenuItemTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"\n >\n </ng-container>\n </gds-menu-item>\n </ng-container>\n</gds-context-menu>\n\n<ng-template #defaultMenuItemTemplate let-menuItem>\n <span>{{ menuItem.label }}</span>\n</ng-template>\n\n<ng-template #defaultButtonTemplate>\n <i class=\"sg-icon sg-icon-ellipsis\">Open context menu</i>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NggCoreElementDirective, selector: "[nggCoreElement]" }] });
411
354
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NggContextMenuComponent, decorators: [{
412
355
  type: Component,
413
- args: [{ selector: 'ngg-context-menu', template: "<button\n #contextMenuAnchor\n class=\"ghost small px-3 border-0\"\n [class.active]=\"isActive\"\n (click)=\"open()\"\n>\n <ng-container\n [ngTemplateOutlet]=\"menuAnchorTemplate ?? defaultButtonTemplate\"\n >\n </ng-container>\n</button>\n\n<div class=\"context-menu-overlay\">\n <div\n class=\"popover popover-context-menu\"\n [class.active]=\"isActive\"\n [style.top]=\"top\"\n [style.left]=\"left\"\n #contextMenuPopover\n >\n <ul role=\"listbox\">\n <li\n *ngFor=\"let menuItem of menuItems\"\n (click)=\"onItemClick(menuItem)\"\n tabindex=\"0\"\n (keydown)=\"onMenuItemKeyDown($event, menuItem)\"\n >\n <ng-container\n [ngTemplateOutlet]=\"menuItemTemplate ?? defaultMenuItemTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"\n >\n </ng-container>\n </li>\n </ul>\n </div>\n</div>\n\n<ng-template #defaultMenuItemTemplate let-menuItem>\n <span>{{ menuItem.label }}</span>\n</ng-template>\n\n<ng-template #defaultButtonTemplate>\n <i class=\"sg-icon sg-icon-ellipsis\">Open context menu</i>\n</ng-template>\n" }]
414
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i2.Subject, decorators: [{
415
- type: Optional
416
- }, {
417
- type: Inject,
418
- args: [ON_SCROLL_TOKEN]
419
- }] }]; }, propDecorators: { direction: [{
356
+ args: [{ selector: 'ngg-context-menu', template: "<gds-context-menu\n *nggCoreElement\n data-testid=\"context-menu\"\n [placement]=\"placement\"\n [open]=\"isActive\"\n>\n <span slot=\"trigger\">\n <ng-container\n [ngTemplateOutlet]=\"menuAnchorTemplate ?? defaultButtonTemplate\"\n >\n </ng-container>\n </span>\n <ng-container *ngFor=\"let menuItem of menuItems\">\n <gds-menu-item *nggCoreElement (click)=\"onItemClick(menuItem)\">\n <ng-container\n [ngTemplateOutlet]=\"menuItemTemplate ?? defaultMenuItemTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"\n >\n </ng-container>\n </gds-menu-item>\n </ng-container>\n</gds-context-menu>\n\n<ng-template #defaultMenuItemTemplate let-menuItem>\n <span>{{ menuItem.label }}</span>\n</ng-template>\n\n<ng-template #defaultButtonTemplate>\n <i class=\"sg-icon sg-icon-ellipsis\">Open context menu</i>\n</ng-template>\n" }]
357
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { direction: [{
420
358
  type: Input
421
359
  }], menuItems: [{
422
360
  type: Input
@@ -434,22 +372,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
434
372
  }], anchor: [{
435
373
  type: ViewChild,
436
374
  args: ['contextMenuAnchor']
437
- }], onDocumentClick: [{
438
- type: HostListener,
439
- args: ['document:click', ['$event.target']]
440
375
  }] } });
441
376
 
377
+ class NggCoreWrapperModule {
378
+ }
379
+ NggCoreWrapperModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NggCoreWrapperModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
380
+ NggCoreWrapperModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: NggCoreWrapperModule, declarations: [NggCoreElementDirective], imports: [CommonModule], exports: [NggCoreElementDirective] });
381
+ NggCoreWrapperModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NggCoreWrapperModule, imports: [CommonModule] });
382
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NggCoreWrapperModule, decorators: [{
383
+ type: NgModule,
384
+ args: [{
385
+ declarations: [NggCoreElementDirective],
386
+ imports: [CommonModule],
387
+ exports: [NggCoreElementDirective],
388
+ }]
389
+ }] });
390
+
442
391
  class NggContextMenuModule {
443
392
  }
444
393
  NggContextMenuModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NggContextMenuModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
445
- NggContextMenuModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: NggContextMenuModule, declarations: [NggContextMenuComponent], imports: [CommonModule], exports: [NggContextMenuComponent] });
446
- NggContextMenuModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NggContextMenuModule, imports: [CommonModule] });
394
+ NggContextMenuModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: NggContextMenuModule, declarations: [NggContextMenuComponent], imports: [CommonModule, NggCoreWrapperModule], exports: [NggContextMenuComponent] });
395
+ NggContextMenuModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NggContextMenuModule, imports: [CommonModule, NggCoreWrapperModule] });
447
396
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NggContextMenuModule, decorators: [{
448
397
  type: NgModule,
449
398
  args: [{
450
399
  declarations: [NggContextMenuComponent],
451
- imports: [CommonModule],
400
+ imports: [CommonModule, NggCoreWrapperModule],
452
401
  exports: [NggContextMenuComponent],
402
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
453
403
  }]
454
404
  }] });
455
405
 
@@ -481,35 +431,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
481
431
  }]
482
432
  }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
483
433
 
484
- class NggCoreElementDirective {
485
- constructor() {
486
- this.viewRef = null;
487
- this.document = inject(DOCUMENT);
488
- this.renderer = inject(Renderer2);
489
- this.vcr = inject(ViewContainerRef);
490
- this.cdr = inject(ChangeDetectorRef);
491
- this.template = inject((TemplateRef));
492
- }
493
- ngOnInit() {
494
- this.vcr.clear();
495
- const originalCreateElement = this.renderer.createElement;
496
- this.renderer.createElement = (name, _namespace) => {
497
- return this.document.createElement(getScopedTagName(name));
498
- };
499
- this.viewRef = this.vcr.createEmbeddedView(this.template);
500
- this.renderer.createElement = originalCreateElement;
501
- this.cdr.markForCheck();
502
- }
503
- }
504
- NggCoreElementDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NggCoreElementDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
505
- NggCoreElementDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: NggCoreElementDirective, selector: "[nggCoreElement]", ngImport: i0 });
506
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NggCoreElementDirective, decorators: [{
507
- type: Directive,
508
- args: [{
509
- selector: '[nggCoreElement]',
510
- }]
511
- }] });
512
-
513
434
  class NggDropdownComponent {
514
435
  constructor(injector, _cdr) {
515
436
  this.injector = injector;
@@ -636,7 +557,7 @@ NggDropdownComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", v
636
557
  useExisting: NggDropdownComponent,
637
558
  multi: true,
638
559
  },
639
- ], queries: [{ propertyName: "customOption", first: true, predicate: NggDropdownOptionDirective, descendants: true }, { propertyName: "customButton", first: true, predicate: NggDropdownButtonDirective, descendants: true }], viewQueries: [{ propertyName: "gdsDropdown", first: true, predicate: ["gdsDropdown"], descendants: true }], ngImport: i0, template: "<div class=\"form-group\">\n <gds-dropdown\n *nggCoreElement\n #gdsDropdown\n [value]=\"value\"\n [searchable]=\"searchable\"\n [label]=\"label\"\n (change)=\"onValueChange($event)\"\n [multiple]=\"multiSelect\"\n [invalid]=\"invalid\"\n [compareWith]=\"compareWithAdapter\"\n [searchFilter]=\"searchFilterAdapter\"\n >\n <span slot=\"message\" #formInfo\n ><ng-content select=\"[data-form-info]\"></ng-content\n ></span>\n\n <span slot=\"trigger\"\n ><ng-container\n *ngTemplateOutlet=\"\n customButton?.templateRef && selectedOption\n ? customButton!.templateRef\n : defaultButton;\n context: { option: selectedOption }\n \"\n ></ng-container\n ></span>\n\n <ng-container *ngFor=\"let option of options; let index = index\">\n <gds-option *nggCoreElement [value]=\"option[useValue]\"\n ><ng-container\n *ngTemplateOutlet=\"\n customOption?.templateRef\n ? customOption!.templateRef\n : defaultOption;\n context: { option: option, index: index }\n \"\n ></ng-container\n ></gds-option>\n </ng-container>\n </gds-dropdown>\n</div>\n\n<ng-template #defaultButton let-selected=\"option\">\n <span>{{ texts?.select }}</span>\n</ng-template>\n\n<ng-template #defaultOption let-option=\"option\">\n {{ display ? option[display] : option.name }}\n</ng-template>\n", dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NggCoreElementDirective, selector: "[nggCoreElement]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
560
+ ], queries: [{ propertyName: "customOption", first: true, predicate: NggDropdownOptionDirective, descendants: true }, { propertyName: "customButton", first: true, predicate: NggDropdownButtonDirective, descendants: true }], viewQueries: [{ propertyName: "gdsDropdown", first: true, predicate: ["gdsDropdown"], descendants: true }], ngImport: i0, template: "<div class=\"form-group\">\n <gds-dropdown\n *nggCoreElement\n #gdsDropdown\n [value]=\"value\"\n [searchable]=\"searchable\"\n [label]=\"label\"\n (change)=\"onValueChange($event)\"\n [multiple]=\"multiSelect\"\n [invalid]=\"invalid\"\n [compareWith]=\"compareWithAdapter\"\n [searchFilter]=\"searchFilterAdapter\"\n >\n <span slot=\"message\" #formInfo\n ><ng-content select=\"[data-form-info]\"></ng-content\n ></span>\n\n <span slot=\"trigger\"\n ><ng-container\n *ngTemplateOutlet=\"\n customButton?.templateRef && selectedOption\n ? customButton!.templateRef\n : defaultButton;\n context: { option: selectedOption }\n \"\n ></ng-container\n ></span>\n\n <ng-container *ngFor=\"let option of options; let index = index\">\n <gds-option *nggCoreElement [value]=\"option[useValue]\"\n ><ng-container\n *ngTemplateOutlet=\"\n customOption?.templateRef\n ? customOption!.templateRef\n : defaultOption;\n context: { option: option, index: index }\n \"\n ></ng-container\n ></gds-option>\n </ng-container>\n </gds-dropdown>\n</div>\n\n<ng-template #defaultButton let-selected=\"option\">\n <span class=\"trigger\">{{ texts?.select }}</span>\n</ng-template>\n\n<ng-template #defaultOption let-option=\"option\">\n {{ display ? option[display] : option.name }}\n</ng-template>\n", styles: [".trigger{display:block;overflow:hidden;text-overflow:ellipsis;text-wrap:nowrap}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NggCoreElementDirective, selector: "[nggCoreElement]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
640
561
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NggDropdownComponent, decorators: [{
641
562
  type: Component,
642
563
  args: [{ selector: 'ngg-dropdown', providers: [
@@ -645,7 +566,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
645
566
  useExisting: NggDropdownComponent,
646
567
  multi: true,
647
568
  },
648
- ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"form-group\">\n <gds-dropdown\n *nggCoreElement\n #gdsDropdown\n [value]=\"value\"\n [searchable]=\"searchable\"\n [label]=\"label\"\n (change)=\"onValueChange($event)\"\n [multiple]=\"multiSelect\"\n [invalid]=\"invalid\"\n [compareWith]=\"compareWithAdapter\"\n [searchFilter]=\"searchFilterAdapter\"\n >\n <span slot=\"message\" #formInfo\n ><ng-content select=\"[data-form-info]\"></ng-content\n ></span>\n\n <span slot=\"trigger\"\n ><ng-container\n *ngTemplateOutlet=\"\n customButton?.templateRef && selectedOption\n ? customButton!.templateRef\n : defaultButton;\n context: { option: selectedOption }\n \"\n ></ng-container\n ></span>\n\n <ng-container *ngFor=\"let option of options; let index = index\">\n <gds-option *nggCoreElement [value]=\"option[useValue]\"\n ><ng-container\n *ngTemplateOutlet=\"\n customOption?.templateRef\n ? customOption!.templateRef\n : defaultOption;\n context: { option: option, index: index }\n \"\n ></ng-container\n ></gds-option>\n </ng-container>\n </gds-dropdown>\n</div>\n\n<ng-template #defaultButton let-selected=\"option\">\n <span>{{ texts?.select }}</span>\n</ng-template>\n\n<ng-template #defaultOption let-option=\"option\">\n {{ display ? option[display] : option.name }}\n</ng-template>\n" }]
569
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"form-group\">\n <gds-dropdown\n *nggCoreElement\n #gdsDropdown\n [value]=\"value\"\n [searchable]=\"searchable\"\n [label]=\"label\"\n (change)=\"onValueChange($event)\"\n [multiple]=\"multiSelect\"\n [invalid]=\"invalid\"\n [compareWith]=\"compareWithAdapter\"\n [searchFilter]=\"searchFilterAdapter\"\n >\n <span slot=\"message\" #formInfo\n ><ng-content select=\"[data-form-info]\"></ng-content\n ></span>\n\n <span slot=\"trigger\"\n ><ng-container\n *ngTemplateOutlet=\"\n customButton?.templateRef && selectedOption\n ? customButton!.templateRef\n : defaultButton;\n context: { option: selectedOption }\n \"\n ></ng-container\n ></span>\n\n <ng-container *ngFor=\"let option of options; let index = index\">\n <gds-option *nggCoreElement [value]=\"option[useValue]\"\n ><ng-container\n *ngTemplateOutlet=\"\n customOption?.templateRef\n ? customOption!.templateRef\n : defaultOption;\n context: { option: option, index: index }\n \"\n ></ng-container\n ></gds-option>\n </ng-container>\n </gds-dropdown>\n</div>\n\n<ng-template #defaultButton let-selected=\"option\">\n <span class=\"trigger\">{{ texts?.select }}</span>\n</ng-template>\n\n<ng-template #defaultOption let-option=\"option\">\n {{ display ? option[display] : option.name }}\n</ng-template>\n", styles: [".trigger{display:block;overflow:hidden;text-overflow:ellipsis;text-wrap:nowrap}\n"] }]
649
570
  }], ctorParameters: function () { return [{ type: i0.Injector, decorators: [{
650
571
  type: Inject,
651
572
  args: [Injector]
@@ -885,20 +806,6 @@ function dateValidator(dates) {
885
806
  };
886
807
  }
887
808
 
888
- class NggCoreWrapperModule {
889
- }
890
- NggCoreWrapperModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NggCoreWrapperModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
891
- NggCoreWrapperModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: NggCoreWrapperModule, declarations: [NggCoreElementDirective], imports: [CommonModule], exports: [NggCoreElementDirective] });
892
- NggCoreWrapperModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NggCoreWrapperModule, imports: [CommonModule] });
893
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NggCoreWrapperModule, decorators: [{
894
- type: NgModule,
895
- args: [{
896
- declarations: [NggCoreElementDirective],
897
- imports: [CommonModule],
898
- exports: [NggCoreElementDirective],
899
- }]
900
- }] });
901
-
902
809
  class NggDropdownModule {
903
810
  }
904
811
  NggDropdownModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NggDropdownModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
@@ -1364,6 +1271,49 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1364
1271
  }]
1365
1272
  }] });
1366
1273
 
1274
+ const ON_SCROLL_TOKEN = new InjectionToken('ON_SCROLL_TOKEN');
1275
+ class NggOnScrollDirective {
1276
+ constructor(elementRef) {
1277
+ this.elementRef = elementRef;
1278
+ this.onScroll$ = new Subject();
1279
+ this.destroy$ = new Subject();
1280
+ }
1281
+ ngAfterViewInit() {
1282
+ if (this.elementRef) {
1283
+ fromEvent(this.elementRef?.nativeElement, 'scroll')
1284
+ .pipe(takeUntil(this.destroy$), throttle(() => interval(30)))
1285
+ .subscribe(() => {
1286
+ this.onScroll$.next();
1287
+ });
1288
+ }
1289
+ }
1290
+ ngOnDestroy() {
1291
+ this.destroy$.next(null);
1292
+ this.destroy$.complete();
1293
+ }
1294
+ }
1295
+ NggOnScrollDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NggOnScrollDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1296
+ NggOnScrollDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: NggOnScrollDirective, selector: "[nggOnScroll]", providers: [
1297
+ {
1298
+ provide: ON_SCROLL_TOKEN,
1299
+ useFactory: (component) => component?.onScroll$,
1300
+ deps: [NggOnScrollDirective],
1301
+ },
1302
+ ], ngImport: i0 });
1303
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NggOnScrollDirective, decorators: [{
1304
+ type: Directive,
1305
+ args: [{
1306
+ selector: '[nggOnScroll]',
1307
+ providers: [
1308
+ {
1309
+ provide: ON_SCROLL_TOKEN,
1310
+ useFactory: (component) => component?.onScroll$,
1311
+ deps: [NggOnScrollDirective],
1312
+ },
1313
+ ],
1314
+ }]
1315
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
1316
+
1367
1317
  class NggSharedModule {
1368
1318
  }
1369
1319
  NggSharedModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NggSharedModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
@@ -1443,7 +1393,7 @@ NggSliderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", ver
1443
1393
  useExisting: NggSliderComponent,
1444
1394
  multi: true,
1445
1395
  },
1446
- ], usesOnChanges: true, ngImport: i0, template: "<div *ngIf=\"!!label\" class=\"gds-slider-label-container\">\n <div>\n <label [attr.for]=\"name\" [attr.id]=\"name + '-label'\">{{ label }}</label>\n <p *ngIf=\"!!instruction\">{{ instruction }}</p>\n </div>\n <ng-container *ngIf=\"hasTextbox\">\n <ng-container *ngIf=\"!!unitLabel\">\n <div class=\"group group-border group-focus\">\n <ng-container *ngTemplateOutlet=\"inputField\"></ng-container>\n <span class=\"form-text\">{{ unitLabel }}</span>\n </div>\n </ng-container>\n <ng-container *ngIf=\"!unitLabel\">\n <ng-container *ngTemplateOutlet=\"inputField\"></ng-container>\n </ng-container>\n </ng-container>\n</div>\n\n<input\n type=\"range\"\n [attr.id]=\"name\"\n [attr.name]=\"name\"\n [attr.min]=\"min\"\n [attr.max]=\"max\"\n [attr.step]=\"step\"\n [disabled]=\"disabled\"\n [(ngModel)]=\"value\"\n [ngStyle]=\"style\"\n (blur)=\"onBlur()\"\n (input)=\"handleChange()\"\n/>\n\n<p *ngIf=\"!!errorMessage\" class=\"gds-slider-error-info\">\n {{ errorMessage }}\n</p>\n\n<ng-template #inputField>\n <input\n type=\"text\"\n inputmode=\"numeric\"\n pattern=\"[0-9]*\"\n [(ngModel)]=\"value\"\n [class.is-invalid]=\"!!errorMessage\"\n [attr.name]=\"name\"\n [attr.id]=\"name + '-textbox'\"\n [attr.placeholder]=\"placeholder\"\n [attr.aria-labelledby]=\"name + '-label'\"\n [attr.enterkeyhint]=\"enterkeyhint\"\n [disabled]=\"disabled\"\n (blur)=\"onBlur()\"\n (input)=\"handleChange()\"\n />\n</ng-template>\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$1.RangeValueAccessor, selector: "input[type=range][formControlName],input[type=range][formControl],input[type=range][ngModel]" }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1396
+ ], usesOnChanges: true, ngImport: i0, template: "<div *ngIf=\"!!label\" class=\"gds-slider-label-container\">\n <div>\n <label [attr.for]=\"name\" [attr.id]=\"name + '-label'\">{{ label }}</label>\n <p *ngIf=\"!!instruction\">{{ instruction }}</p>\n </div>\n <ng-container *ngIf=\"hasTextbox\">\n <ng-container *ngIf=\"!!unitLabel\">\n <div class=\"group group-border group-focus\">\n <ng-container *ngTemplateOutlet=\"inputField\"></ng-container>\n <span class=\"form-text\">{{ unitLabel }}</span>\n </div>\n </ng-container>\n <ng-container *ngIf=\"!unitLabel\">\n <ng-container *ngTemplateOutlet=\"inputField\"></ng-container>\n </ng-container>\n </ng-container>\n</div>\n\n<input\n type=\"range\"\n [attr.id]=\"name\"\n [attr.name]=\"name\"\n [attr.min]=\"min\"\n [attr.max]=\"max\"\n [attr.step]=\"step\"\n [disabled]=\"disabled\"\n [(ngModel)]=\"value\"\n [ngStyle]=\"style\"\n (blur)=\"onBlur()\"\n (input)=\"handleChange()\"\n/>\n\n<p *ngIf=\"!!errorMessage\" class=\"gds-slider-error-info\">\n {{ errorMessage }}\n</p>\n\n<ng-template #inputField>\n <input\n type=\"text\"\n inputmode=\"numeric\"\n pattern=\"[0-9]*\"\n [(ngModel)]=\"value\"\n [class.is-invalid]=\"!!errorMessage\"\n [attr.name]=\"name\"\n [attr.id]=\"name + '-textbox'\"\n [attr.placeholder]=\"placeholder\"\n [attr.aria-labelledby]=\"name + '-label'\"\n [attr.enterkeyhint]=\"enterkeyhint\"\n [disabled]=\"disabled\"\n (blur)=\"onBlur()\"\n (input)=\"handleChange()\"\n />\n</ng-template>\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.RangeValueAccessor, selector: "input[type=range][formControlName],input[type=range][formControl],input[type=range][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1447
1397
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NggSliderComponent, decorators: [{
1448
1398
  type: Component,
1449
1399
  args: [{ selector: 'ngg-slider', providers: [