@inspark/inspark-components 1.0.7 → 1.0.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,10 +1,12 @@
1
1
  import { __decorate, __metadata, __assign, __extends, __read, __values } from 'tslib';
2
- import { Pipe, NgModule, Injectable, EventEmitter, ChangeDetectorRef, Input, ViewChild, Output, Component, ViewEncapsulation, ChangeDetectionStrategy, forwardRef, ElementRef, TemplateRef, Directive, HostListener, ContentChildren, QueryList, NO_ERRORS_SCHEMA } from '@angular/core';
2
+ import { Pipe, NgModule, Injectable, ComponentFactoryResolver, ApplicationRef, Injector, EventEmitter, ChangeDetectorRef, Input, ViewChild, Output, Component, ViewEncapsulation, ChangeDetectionStrategy, forwardRef, ElementRef, TemplateRef, Directive, HostListener, ContentChildren, QueryList, NO_ERRORS_SCHEMA } from '@angular/core';
3
3
  import { TranslateService, TranslateModule } from '@ngx-translate/core';
4
4
  export { TranslateModule } from '@ngx-translate/core';
5
5
  import { DomSanitizer } from '@angular/platform-browser';
6
- import { MessageService, ConfirmationService, DynamicDialogRef, DynamicDialogConfig } from 'primeng/api';
6
+ import { MessageService, ConfirmationService, DynamicDialogConfig, DynamicDialogRef } from 'primeng/api';
7
7
  import { _ } from '@biesbjerg/ngx-translate-extract/dist/utils/utils';
8
+ import { DynamicDialogComponent } from 'primeng/dynamicdialog';
9
+ import { DynamicDialogInjector } from 'primeng/components/dynamicdialog/dynamicdialog-injector';
8
10
  import { Subject } from 'rxjs';
9
11
  import { NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule } from '@angular/forms';
10
12
  import { CommonModule } from '@angular/common';
@@ -401,6 +403,61 @@ var InsparkMessageService = /** @class */ (function () {
401
403
  return InsparkMessageService;
402
404
  }());
403
405
 
406
+ var InsparkDialogService = /** @class */ (function () {
407
+ function InsparkDialogService(componentFactoryResolver, appRef, injector) {
408
+ this.componentFactoryResolver = componentFactoryResolver;
409
+ this.appRef = appRef;
410
+ this.injector = injector;
411
+ }
412
+ InsparkDialogService.prototype.open = function (componentType, config) {
413
+ var dialogRef = this.appendDialogComponentToBody(config);
414
+ console.log('window.scrollY', window.scrollY);
415
+ document.body.style.top = "-" + window.scrollY + "px";
416
+ document.body.style.position = 'fixed';
417
+ dialogRef.onClose.subscribe(function () {
418
+ console.log('custom subscrnve');
419
+ var scrollY = document.body.style.top;
420
+ document.body.style.position = '';
421
+ document.body.style.top = '';
422
+ window.scrollTo(0, parseInt(scrollY || '0') * -1);
423
+ });
424
+ this.dialogComponentRef.instance.childComponentType = componentType;
425
+ return dialogRef;
426
+ };
427
+ InsparkDialogService.prototype.appendDialogComponentToBody = function (config) {
428
+ var _this = this;
429
+ var map = new WeakMap();
430
+ map.set(DynamicDialogConfig, config);
431
+ var dialogRef = new DynamicDialogRef();
432
+ map.set(DynamicDialogRef, dialogRef);
433
+ var sub = dialogRef.onClose.subscribe(function () {
434
+ _this.removeDialogComponentFromBody();
435
+ sub.unsubscribe();
436
+ });
437
+ var componentFactory = this.componentFactoryResolver.resolveComponentFactory(DynamicDialogComponent);
438
+ var componentRef = componentFactory.create(new DynamicDialogInjector(this.injector, map));
439
+ this.appRef.attachView(componentRef.hostView);
440
+ var domElem = componentRef.hostView.rootNodes[0];
441
+ document.body.appendChild(domElem);
442
+ this.dialogComponentRef = componentRef;
443
+ return dialogRef;
444
+ };
445
+ InsparkDialogService.prototype.removeDialogComponentFromBody = function () {
446
+ this.appRef.detachView(this.dialogComponentRef.hostView);
447
+ this.dialogComponentRef.destroy();
448
+ };
449
+ InsparkDialogService.ctorParameters = function () { return [
450
+ { type: ComponentFactoryResolver },
451
+ { type: ApplicationRef },
452
+ { type: Injector }
453
+ ]; };
454
+ InsparkDialogService = __decorate([
455
+ Injectable(),
456
+ __metadata("design:paramtypes", [ComponentFactoryResolver, ApplicationRef, Injector])
457
+ ], InsparkDialogService);
458
+ return InsparkDialogService;
459
+ }());
460
+
404
461
  var CommunicationService = /** @class */ (function () {
405
462
  function CommunicationService() {
406
463
  this.messageSource = {};
@@ -3678,5 +3735,5 @@ var InsparkComponentsModule = /** @class */ (function () {
3678
3735
  * Generated bundle index. Do not edit.
3679
3736
  */
3680
3737
 
3681
- export { BreadcrumbComponent, ButtonComponent, CheckboxComponent, CommunicationService, ComponentContainerComponent, ContentToggleComponent, DropdownComponentModule, EmptyComponent, FileComponent, InlineMessageComponent, InputTextComponent, InsparkComponentsModule, InsparkHeaderComponent, InsparkMessageService, InsparkStickyComponent, InsparkTemplate, LinkComponent, ModalInputTextComponent, ObjectTreeComponent, PanelComponent, PipesModule, PreloaderComponent, RadiobuttonComponent, SelectButtonComponent, SelectListComponent, StatusCircleComponent, SvgComponent, SwitcherComponent, TableComponentModule, TextareaComponent, ToolbarComponent, TooltipComponent, TreeTableComponentModule, DropdownItem as ɵa, DropdownComponent as ɵb, TableComponent as ɵc, TreeTableComponent as ɵd, PropertyValuePipe as ɵe, ShortToFullWeekdayPipe as ɵf, NumToShortWeekdayPipe as ɵg, FormatNumToTime as ɵh, InDate as ɵi, SafeUrlPipe as ɵj, SortByPipe as ɵk, PrimengComponentsModule as ɵl, TableColumnsMultiselectComponent as ɵm, TableMenuOverlayComponent as ɵn, TableClickOutsideDirective as ɵo, InputGroupComponent as ɵp };
3738
+ export { BreadcrumbComponent, ButtonComponent, CheckboxComponent, CommunicationService, ComponentContainerComponent, ContentToggleComponent, DropdownComponentModule, EmptyComponent, FileComponent, InlineMessageComponent, InputTextComponent, InsparkComponentsModule, InsparkDialogService, InsparkHeaderComponent, InsparkMessageService, InsparkStickyComponent, InsparkTemplate, LinkComponent, ModalInputTextComponent, ObjectTreeComponent, PanelComponent, PipesModule, PreloaderComponent, RadiobuttonComponent, SelectButtonComponent, SelectListComponent, StatusCircleComponent, SvgComponent, SwitcherComponent, TableComponentModule, TextareaComponent, ToolbarComponent, TooltipComponent, TreeTableComponentModule, DropdownItem as ɵa, DropdownComponent as ɵb, TableComponent as ɵc, TreeTableComponent as ɵd, PropertyValuePipe as ɵe, ShortToFullWeekdayPipe as ɵf, NumToShortWeekdayPipe as ɵg, FormatNumToTime as ɵh, InDate as ɵi, SafeUrlPipe as ɵj, SortByPipe as ɵk, PrimengComponentsModule as ɵl, TableColumnsMultiselectComponent as ɵm, TableMenuOverlayComponent as ɵn, TableClickOutsideDirective as ɵo, InputGroupComponent as ɵp };
3682
3739
  //# sourceMappingURL=inspark-inspark-components.js.map