@recursyve/nice-ui-kit.v2 14.0.0-beta.107 → 14.0.0-beta.108

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.
@@ -7056,6 +7056,123 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
7056
7056
  }]
7057
7057
  }] });
7058
7058
 
7059
+ // tslint:disable-next-line:class-name directive-class-suffix
7060
+ class _HintComponentBase {
7061
+ constructor(_changeDetectorRef) {
7062
+ this._changeDetectorRef = _changeDetectorRef;
7063
+ /** Whether interactions on the page should close the tooltip */
7064
+ this._closeOnInteraction = false;
7065
+ /** Whether the tooltip is currently visible. */
7066
+ this._isVisible = false;
7067
+ /** Subject for notifying that the tooltip has been hidden from the view */
7068
+ this._onHide = new Subject();
7069
+ }
7070
+ /**
7071
+ * Shows the tooltip with an animation originating from the provided origin
7072
+ * @param delay Amount of milliseconds to the delay showing the tooltip.
7073
+ */
7074
+ show(delay) {
7075
+ // Cancel the delayed hide if it is scheduled
7076
+ clearTimeout(this._hideTimeoutId);
7077
+ this._showTimeoutId = setTimeout(() => {
7078
+ this._toggleVisibility(true);
7079
+ this._showTimeoutId = undefined;
7080
+ }, delay);
7081
+ }
7082
+ /**
7083
+ * Begins the animation to hide the tooltip after the provided delay in ms.
7084
+ * @param delay Amount of milliseconds to delay showing the tooltip.
7085
+ */
7086
+ hide(delay) {
7087
+ // Cancel the delayed show if it is scheduled
7088
+ clearTimeout(this._showTimeoutId);
7089
+ this._hideTimeoutId = setTimeout(() => {
7090
+ this._toggleVisibility(false);
7091
+ this._hideTimeoutId = undefined;
7092
+ }, delay);
7093
+ }
7094
+ /** Returns an observable that notifies when the tooltip has been hidden from view. */
7095
+ afterHidden() {
7096
+ return this._onHide;
7097
+ }
7098
+ /** Whether the tooltip is being displayed. */
7099
+ isVisible() {
7100
+ return this._isVisible;
7101
+ }
7102
+ ngOnDestroy() {
7103
+ this._cancelPendingAnimations();
7104
+ this._onHide.complete();
7105
+ this._triggerElement = null;
7106
+ }
7107
+ /**
7108
+ * Interactions on the HTML body should close the tooltip immediately as defined in the
7109
+ * material design spec.
7110
+ * https://material.io/design/components/tooltips.html#behavior
7111
+ */
7112
+ _handleBodyInteraction() {
7113
+ if (this._closeOnInteraction) {
7114
+ this.hide(0);
7115
+ }
7116
+ }
7117
+ /**
7118
+ * Marks that the tooltip needs to be checked in the next change detection run.
7119
+ * Mainly used for rendering the initial text before positioning a tooltip, which
7120
+ * can be problematic in components with OnPush change detection.
7121
+ */
7122
+ _markForCheck() {
7123
+ this._changeDetectorRef.markForCheck();
7124
+ }
7125
+ _handleMouseLeave({ relatedTarget }) {
7126
+ if (!relatedTarget || !this._triggerElement.contains(relatedTarget)) {
7127
+ if (this.isVisible()) {
7128
+ this.hide(this._mouseLeaveHideDelay);
7129
+ }
7130
+ else {
7131
+ this._finalizeAnimation(false);
7132
+ }
7133
+ }
7134
+ }
7135
+ /**
7136
+ * Callback for when the timeout in this.show() gets completed.
7137
+ * This method is only needed by the mdc-tooltip, and so it is only implemented
7138
+ * in the mdc-tooltip, not here.
7139
+ */
7140
+ _onShow() { }
7141
+ /** Cancels any pending animation sequences. */
7142
+ _cancelPendingAnimations() {
7143
+ clearTimeout(this._showTimeoutId);
7144
+ clearTimeout(this._hideTimeoutId);
7145
+ this._showTimeoutId = this._hideTimeoutId = undefined;
7146
+ }
7147
+ /** Handles the cleanup after an animation has finished. */
7148
+ _finalizeAnimation(toVisible) {
7149
+ if (toVisible) {
7150
+ this._closeOnInteraction = true;
7151
+ }
7152
+ else if (!this.isVisible()) {
7153
+ this._onHide.next();
7154
+ }
7155
+ }
7156
+ /** Toggles the visibility of the tooltip element. */
7157
+ _toggleVisibility(isVisible) {
7158
+ // We set the classes directly here ourselves so that toggling the tooltip state
7159
+ // isn't bound by change detection. This allows us to hide it even if the
7160
+ // view ref has been detached from the CD tree.
7161
+ this._isVisible = isVisible;
7162
+ if (isVisible) {
7163
+ this._onShow();
7164
+ }
7165
+ }
7166
+ }
7167
+ _HintComponentBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: _HintComponentBase, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
7168
+ _HintComponentBase.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.3", type: _HintComponentBase, host: { listeners: { "mouseleave": "_handleMouseLeave($event)" } }, ngImport: i0 });
7169
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: _HintComponentBase, decorators: [{
7170
+ type: Directive
7171
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { _handleMouseLeave: [{
7172
+ type: HostListener,
7173
+ args: ["mouseleave", ["$event"]]
7174
+ }] } });
7175
+
7059
7176
  class NiceNavigationService {
7060
7177
  /**
7061
7178
  * Constructor
@@ -7900,12 +8017,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
7900
8017
  }] });
7901
8018
 
7902
8019
  class NiceShowHintDirective {
7903
- constructor(_overlay, _elementRef, _viewContainerRef, _ngZone, _platform, _hintService) {
8020
+ constructor(_overlay, _elementRef, _viewContainerRef, _ngZone, _platform, _focusMonitor, _hintService) {
7904
8021
  this._overlay = _overlay;
7905
8022
  this._elementRef = _elementRef;
7906
8023
  this._viewContainerRef = _viewContainerRef;
7907
8024
  this._ngZone = _ngZone;
7908
8025
  this._platform = _platform;
8026
+ this._focusMonitor = _focusMonitor;
7909
8027
  this._hintService = _hintService;
7910
8028
  this.shouldShow = false;
7911
8029
  this._pointerExitEventsInitialized = false;
@@ -7914,9 +8032,18 @@ class NiceShowHintDirective {
7914
8032
  }
7915
8033
  ngAfterViewInit() {
7916
8034
  this._setupPointerEnterEventsIfNeeded();
7917
- if (this.item.hint) {
7918
- this._portal = new ComponentPortal(this.item.hint.component, this._viewContainerRef);
7919
- }
8035
+ this._focusMonitor
8036
+ .monitor(this._elementRef)
8037
+ .pipe(takeUntil(this.unsubscribeAll$))
8038
+ .subscribe(origin => {
8039
+ // Note that the focus monitor runs outside the Angular zone.
8040
+ if (!origin) {
8041
+ this._ngZone.run(() => this.hide());
8042
+ }
8043
+ else if (origin === "keyboard") {
8044
+ this._ngZone.run(() => this.show());
8045
+ }
8046
+ });
7920
8047
  }
7921
8048
  ngOnDestroy() {
7922
8049
  this.unsubscribeAll$.next();
@@ -7927,15 +8054,26 @@ class NiceShowHintDirective {
7927
8054
  return;
7928
8055
  }
7929
8056
  const overlayRef = this._createOverlay();
8057
+ this._portal = this._portal || new ComponentPortal(this.item.hint.component);
7930
8058
  this._detach();
7931
8059
  this._hintInstance = overlayRef.attach(this._portal).instance;
8060
+ this._hintInstance._triggerElement = this._elementRef.nativeElement;
8061
+ this._hintInstance
8062
+ .afterHidden()
8063
+ .pipe(takeUntil(this.unsubscribeAll$))
8064
+ .subscribe(() => this._detach());
7932
8065
  this._hintService.setActiveHint(true);
7933
8066
  }
7934
8067
  hide() {
7935
8068
  const instance = this._hintInstance;
7936
8069
  if (instance) {
7937
- this._detach();
7938
- this._hintService.setActiveHint(false);
8070
+ if (instance.isVisible()) {
8071
+ instance.hide(0);
8072
+ }
8073
+ else {
8074
+ instance._cancelPendingAnimations();
8075
+ this._detach();
8076
+ }
7939
8077
  }
7940
8078
  }
7941
8079
  _createOverlay() {
@@ -7978,10 +8116,10 @@ class NiceShowHintDirective {
7978
8116
  .detachments()
7979
8117
  .pipe(takeUntil(this.unsubscribeAll$))
7980
8118
  .subscribe(() => this._detach());
7981
- /*this._overlayRef
8119
+ this._overlayRef
7982
8120
  .outsidePointerEvents()
7983
8121
  .pipe(takeUntil(this.unsubscribeAll$))
7984
- .subscribe(() => this._hintInstance?._handleBodyInteraction());*/
8122
+ .subscribe(() => this._hintInstance?._handleBodyInteraction());
7985
8123
  return this._overlayRef;
7986
8124
  }
7987
8125
  _detach() {
@@ -8040,12 +8178,12 @@ class NiceShowHintDirective {
8040
8178
  });
8041
8179
  }
8042
8180
  }
8043
- NiceShowHintDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceShowHintDirective, deps: [{ token: i1$5.Overlay }, { token: i0.ElementRef }, { token: i0.ViewContainerRef }, { token: i0.NgZone }, { token: i1$d.Platform }, { token: NiceNavigationHintService }], target: i0.ɵɵFactoryTarget.Directive });
8181
+ NiceShowHintDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceShowHintDirective, deps: [{ token: i1$5.Overlay }, { token: i0.ElementRef }, { token: i0.ViewContainerRef }, { token: i0.NgZone }, { token: i1$d.Platform }, { token: i2$2.FocusMonitor }, { token: NiceNavigationHintService }], target: i0.ɵɵFactoryTarget.Directive });
8044
8182
  NiceShowHintDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.3", type: NiceShowHintDirective, selector: "[niceShowHint]", inputs: { shouldShow: "shouldShow", item: "item" }, ngImport: i0 });
8045
8183
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: NiceShowHintDirective, decorators: [{
8046
8184
  type: Directive,
8047
8185
  args: [{ selector: "[niceShowHint]" }]
8048
- }], ctorParameters: function () { return [{ type: i1$5.Overlay }, { type: i0.ElementRef }, { type: i0.ViewContainerRef }, { type: i0.NgZone }, { type: i1$d.Platform }, { type: NiceNavigationHintService }]; }, propDecorators: { shouldShow: [{
8186
+ }], ctorParameters: function () { return [{ type: i1$5.Overlay }, { type: i0.ElementRef }, { type: i0.ViewContainerRef }, { type: i0.NgZone }, { type: i1$d.Platform }, { type: i2$2.FocusMonitor }, { type: NiceNavigationHintService }]; }, propDecorators: { shouldShow: [{
8049
8187
  type: Input
8050
8188
  }], item: [{
8051
8189
  type: Input
@@ -10578,5 +10716,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
10578
10716
  * Generated bundle index. Do not edit.
10579
10717
  */
10580
10718
 
10581
- export { ArrayUtils, BooleanPipe, CapitalizeFirstLetterPipe, CarouselComponent, CaseUtils, CeilPipe, ChipListItemLabelDirective, ColorsUtils, DateUtils, DefaultExportBottomSheetService, EntriesPipe, ExportBottomSheetComponent, ExportBottomSheetService, FileUtils, FindByKeyPipe, FirstLetterPipe, FloorPipe, FontAwesomeUtils, FormDataUtils, HttpStatusCodes, ImgCropperConfig, ImgCropperError, ImgResolution, JoinPipe, KeyboardCodes, LinkPipe, LocalizedBooleanPipe, LocalizedCurrencyPipe, LocalizedDateOnlyPipe, LocalizedDatePipe, MinutesToTimePipe, ModalMode, NavigationHideItemResolver, NavigationHintResolver, NiceAlertComponent, NiceAlertModule, NiceAlertService, NiceApiException, NiceAssetsCarouselActiveContentDirective, NiceAssetsCarouselComponent, NiceAssetsCarouselModule, NiceAsyncTypeaheadComponent, NiceAsyncTypeaheadModule, NiceAsyncTypeaheadProvider, NiceAutofocusDirective, NiceAutofocusDirectiveModule, NiceAutogrowDirective, NiceAutogrowModule, NiceBaseForm, NiceBaseFormComponent, NiceBaseFormModule, NiceCardComponent, NiceCardModule, NiceCarouselModule, NiceChipAsyncTypeaheadDirective, NiceChipListDirective, NiceChipListDirectiveModule, NiceChipListItemsComponent, NiceClickStopPropagationDirective, NiceCollapsableComponent, NiceCollapsableModule, NiceConfigModule, NiceConfigService, NiceControlStatusDirective, NiceCropperAreaComponent, NiceDateRangePickerComponent, NiceDateRangePickerModule, NiceDrawerComponent, NiceDrawerModule, NiceDrawerService, NiceDropzoneDirective, NiceDropzoneModule, NiceExportBottomSheetModule, NiceFormErrorComponent, NiceFormErrorModule, NiceFormSubmitDirective, NiceHorizontalNavigationBasicItemComponent, NiceHorizontalNavigationBranchItemComponent, NiceHorizontalNavigationComponent, NiceHorizontalNavigationDividerItemComponent, NiceHorizontalNavigationSpacerItemComponent, NiceHorizontalStepperComponent, NiceHorizontalStepperModule, NiceHttpExceptionFactory, NiceImageCropperComponent, NiceImageCropperModule, NiceImageErrorPlaceholderDirective, NiceImageErrorPlaceholderDirectiveModule, NiceLayoutComponent, NiceLayoutModule, NiceLoadingDirective, NiceLoadingSpinnerComponent, NiceLoadingSpinnerModule, NiceLottieComponent, NiceLottieModule, NiceMaterialModule, NiceMaterialStyleDirective, NiceMediaWatcherModule, NiceMediaWatcherService, NiceModalOnClickDirective, NiceModalOpenerDirective, NiceModule, NiceNavigationComponent, NiceNavigationModule, NiceNavigationService, NicePipesModule, NicePreventCloseWindowDirective, NiceRoundedStyleDirective, NiceScrollResetDirective, NiceScrollResetModule, NiceScrollbarDirective, NiceScrollbarModule, NiceSearchBarComponent, NiceSearchBarModule, NiceSplashScreenModule, NiceSplashScreenService, NiceStepComponent, NiceStopPropagationModule, NiceSweetAlertComponent, NiceSweetAlertDirective, NiceSweetAlertModule, NiceSweetAlertService, NiceToastComponent, NiceToastModule, NiceToastService, NiceToggleButtonGroupModule, NiceTransformResponseInterceptor, NiceTypeaheadComponent, NiceTypeaheadModule, NiceTypeaheadNewValue, NiceUtilsModule, NiceUtilsService, NiceVerticalNavigationAsideItemComponent, NiceVerticalNavigationBasicItemComponent, NiceVerticalNavigationCollapsableItemComponent, NiceVerticalNavigationComponent, NiceVerticalNavigationDividerItemComponent, NiceVerticalNavigationGroupItemComponent, NiceVerticalNavigationSpacerItemComponent, NiceWindowDirectiveModule, NumberToOrdinalIndicatorPipe, NumberUtils, ObjectUtils, OptionsScrollDirective, PadPipe, PhonePipe, PictureModalComponent, PictureModalService, PostalCodePipe, PromiseUtils, QueryParamsUtils, RangePipe, RegexUtils, RoundPipe, SanitizeBypassPipe, SecondsToTimePipe, TRANSFORM_TYPE, ToggleButtonComponent, ToggleButtonGroupComponent, TrackByPropPipe, TypeUtils, UrlUtils, _normalizeDegrees, isNotNullOrUndefined, isNullOrUndefined, mergeDeep, mixinNiceApi, niceAnimations, round };
10719
+ export { ArrayUtils, BooleanPipe, CapitalizeFirstLetterPipe, CarouselComponent, CaseUtils, CeilPipe, ChipListItemLabelDirective, ColorsUtils, DateUtils, DefaultExportBottomSheetService, EntriesPipe, ExportBottomSheetComponent, ExportBottomSheetService, FileUtils, FindByKeyPipe, FirstLetterPipe, FloorPipe, FontAwesomeUtils, FormDataUtils, HttpStatusCodes, ImgCropperConfig, ImgCropperError, ImgResolution, JoinPipe, KeyboardCodes, LinkPipe, LocalizedBooleanPipe, LocalizedCurrencyPipe, LocalizedDateOnlyPipe, LocalizedDatePipe, MinutesToTimePipe, ModalMode, NavigationHideItemResolver, NavigationHintResolver, NiceAlertComponent, NiceAlertModule, NiceAlertService, NiceApiException, NiceAssetsCarouselActiveContentDirective, NiceAssetsCarouselComponent, NiceAssetsCarouselModule, NiceAsyncTypeaheadComponent, NiceAsyncTypeaheadModule, NiceAsyncTypeaheadProvider, NiceAutofocusDirective, NiceAutofocusDirectiveModule, NiceAutogrowDirective, NiceAutogrowModule, NiceBaseForm, NiceBaseFormComponent, NiceBaseFormModule, NiceCardComponent, NiceCardModule, NiceCarouselModule, NiceChipAsyncTypeaheadDirective, NiceChipListDirective, NiceChipListDirectiveModule, NiceChipListItemsComponent, NiceClickStopPropagationDirective, NiceCollapsableComponent, NiceCollapsableModule, NiceConfigModule, NiceConfigService, NiceControlStatusDirective, NiceCropperAreaComponent, NiceDateRangePickerComponent, NiceDateRangePickerModule, NiceDrawerComponent, NiceDrawerModule, NiceDrawerService, NiceDropzoneDirective, NiceDropzoneModule, NiceExportBottomSheetModule, NiceFormErrorComponent, NiceFormErrorModule, NiceFormSubmitDirective, NiceHorizontalNavigationBasicItemComponent, NiceHorizontalNavigationBranchItemComponent, NiceHorizontalNavigationComponent, NiceHorizontalNavigationDividerItemComponent, NiceHorizontalNavigationSpacerItemComponent, NiceHorizontalStepperComponent, NiceHorizontalStepperModule, NiceHttpExceptionFactory, NiceImageCropperComponent, NiceImageCropperModule, NiceImageErrorPlaceholderDirective, NiceImageErrorPlaceholderDirectiveModule, NiceLayoutComponent, NiceLayoutModule, NiceLoadingDirective, NiceLoadingSpinnerComponent, NiceLoadingSpinnerModule, NiceLottieComponent, NiceLottieModule, NiceMaterialModule, NiceMaterialStyleDirective, NiceMediaWatcherModule, NiceMediaWatcherService, NiceModalOnClickDirective, NiceModalOpenerDirective, NiceModule, NiceNavigationComponent, NiceNavigationModule, NiceNavigationService, NicePipesModule, NicePreventCloseWindowDirective, NiceRoundedStyleDirective, NiceScrollResetDirective, NiceScrollResetModule, NiceScrollbarDirective, NiceScrollbarModule, NiceSearchBarComponent, NiceSearchBarModule, NiceSplashScreenModule, NiceSplashScreenService, NiceStepComponent, NiceStopPropagationModule, NiceSweetAlertComponent, NiceSweetAlertDirective, NiceSweetAlertModule, NiceSweetAlertService, NiceToastComponent, NiceToastModule, NiceToastService, NiceToggleButtonGroupModule, NiceTransformResponseInterceptor, NiceTypeaheadComponent, NiceTypeaheadModule, NiceTypeaheadNewValue, NiceUtilsModule, NiceUtilsService, NiceVerticalNavigationAsideItemComponent, NiceVerticalNavigationBasicItemComponent, NiceVerticalNavigationCollapsableItemComponent, NiceVerticalNavigationComponent, NiceVerticalNavigationDividerItemComponent, NiceVerticalNavigationGroupItemComponent, NiceVerticalNavigationSpacerItemComponent, NiceWindowDirectiveModule, NumberToOrdinalIndicatorPipe, NumberUtils, ObjectUtils, OptionsScrollDirective, PadPipe, PhonePipe, PictureModalComponent, PictureModalService, PostalCodePipe, PromiseUtils, QueryParamsUtils, RangePipe, RegexUtils, RoundPipe, SanitizeBypassPipe, SecondsToTimePipe, TRANSFORM_TYPE, ToggleButtonComponent, ToggleButtonGroupComponent, TrackByPropPipe, TypeUtils, UrlUtils, _HintComponentBase, _normalizeDegrees, isNotNullOrUndefined, isNullOrUndefined, mergeDeep, mixinNiceApi, niceAnimations, round };
10582
10720
  //# sourceMappingURL=recursyve-nice-ui-kit.v2.mjs.map