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.

112 lines (111 loc) 3.88 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { Injectable } from '@angular/core'; import { BehaviorSubject, Subject } from 'rxjs'; import * as i0 from "@angular/core"; /** * A service which publishes information from the Scheduler to the views. * Views subscribe to changes in the context (selected date, event, and resource data) through this service. */ export class ViewContextService { /** * A stream of navigation actions that will be handled by the view. */ action; /** * A stream that executes methods from the view. */ execute; /** * A stream of items (events) that will be displayed in the view. */ items; /** * A stream with the selected date that will be displayed by the view. */ selectedDate; /** * Fires when the Scheduler element is resized. */ resize; /** * Fires when the Scheduler options are changed. */ optionsChange; actionSource = new Subject(); itemsSource = new BehaviorSubject([]); selectedDateSource = new BehaviorSubject(null); resizeSource = new Subject(); optionsChangeSource = new BehaviorSubject({}); executeSource = new Subject(); constructor() { this.action = this.actionSource.asObservable(); this.items = this.itemsSource.asObservable(); this.selectedDate = this.selectedDateSource.asObservable(); this.resize = this.resizeSource.asObservable(); this.optionsChange = this.optionsChangeSource.asObservable(); this.execute = this.executeSource.asObservable(); } /** * An internal method which is used by the Scheduler to publish unhandled navigation actions. * * @hidden */ notifyAction(action) { this.actionSource.next(action); } /** * An internal method which is used by the Scheduler to publish the current set of items. * * @hidden */ notifyItems(items) { this.itemsSource.next(items); } /** * An internal method which is used by the Scheduler to publish the currently selected date. * * @hidden */ notifySelectedDate(date) { this.selectedDateSource.next(date); } /** * An internal method which is used by the Scheduler to notify that the size changed. * * @hidden */ notifyResize() { this.resizeSource.next(); } /** * An internal method which is used by the Scheduler to notify that the options changed. * * @hidden */ notifyOptionsChange(changes) { this.optionsChangeSource.next(changes); } /** * An internal method which is used by the Scheduler to execute a view method. * * @hidden */ executeMethod(name, args) { let result; this.executeSource.next({ name, args, result: (r) => { result = r; } }); return result; } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ViewContextService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ViewContextService, providedIn: 'root' }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ViewContextService, decorators: [{ type: Injectable, args: [{ providedIn: 'root' }] }], ctorParameters: function () { return []; } });