@datarailsshared/datarailsshared 1.3.31 → 1.3.32

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,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { EventEmitter, Component, ViewEncapsulation, Input, Output, ChangeDetectionStrategy, ChangeDetectorRef, forwardRef, ElementRef, Inject, PLATFORM_ID, ContentChildren, Renderer2, HostBinding, ContentChild, Pipe, TemplateRef, Directive, HostListener, ComponentFactoryResolver, ViewContainerRef, ViewChild, Optional, Injector, Injectable, NgModule } from '@angular/core';
2
+ import { EventEmitter, Component, ViewEncapsulation, Input, Output, ChangeDetectionStrategy, ChangeDetectorRef, forwardRef, ElementRef, Inject, PLATFORM_ID, ContentChildren, Renderer2, HostBinding, ContentChild, Pipe, TemplateRef, Directive, HostListener, ComponentFactoryResolver, ViewContainerRef, ViewChild, Optional, Injector, Injectable, Host, NgModule } from '@angular/core';
3
3
  import { FormControl, NG_VALUE_ACCESSOR, NgControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
4
4
  import { DateAdapter, MAT_DATE_LOCALE, MAT_DATE_FORMATS, MatNativeDateModule } from '@angular/material/core';
5
5
  import { MomentDateAdapter, MAT_MOMENT_DATE_ADAPTER_OPTIONS, MatMomentDateModule } from '@angular/material-moment-adapter';
@@ -7,7 +7,7 @@ import * as momentImported from 'moment';
7
7
  import { isPlatformBrowser, DOCUMENT, CommonModule } from '@angular/common';
8
8
  import { Subject, from, merge, fromEvent, noop as noop$1 } from 'rxjs';
9
9
  import { startWith, switchMap, takeUntil, filter, first } from 'rxjs/operators';
10
- import { transition, style, animate, trigger } from '@angular/animations';
10
+ import { transition, style, animate, trigger, state } from '@angular/animations';
11
11
  import * as i1 from '@angular/cdk/overlay';
12
12
  import { Overlay, OverlayPositionBuilder, OverlayConfig } from '@angular/cdk/overlay';
13
13
  import { ComponentPortal } from '@angular/cdk/portal';
@@ -876,7 +876,7 @@ class RadioGroupComponent {
876
876
  this.updateDisabled();
877
877
  }
878
878
  ngAfterContentInit() {
879
- // In case option 'name' isn't set on nb-radio component,
879
+ // In case option 'name' isn't set on dr-radio component,
880
880
  // we need to set it's name right away, so it won't overlap with options
881
881
  // without names from other radio groups. Otherwise they all would have
882
882
  // same name and will be considered as options from one group so only the
@@ -2690,6 +2690,292 @@ DrTabsComponent.propDecorators = {
2690
2690
  tabsContentList: [{ type: ContentChildren, args: [DrTabComponent,] }]
2691
2691
  };
2692
2692
 
2693
+ class DrAccordionComponent {
2694
+ constructor() {
2695
+ this.openCloseItems = new Subject();
2696
+ this.multiValue = false;
2697
+ }
2698
+ /**
2699
+ * Allow multiple items to be expanded at the same time.
2700
+ */
2701
+ get multi() {
2702
+ return this.multiValue;
2703
+ }
2704
+ set multi(val) {
2705
+ this.multiValue = !!val;
2706
+ }
2707
+ /**
2708
+ * Opens all enabled accordion items.
2709
+ */
2710
+ openAll() {
2711
+ if (this.multi) {
2712
+ this.openCloseItems.next(false);
2713
+ }
2714
+ }
2715
+ /**
2716
+ * Closes all enabled accordion items.
2717
+ */
2718
+ closeAll() {
2719
+ this.openCloseItems.next(true);
2720
+ }
2721
+ }
2722
+ DrAccordionComponent.decorators = [
2723
+ { type: Component, args: [{
2724
+ selector: 'dr-accordion',
2725
+ template: '<ng-content select="dr-accordion-item"></ng-content>',
2726
+ changeDetection: ChangeDetectionStrategy.OnPush,
2727
+ styles: [":host{display:block;box-shadow:#2c33491a 0 5px 10px}\n"]
2728
+ },] }
2729
+ ];
2730
+ DrAccordionComponent.propDecorators = {
2731
+ multi: [{ type: Input, args: ['multi',] }]
2732
+ };
2733
+
2734
+ class DrAccordionItemComponent {
2735
+ constructor(accordion, cd) {
2736
+ this.accordion = accordion;
2737
+ this.cd = cd;
2738
+ /**
2739
+ * Emits whenever the expanded state of the accordion changes.
2740
+ * Primarily used to facilitate two-way binding.
2741
+ */
2742
+ this.collapsedChange = new EventEmitter();
2743
+ this.accordionItemInvalidate = new Subject();
2744
+ this.collapsedValue = true;
2745
+ this.disabledValue = false;
2746
+ this.destroy$ = new Subject();
2747
+ }
2748
+ /**
2749
+ * Item is collapse (`true` by default)
2750
+ * @type {boolean}
2751
+ */
2752
+ get collapsed() {
2753
+ return this.collapsedValue;
2754
+ }
2755
+ set collapsed(val) {
2756
+ this.collapsedValue = !!val;
2757
+ this.collapsedChange.emit(this.collapsedValue);
2758
+ this.invalidate();
2759
+ }
2760
+ /**
2761
+ * Item is expanded (`false` by default)
2762
+ */
2763
+ get expanded() {
2764
+ return !this.collapsed;
2765
+ }
2766
+ set expanded(val) {
2767
+ this.collapsedValue = !val;
2768
+ }
2769
+ /**
2770
+ * Item is disabled and cannot be opened.
2771
+ * @type {boolean}
2772
+ */
2773
+ get disabled() {
2774
+ return this.disabledValue;
2775
+ }
2776
+ set disabled(val) {
2777
+ this.disabledValue = !!val;
2778
+ this.invalidate();
2779
+ }
2780
+ /**
2781
+ * Open/close the item
2782
+ */
2783
+ toggle() {
2784
+ if (!this.disabled) {
2785
+ // we need this temporary variable as `openCloseItems.next` will change current value we need to save
2786
+ const willSet = !this.collapsed;
2787
+ if (!this.accordion.multi) {
2788
+ this.accordion.openCloseItems.next(true);
2789
+ }
2790
+ this.collapsed = willSet;
2791
+ }
2792
+ }
2793
+ /**
2794
+ * Open the item.
2795
+ */
2796
+ open() {
2797
+ if (!this.disabled) {
2798
+ this.collapsed = false;
2799
+ }
2800
+ }
2801
+ /**
2802
+ * Collapse the item.
2803
+ */
2804
+ close() {
2805
+ if (!this.disabled) {
2806
+ this.collapsed = true;
2807
+ }
2808
+ }
2809
+ ngOnInit() {
2810
+ this.accordion.openCloseItems
2811
+ .pipe(takeUntil(this.destroy$))
2812
+ .subscribe(collapsed => {
2813
+ if (!this.disabled) {
2814
+ this.collapsed = collapsed;
2815
+ }
2816
+ });
2817
+ }
2818
+ ngOnChanges(changes) {
2819
+ this.accordionItemInvalidate.next(true);
2820
+ }
2821
+ ngOnDestroy() {
2822
+ this.destroy$.next();
2823
+ this.destroy$.complete();
2824
+ this.accordionItemInvalidate.complete();
2825
+ }
2826
+ invalidate() {
2827
+ this.accordionItemInvalidate.next(true);
2828
+ this.cd.markForCheck();
2829
+ }
2830
+ }
2831
+ DrAccordionItemComponent.decorators = [
2832
+ { type: Component, args: [{
2833
+ selector: 'dr-accordion-item',
2834
+ template: `
2835
+ <ng-content select="dr-accordion-item-header"></ng-content>
2836
+ <ng-content select="dr-accordion-item-body"></ng-content>
2837
+ `,
2838
+ changeDetection: ChangeDetectionStrategy.OnPush,
2839
+ styles: [":host{background-color:#fff;color:#222b45;font-family:\"Poppins\",sans-serif;font-size:16px;font-weight:400;line-height:1.25rem;display:flex;flex-direction:column}\n"]
2840
+ },] }
2841
+ ];
2842
+ DrAccordionItemComponent.ctorParameters = () => [
2843
+ { type: DrAccordionComponent, decorators: [{ type: Host }] },
2844
+ { type: ChangeDetectorRef }
2845
+ ];
2846
+ DrAccordionItemComponent.propDecorators = {
2847
+ collapsed: [{ type: Input, args: ['collapsed',] }, { type: HostBinding, args: ['class.collapsed',] }],
2848
+ expanded: [{ type: Input, args: ['expanded',] }, { type: HostBinding, args: ['class.expanded',] }],
2849
+ disabled: [{ type: Input, args: ['disabled',] }, { type: HostBinding, args: ['class.disabled',] }],
2850
+ collapsedChange: [{ type: Output }]
2851
+ };
2852
+
2853
+ class DrAccordionItemHeaderComponent {
2854
+ constructor(accordionItem, cd) {
2855
+ this.accordionItem = accordionItem;
2856
+ this.cd = cd;
2857
+ this.destroy$ = new Subject();
2858
+ }
2859
+ get isCollapsed() {
2860
+ return this.accordionItem.collapsed;
2861
+ }
2862
+ get expanded() {
2863
+ return !this.accordionItem.collapsed;
2864
+ }
2865
+ get tabbable() {
2866
+ return this.accordionItem.disabled ? '-1' : '0';
2867
+ }
2868
+ get disabled() {
2869
+ return this.accordionItem.disabled;
2870
+ }
2871
+ toggle() {
2872
+ this.accordionItem.toggle();
2873
+ }
2874
+ get state() {
2875
+ if (this.isCollapsed) {
2876
+ return 'collapsed';
2877
+ }
2878
+ return 'expanded';
2879
+ }
2880
+ ngOnInit() {
2881
+ this.accordionItem.accordionItemInvalidate
2882
+ .pipe(takeUntil(this.destroy$))
2883
+ .subscribe(() => this.cd.markForCheck());
2884
+ }
2885
+ ngOnDestroy() {
2886
+ this.destroy$.next();
2887
+ this.destroy$.complete();
2888
+ }
2889
+ }
2890
+ DrAccordionItemHeaderComponent.decorators = [
2891
+ { type: Component, args: [{
2892
+ selector: 'dr-accordion-item-header',
2893
+ template: `
2894
+ <ng-content select="dr-accordion-item-title"></ng-content>
2895
+ <ng-content select="dr-accordion-item-description"></ng-content>
2896
+ <ng-content></ng-content>
2897
+ <i class="dr-icon-arrow-down expansion-indicator"
2898
+ [@expansionIndicator]="state"
2899
+ *ngIf="!disabled">
2900
+ </i>
2901
+ `,
2902
+ animations: [
2903
+ trigger('expansionIndicator', [
2904
+ state('expanded', style({
2905
+ transform: 'rotate(180deg)',
2906
+ })),
2907
+ transition('collapsed => expanded', animate('100ms ease-in')),
2908
+ transition('expanded => collapsed', animate('100ms ease-out')),
2909
+ ]),
2910
+ ],
2911
+ changeDetection: ChangeDetectionStrategy.OnPush,
2912
+ styles: [":host{display:flex;align-items:center;cursor:pointer;position:relative;border-bottom:1px solid #edf1f7;color:#222b45;font-family:\"Poppins\",sans-serif;font-size:13px;font-weight:600;line-height:1.5rem;padding:1.25rem;text-transform:capitalize}:host:focus{outline:0}:host .expansion-indicator{font-size:24px;position:absolute;right:10px;font-weight:700}\n"]
2913
+ },] }
2914
+ ];
2915
+ DrAccordionItemHeaderComponent.ctorParameters = () => [
2916
+ { type: DrAccordionItemComponent, decorators: [{ type: Host }] },
2917
+ { type: ChangeDetectorRef }
2918
+ ];
2919
+ DrAccordionItemHeaderComponent.propDecorators = {
2920
+ isCollapsed: [{ type: HostBinding, args: ['class.accordion-item-header-collapsed',] }],
2921
+ expanded: [{ type: HostBinding, args: ['class.accordion-item-header-expanded',] }, { type: HostBinding, args: ['attr.aria-expanded',] }],
2922
+ tabbable: [{ type: HostBinding, args: ['attr.tabindex',] }],
2923
+ disabled: [{ type: HostBinding, args: ['attr.aria-disabled',] }],
2924
+ toggle: [{ type: HostListener, args: ['click',] }, { type: HostListener, args: ['keydown.space',] }, { type: HostListener, args: ['keydown.enter',] }]
2925
+ };
2926
+
2927
+ const accordionItemBodyTrigger = trigger('accordionItemBody', [
2928
+ state('collapsed', style({
2929
+ overflow: 'hidden',
2930
+ visibility: 'hidden',
2931
+ height: 0,
2932
+ })),
2933
+ state('expanded', style({
2934
+ overflow: 'hidden',
2935
+ visibility: 'visible',
2936
+ })),
2937
+ transition('collapsed => expanded', animate('100ms ease-in')),
2938
+ transition('expanded => collapsed', animate('100ms ease-out')),
2939
+ ]);
2940
+ class DrAccordionItemBodyComponent {
2941
+ constructor(accordionItem, cd) {
2942
+ this.accordionItem = accordionItem;
2943
+ this.cd = cd;
2944
+ this.destroy$ = new Subject();
2945
+ }
2946
+ get state() {
2947
+ return this.accordionItem.collapsed ? 'collapsed' : 'expanded';
2948
+ }
2949
+ ngOnInit() {
2950
+ this.accordionItem.accordionItemInvalidate
2951
+ .pipe(takeUntil(this.destroy$))
2952
+ .subscribe(() => this.cd.markForCheck());
2953
+ }
2954
+ ngOnDestroy() {
2955
+ this.destroy$.next();
2956
+ this.destroy$.complete();
2957
+ }
2958
+ }
2959
+ DrAccordionItemBodyComponent.decorators = [
2960
+ { type: Component, args: [{
2961
+ selector: 'dr-accordion-item-body',
2962
+ template: `
2963
+ <div [@accordionItemBody]="{ value: state }">
2964
+ <div class="item-body">
2965
+ <ng-content></ng-content>
2966
+ </div>
2967
+ </div>
2968
+ `,
2969
+ animations: [accordionItemBodyTrigger],
2970
+ changeDetection: ChangeDetectionStrategy.OnPush,
2971
+ styles: [".item-body{flex:1;-ms-flex:1 1 auto;overflow:auto;position:relative}\n"]
2972
+ },] }
2973
+ ];
2974
+ DrAccordionItemBodyComponent.ctorParameters = () => [
2975
+ { type: DrAccordionItemComponent, decorators: [{ type: Host }] },
2976
+ { type: ChangeDetectorRef }
2977
+ ];
2978
+
2693
2979
  const components$2 = [DateTagComponent,
2694
2980
  DayTagComponent,
2695
2981
  WeekTagComponent,
@@ -2910,11 +3196,28 @@ DrTabsModule.decorators = [
2910
3196
  },] }
2911
3197
  ];
2912
3198
 
3199
+ const DR_ACCORDION_COMPONENTS = [
3200
+ DrAccordionComponent,
3201
+ DrAccordionItemComponent,
3202
+ DrAccordionItemHeaderComponent,
3203
+ DrAccordionItemBodyComponent,
3204
+ ];
3205
+ class DrAccordionModule {
3206
+ }
3207
+ DrAccordionModule.decorators = [
3208
+ { type: NgModule, args: [{
3209
+ imports: [CommonModule],
3210
+ exports: [...DR_ACCORDION_COMPONENTS],
3211
+ declarations: [...DR_ACCORDION_COMPONENTS],
3212
+ providers: [],
3213
+ },] }
3214
+ ];
3215
+
2913
3216
  /* components */
2914
3217
 
2915
3218
  /**
2916
3219
  * Generated bundle index. Do not edit.
2917
3220
  */
2918
3221
 
2919
- export { AnyTagComponent, CheckboxComponent, DateTagComponent, DateTagModule, DayTagComponent, DrAvatarComponent, DrAvatarModule, DrAvatarPipe, DrButtonComponent, DrDatePickerComponent, DrDatePickerFormatDirective, DrDropdownComponent, DrDropdownDirective, DrDropdownItemShowPipe, DrDropdownModule, DrDropdownPositionDirective, DrDropdownService, DrInputComponent, DrInputsModule, DrPopoverAlignmentDimension, DrPopoverComponent, DrPopoverDirective, DrPopoverModule, DrPopoverRef, DrPopoverService, DrSelectComponent, DrSpinnerComponent, DrSpinnerDirective, DrSpinnerModule, DrTabComponent, DrTabsComponent, DrTabsModule, DrTagComponent, DrTagModule, DrToggleButtonComponent, DrToggleComponent, DrTooltipDirective, DrTooltipModule, ForecastTagComponent, ISpinnerOptions, ListTagComponent, ListTagModule, MonthTagComponent, QuarterTagComponent, RadioButtonComponent, RadioGroupComponent, TooltipComponent, WeekTagComponent, YearTagComponent, components$2 as ɵa, POPUP_ANIMATION as ɵb, CustomDateFormat as ɵc };
3222
+ export { AnyTagComponent, CheckboxComponent, DateTagComponent, DateTagModule, DayTagComponent, DrAccordionComponent, DrAccordionItemBodyComponent, DrAccordionItemComponent, DrAccordionItemHeaderComponent, DrAccordionModule, DrAvatarComponent, DrAvatarModule, DrAvatarPipe, DrButtonComponent, DrDatePickerComponent, DrDatePickerFormatDirective, DrDropdownComponent, DrDropdownDirective, DrDropdownItemShowPipe, DrDropdownModule, DrDropdownPositionDirective, DrDropdownService, DrInputComponent, DrInputsModule, DrPopoverAlignmentDimension, DrPopoverComponent, DrPopoverDirective, DrPopoverModule, DrPopoverRef, DrPopoverService, DrSelectComponent, DrSpinnerComponent, DrSpinnerDirective, DrSpinnerModule, DrTabComponent, DrTabsComponent, DrTabsModule, DrTagComponent, DrTagModule, DrToggleButtonComponent, DrToggleComponent, DrTooltipDirective, DrTooltipModule, ForecastTagComponent, ISpinnerOptions, ListTagComponent, ListTagModule, MonthTagComponent, QuarterTagComponent, RadioButtonComponent, RadioGroupComponent, TooltipComponent, WeekTagComponent, YearTagComponent, components$2 as ɵa, POPUP_ANIMATION as ɵb, CustomDateFormat as ɵc };
2920
3223
  //# sourceMappingURL=datarailsshared-datarailsshared.js.map