@datarailsshared/datarailsshared 1.4.123 → 1.4.125

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.
@@ -605,6 +605,7 @@ var TagTypes;
605
605
  class DrTagComponent {
606
606
  constructor() {
607
607
  this.dynamicTagValues = {};
608
+ this.connectedTags = [];
608
609
  this.tagChange = new EventEmitter(); // Not emit value for dynamic tag
609
610
  this.dynamicTagChange = new EventEmitter();
610
611
  this.dynamicTagAdd = new EventEmitter();
@@ -679,6 +680,10 @@ class DrTagComponent {
679
680
  this.connectedTags = map(this.connectedTags, tag => {
680
681
  if (tag.id === connectedDateTagConfig.id) {
681
682
  tag.value = event.value;
683
+ tag.locked = event.locked;
684
+ if (connectedDateTagConfig.type === TagTypes.DATE) {
685
+ tag.label = event.label;
686
+ }
682
687
  }
683
688
  return tag;
684
689
  });
@@ -711,7 +716,7 @@ class DrTagComponent {
711
716
  this.dateTag = {
712
717
  type: tagConfig.type,
713
718
  sub_type: tagConfig.options.sub_type,
714
- value: find(this.connectedTags, { id: tagConfig.id }).value,
719
+ value: (find(this.connectedTags, { id: tagConfig.id }) || {}).value,
715
720
  };
716
721
  }
717
722
  if (tagConfig.type === TagTypes.LIST) {
@@ -722,6 +727,13 @@ class DrTagComponent {
722
727
  value: (_a = tagConfig === null || tagConfig === void 0 ? void 0 : tagConfig.options) === null || _a === void 0 ? void 0 : _a.default_value,
723
728
  };
724
729
  }
730
+ if (!find(this.connectedTags, { id: tagConfig.id })) {
731
+ this.connectedTags.push({
732
+ id: tagConfig.id,
733
+ name: tagConfig.name,
734
+ value: undefined,
735
+ });
736
+ }
725
737
  });
726
738
  }
727
739
  }
@@ -2189,6 +2201,7 @@ class DrPopoverComponent {
2189
2201
  this.viewContainerRef = viewContainerRef;
2190
2202
  this.elementRef = elementRef;
2191
2203
  this.popoverRef = popoverRef;
2204
+ this.popoverOpened = new EventEmitter();
2192
2205
  this.class = '';
2193
2206
  this.isContentTemplate = false;
2194
2207
  this.popover = true;
@@ -2218,8 +2231,34 @@ class DrPopoverComponent {
2218
2231
  if (this.alignment === 'host') {
2219
2232
  this[getAlignmentDimension(this.position)] = '100%';
2220
2233
  }
2234
+ this.popoverOpened.emit();
2235
+ this.repositionToNewContainerAndFreeze();
2221
2236
  this.cdr.detectChanges();
2222
2237
  }
2238
+ /**
2239
+ * Removing popover element from cdk-overlay and attach to provided container after element is positioned
2240
+ * is required for specific case of preserving popover at same position on document while scroll (not fixed)
2241
+ *
2242
+ * TODO: implement more neat, transparent and Angular way solution: i.e. create another service (or extend existiong one)
2243
+ * without attaching component to cdk Overlay and instead positioning it to element passed in directive input parameter
2244
+ */
2245
+ repositionToNewContainerAndFreeze() {
2246
+ const newContainer = !!this.freezeToContainerSelector && document.querySelector(this.freezeToContainerSelector);
2247
+ if (newContainer) {
2248
+ // waiting until element is positioned on overlay
2249
+ setTimeout(() => {
2250
+ const element = this.elementRef.nativeElement;
2251
+ if (!element.closest('.cdk-overlay-container'))
2252
+ return;
2253
+ const position = element.getBoundingClientRect();
2254
+ const newContainerPosition = newContainer.getBoundingClientRect();
2255
+ element.style.position = 'absolute';
2256
+ element.style.top = `${newContainer.scrollTop + position.top - newContainerPosition.top}px`;
2257
+ element.style.left = `${newContainerPosition.left + position.left}px`;
2258
+ newContainer.appendChild(element);
2259
+ });
2260
+ }
2261
+ }
2223
2262
  }
2224
2263
  DrPopoverComponent.decorators = [
2225
2264
  { type: Component, args: [{
@@ -2240,6 +2279,7 @@ DrPopoverComponent.ctorParameters = () => [
2240
2279
  { type: DrPopoverRef }
2241
2280
  ];
2242
2281
  DrPopoverComponent.propDecorators = {
2282
+ popoverOpened: [{ type: Output }],
2243
2283
  content: [{ type: Input }],
2244
2284
  contentContext: [{ type: Input }],
2245
2285
  class: [{ type: Input }],
@@ -2247,6 +2287,7 @@ DrPopoverComponent.propDecorators = {
2247
2287
  manualClosing: [{ type: Input }],
2248
2288
  alignment: [{ type: Input }],
2249
2289
  position: [{ type: Input }],
2290
+ freezeToContainerSelector: [{ type: Input }],
2250
2291
  popoverContainer: [{ type: ViewChild, args: ['popoverContainer', { read: ElementRef, static: true },] }],
2251
2292
  width: [{ type: HostBinding, args: ['style.width',] }],
2252
2293
  height: [{ type: HostBinding, args: ['style.height',] }],
@@ -2270,7 +2311,7 @@ class DrPopoverService {
2270
2311
  this.registerListeners(model, overlayRef, popoverRef);
2271
2312
  return popoverRef;
2272
2313
  }
2273
- attachOverlayContainer(content, { contentContext, position, class: elementClass, manualClosing, hostRef, alignment }, overlayRef, popoverRef) {
2314
+ attachOverlayContainer(content, { contentContext, position, class: elementClass, manualClosing, hostRef, alignment, freezeToContainerSelector }, overlayRef, popoverRef) {
2274
2315
  const componentPortal = new ComponentPortal(DrPopoverComponent, null, this.createInjector(popoverRef));
2275
2316
  const contentRef = overlayRef.attach(componentPortal);
2276
2317
  popoverRef.componentRef = contentRef;
@@ -2281,6 +2322,7 @@ class DrPopoverService {
2281
2322
  contentRef.instance.hostRef = hostRef;
2282
2323
  contentRef.instance.alignment = alignment;
2283
2324
  contentRef.instance.position = position;
2325
+ contentRef.instance.freezeToContainerSelector = freezeToContainerSelector;
2284
2326
  }
2285
2327
  createOverlay(popoverModel) {
2286
2328
  const overlayConfig = this.getOverlayConfig(popoverModel);
@@ -2360,6 +2402,7 @@ class DrPopoverDirective {
2360
2402
  this.manualClosing = { enabled: false };
2361
2403
  // eslint-disable-next-line
2362
2404
  this.popoverClose = new EventEmitter();
2405
+ this.popoverOpened = new EventEmitter();
2363
2406
  // eslint-disable-next-line
2364
2407
  this.showStateChange = new EventEmitter();
2365
2408
  }
@@ -2389,12 +2432,16 @@ class DrPopoverDirective {
2389
2432
  position: this.position,
2390
2433
  contentContext: this.contentContext,
2391
2434
  alignment: this.alignment,
2435
+ freezeToContainerSelector: this.freezeToContainerSelector
2392
2436
  });
2393
2437
  popoverRef.onClose.pipe(first()).subscribe((res) => {
2394
2438
  this.closePopover();
2395
2439
  this.popoverClose.emit(res);
2396
2440
  this.showStateChange.emit({ isShown: !!this.popoverRef });
2397
2441
  });
2442
+ popoverRef.componentRef.instance.popoverOpened.pipe(first()).subscribe(() => {
2443
+ this.popoverOpened.emit();
2444
+ });
2398
2445
  }
2399
2446
  ngOnDestroy() {
2400
2447
  this.closePopover();
@@ -2418,7 +2465,9 @@ DrPopoverDirective.propDecorators = {
2418
2465
  manualClosing: [{ type: Input, args: ['drPopoverManualClosing',] }],
2419
2466
  alignment: [{ type: Input, args: ['drPopoverAlignment',] }],
2420
2467
  disabled: [{ type: Input, args: ['drPopoverDisabled',] }],
2468
+ freezeToContainerSelector: [{ type: Input, args: ['drPopoverFreezeToContainerSelector',] }],
2421
2469
  popoverClose: [{ type: Output, args: ['drPopoverClose',] }],
2470
+ popoverOpened: [{ type: Output, args: ['drPopoverOpened',] }],
2422
2471
  showStateChange: [{ type: Output, args: ['drPopoverShowStateChange',] }],
2423
2472
  togglePopover: [{ type: HostListener, args: ['click',] }]
2424
2473
  };
@@ -2790,6 +2839,7 @@ DrTabComponent.ctorParameters = () => [];
2790
2839
  DrTabComponent.propDecorators = {
2791
2840
  label: [{ type: Input }],
2792
2841
  disabled: [{ type: Input }],
2842
+ tooltip: [{ type: Input }],
2793
2843
  contentTemplate: [{ type: ViewChild, args: [TemplateRef,] }]
2794
2844
  };
2795
2845
 
@@ -2808,8 +2858,8 @@ class DrTabsComponent {
2808
2858
  DrTabsComponent.decorators = [
2809
2859
  { type: Component, args: [{
2810
2860
  selector: 'dr-tabs',
2811
- template: "<mat-tab-group disableRipple [selectedIndex]=\"selectedTab\"\n (selectedIndexChange)=\"selectedIndexChange($event)\"\n [class.with-radio]=\"withRadio\"\n [class.vertical]=\"vertical\"\n [class.no-tab-labels-padding]=\"noTabLabelsPadding\"\n [class.no-body-padding]=\"noBodyPadding\"\n [animationDuration]=\" vertical ? '0ms' : '500ms'\">\n <mat-tab *ngFor=\"let tab of tabsContentList; let index = index\" label=\"{{tab.label}}\" [disabled]=\"tab.disabled\">\n <ng-container *ngIf=\"withRadio\">\n <ng-template mat-tab-label>\n <dr-radio-button [value]=\"index\"\n [(ngModel)]=\"selectedTab\">\n </dr-radio-button>\n {{tab.label}}\n </ng-template>\n </ng-container>\n\n <ng-container *ngTemplateOutlet=\"tab.contentTemplate\"></ng-container>\n </mat-tab>\n</mat-tab-group>\n",
2812
- styles: [":host{width:100%}:host ::ng-deep .mat-tab-group,:host ::ng-deep .mat-tab-body-wrapper{height:100%}:host ::ng-deep .mat-tab-group{font-family:\"Poppins\",sans-serif}:host ::ng-deep .mat-tab-nav-bar,:host ::ng-deep .mat-tab-header{border-bottom:1px solid #d5dae5}:host ::ng-deep .mat-tab-labels{padding:0 17px}:host ::ng-deep .mat-tab-label{padding:0 8px;min-width:0;height:38px;opacity:1}:host ::ng-deep .mat-tab-label:not(:last-child){margin-right:21px}:host ::ng-deep .mat-tab-label-active .mat-tab-label-content{color:#4646ce;font-weight:700}:host ::ng-deep .mat-tab-label-content{font-weight:400;font-size:14px;line-height:22px;color:#51566f;font-family:\"Poppins\",sans-serif}:host ::ng-deep .mat-ink-bar{height:3px;border-radius:5px;background-color:#4646ce!important}:host ::ng-deep .with-radio .mat-tab-labels{padding:0;margin-bottom:8px}:host ::ng-deep .with-radio .mat-tab-label{padding:8px 16px;min-width:0;flex-grow:1;justify-content:start;height:38px;opacity:1}:host ::ng-deep .with-radio .mat-tab-label:not(:last-child){margin-right:8px}:host ::ng-deep .with-radio .mat-tab-label-active{background:#f6f7f8;border-radius:3px}:host ::ng-deep .with-radio .mat-tab-label-active .mat-tab-label-content{color:#0c142b;font-weight:600}:host ::ng-deep .with-radio .mat-ink-bar{display:none!important}:host ::ng-deep .vertical.mat-tab-group{flex-direction:row}:host ::ng-deep .vertical .mat-tab-header{border-bottom:none}:host ::ng-deep .vertical .mat-tab-label-container{border-right:1px solid #d5dae5}:host ::ng-deep .vertical .mat-tab-label-container .mat-tab-labels{flex-direction:column;padding:0}:host ::ng-deep .vertical .mat-ink-bar{display:none!important}:host ::ng-deep .vertical .mat-tab-label{border-bottom:1px solid #d5dae5;margin:0!important;justify-content:flex-start;padding:1rem 2rem;height:40px}:host ::ng-deep .vertical .mat-tab-label:before{content:\"\";width:2px;height:100%;display:flex;position:absolute;top:0;left:0}:host ::ng-deep .vertical .mat-tab-label-active{background-color:#f3f7ff}:host ::ng-deep .vertical .mat-tab-label-active:before{background-color:#151a41}:host ::ng-deep .vertical .mat-tab-label-active .mat-tab-label-content{font-weight:normal;color:#151a41}:host ::ng-deep .vertical .mat-tab-body-wrapper{width:100%;padding:16px}:host ::ng-deep mat-tab-group.no-body-padding .mat-tab-body-wrapper{padding:0}:host ::ng-deep mat-tab-group.no-tab-labels-padding .mat-tab-labels{padding:0}\n"]
2861
+ template: "<mat-tab-group disableRipple [selectedIndex]=\"selectedTab\"\n (selectedIndexChange)=\"selectedIndexChange($event)\"\n [class.with-radio]=\"withRadio\"\n [class.vertical]=\"vertical\"\n [class.no-tab-labels-padding]=\"noTabLabelsPadding\"\n [class.no-body-padding]=\"noBodyPadding\"\n [animationDuration]=\" vertical ? '0ms' : '500ms'\">\n <mat-tab *ngFor=\"let tab of tabsContentList; let index = index\" label=\"{{ tab.label }}\" [disabled]=\"tab.disabled\">\n <ng-container *ngIf=\"withRadio\">\n <ng-template mat-tab-label>\n <dr-radio-button [value]=\"index\"\n [(ngModel)]=\"selectedTab\">\n </dr-radio-button>\n {{ tab.label }}\n </ng-template>\n </ng-container>\n <ng-container *ngIf=\"tab.tooltip && !withRadio\">\n <ng-template mat-tab-label>\n <label class=\"cursor-pointer\" [drTooltip]=\"tab.tooltip\">{{ tab.label }}</label>\n </ng-template>\n </ng-container>\n <ng-container *ngTemplateOutlet=\"tab.contentTemplate\"></ng-container>\n </mat-tab>\n</mat-tab-group>\n",
2862
+ styles: [":host{width:100%}:host .cursor-pointer{cursor:pointer}:host ::ng-deep .mat-tab-group,:host ::ng-deep .mat-tab-body-wrapper{height:100%}:host ::ng-deep .mat-tab-group{font-family:\"Poppins\",sans-serif}:host ::ng-deep .mat-tab-nav-bar,:host ::ng-deep .mat-tab-header{border-bottom:1px solid #d5dae5}:host ::ng-deep .mat-tab-labels{padding:0 17px}:host ::ng-deep .mat-tab-label{padding:0 8px;min-width:0;height:38px;opacity:1}:host ::ng-deep .mat-tab-label:not(:last-child){margin-right:21px}:host ::ng-deep .mat-tab-label-active .mat-tab-label-content{color:#4646ce;font-weight:700}:host ::ng-deep .mat-tab-label-content{font-weight:400;font-size:14px;line-height:22px;color:#51566f;font-family:\"Poppins\",sans-serif}:host ::ng-deep .mat-ink-bar{height:3px;border-radius:5px;background-color:#4646ce!important}:host ::ng-deep .with-radio .mat-tab-labels{padding:0;margin-bottom:8px}:host ::ng-deep .with-radio .mat-tab-label{padding:8px 16px;min-width:0;flex-grow:1;justify-content:start;height:38px;opacity:1}:host ::ng-deep .with-radio .mat-tab-label:not(:last-child){margin-right:8px}:host ::ng-deep .with-radio .mat-tab-label-active{background:#f6f7f8;border-radius:3px}:host ::ng-deep .with-radio .mat-tab-label-active .mat-tab-label-content{color:#0c142b;font-weight:600}:host ::ng-deep .with-radio .mat-ink-bar{display:none!important}:host ::ng-deep .vertical.mat-tab-group{flex-direction:row}:host ::ng-deep .vertical .mat-tab-header{border-bottom:none}:host ::ng-deep .vertical .mat-tab-label-container{border-right:1px solid #d5dae5}:host ::ng-deep .vertical .mat-tab-label-container .mat-tab-labels{flex-direction:column;padding:0}:host ::ng-deep .vertical .mat-ink-bar{display:none!important}:host ::ng-deep .vertical .mat-tab-label{border-bottom:1px solid #d5dae5;margin:0!important;justify-content:flex-start;padding:1rem 2rem;height:40px}:host ::ng-deep .vertical .mat-tab-label:before{content:\"\";width:2px;height:100%;display:flex;position:absolute;top:0;left:0}:host ::ng-deep .vertical .mat-tab-label-active{background-color:#f3f7ff}:host ::ng-deep .vertical .mat-tab-label-active:before{background-color:#151a41}:host ::ng-deep .vertical .mat-tab-label-active .mat-tab-label-content{font-weight:normal;color:#151a41}:host ::ng-deep .vertical .mat-tab-body-wrapper{width:100%;padding:16px}:host ::ng-deep mat-tab-group.no-body-padding .mat-tab-body-wrapper{padding:0}:host ::ng-deep mat-tab-group.no-tab-labels-padding .mat-tab-labels{padding:0}\n"]
2813
2863
  },] }
2814
2864
  ];
2815
2865
  DrTabsComponent.ctorParameters = () => [];
@@ -4818,7 +4868,8 @@ DrTabsModule.decorators = [
4818
4868
  MatTabsModule,
4819
4869
  FormsModule,
4820
4870
  ReactiveFormsModule,
4821
- DrInputsModule
4871
+ DrInputsModule,
4872
+ DrTooltipModule
4822
4873
  ],
4823
4874
  exports: [
4824
4875
  DrTabsComponent,