UNPKG

@progress/kendo-angular-scheduler

Version:

Kendo UI Scheduler Angular - Outlook or Google-style angular scheduler calendar. Full-featured and customizable embedded scheduling from the creator developers trust for professional UI components.

97 lines (96 loc) 4.66 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { ChangeDetectorRef, Injectable } from '@angular/core'; import { DialogCloseResult, DialogService } from '@progress/kendo-angular-dialog'; import { LocalizationService } from '@progress/kendo-angular-l10n'; import { map, take } from 'rxjs/operators'; import { FocusService } from '../navigation/focus.service'; import { CrudOperation, EditMode } from '../types'; import { ViewStateService } from '../views/view-state.service'; import * as i0 from "@angular/core"; import * as i1 from "@progress/kendo-angular-dialog"; import * as i2 from "@progress/kendo-angular-l10n"; import * as i3 from "../navigation/focus.service"; import * as i4 from "../views/view-state.service"; /** * @hidden */ export class DialogsService { dialogService; localization; changeDetector; focusService; viewState; container; isOpen = false; constructor(dialogService, localization, changeDetector, focusService, viewState) { this.dialogService = dialogService; this.localization = localization; this.changeDetector = changeDetector; this.focusService = focusService; this.viewState = viewState; } openRemoveConfirmationDialog() { const dialog = this.dialogService.open({ title: this.textFor('deleteDialogTitle'), content: this.textFor('deleteConfirmation'), actions: [ { text: this.textFor('cancel'), value: false }, { text: this.textFor('destroy'), value: true } ], appendTo: this.container, autoFocusedElement: 'button:nth-child(2)' }); this.isOpen = true; this.changeDetector.markForCheck(); return dialog.result.pipe(map((result) => { this.isOpen = false; if (result instanceof DialogCloseResult) { this.focusService.focus(); return false; } this.viewState.layoutEnd.pipe(take(1)).subscribe(() => this.focusService.focus()); const res = result; return res.value; })); } openRecurringConfirmationDialog(operation) { const dialog = this.dialogService.open({ actions: [ { text: operation === CrudOperation.Edit ? this.textFor('editOccurrence') : this.textFor('deleteOccurrence'), value: EditMode.Occurrence }, { text: operation === CrudOperation.Edit ? this.textFor('editSeries') : this.textFor('deleteSeries'), value: EditMode.Series } ], appendTo: this.container, autoFocusedElement: 'button:nth-child(1)', content: operation === CrudOperation.Edit ? this.textFor('editRecurringConfirmation') : this.textFor('deleteRecurringConfirmation'), title: operation === CrudOperation.Edit ? this.textFor('editRecurringDialogTitle') : this.textFor('deleteRecurringDialogTitle') }); this.isOpen = true; this.changeDetector.markForCheck(); return dialog.result.pipe(map((result) => { this.isOpen = false; this.focusService.focus(); if (result instanceof DialogCloseResult) { return undefined; } const res = result; return res.value; })); } textFor(key) { return this.localization.get(key); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DialogsService, deps: [{ token: i1.DialogService }, { token: i2.LocalizationService }, { token: i0.ChangeDetectorRef }, { token: i3.FocusService }, { token: i4.ViewStateService }], target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DialogsService }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DialogsService, decorators: [{ type: Injectable }], ctorParameters: function () { return [{ type: i1.DialogService }, { type: i2.LocalizationService }, { type: i0.ChangeDetectorRef }, { type: i3.FocusService }, { type: i4.ViewStateService }]; } });