UNPKG

@asadi/angular-date-components

Version:

`Angular Date Components` is a comprehensive angular library of date-related components designed to meet the needs of applications that require localization based on various calendar systems. While the package currently includes two powerful components (S

126 lines (125 loc) 4.71 kB
import { ADCIDateAdapter, ADCIDateFormatter, ADCIDateRangeChangeEvent, ADCILabels, ADCIOptions, ADCITableEvent } from '@asadi/angular-date-components/core'; import { ADCISchedulerDateRangeSelectEvent, ADCISchedulerEvent, ADCISchedulerEventSelectEvent } from '../../interface.global'; import { ADCSchedulerTools } from '../../utils/scheduler.tools'; /** * Base class for the ADC scheduler. This class provides fundamental functionality for managing date changes, * event handling, and interacting with the scheduler source. It handles the event subscription and delegates * specific logic to abstract methods for customization. */ export declare abstract class AdcSchedulerBase { private readonly destroy$; private readonly dateChangeService; private readonly schedulerSource; private isViewReady; /** * The date adapter used for managing date-related operations. */ readonly dateAdapter: ADCIDateAdapter; /** * The date formatter used for formatting dates. */ readonly dateFormatter: ADCIDateFormatter; /** * A utility toolset for the scheduler, offering additional methods for scheduling operations. */ readonly tools: ADCSchedulerTools; /** * The optional set of labels used for UI display. */ readonly labels?: ADCILabels; readonly options: ADCIOptions; /** * start of date provided in the scheduler component use it to set initial date range. */ readonly startOf: string | null; /** * Initializes the scheduler by setting up event subscriptions and handlers. * Subscribes to date change and event change notifications from the date change service and scheduler source. * * @returns void */ init(): void; /** * Handler for the init view. This method should implement logic for setting the initial view date. * * @returns void */ abstract initViewHanlder(): void; /** * Handler for the 'Today' button. This method should implement logic for resetting to today's date. * * @returns void */ abstract todayButtonHandler(): void; /** * Handler for the 'Previous' button. This method should implement logic for navigating to the previous date range. * * @returns void */ abstract previousButtonHandler(): void; /** * Handler for the 'Next' button. This method should implement logic for navigating to the next date range. * * @returns void */ abstract nextButtonHandler(): void; /** * Handler for event changes. This method should implement logic for processing updated scheduler events. * * @param schedulerEvents - The updated list of scheduler events. * @returns void */ abstract eventChangesHandler(schedulerEvents: ADCISchedulerEvent[] | undefined): void; /** * Handler for changes to weekends. This method should implement logic for processing updated weekend information. * * @param weekends - The updated list of weekend days. * @returns void */ abstract weekendsChangesHandler(weekends: number[]): void; /** * Handler for changes to holidays. This method should implement logic for processing updated holiday information. * * @param holidays - The updated list of holiday dates. * @returns void */ abstract holidaysChangesHandler(holidays: string[]): void; /** * Sends a date range change event to the scheduler source. * * @param e - The date range change event to be emitted. * @returns void */ dateRangeChange(e: ADCIDateRangeChangeEvent): void; /** * Sends a date range selection event to the scheduler source. * * @param e - The date range selection event to be emitted. * @returns void */ dateRangeSelect(e: ADCISchedulerDateRangeSelectEvent): void; /** * Sends an event selection event to the scheduler source. * * @param e - The event selection event to be emitted. * @returns void */ eventClick(e: ADCISchedulerEventSelectEvent): void; abstract onEventClick(event: ADCITableEvent, dom: HTMLElement, jsEvent: MouseEvent): void; /** * Marks the view as ready to process events. * * Once this method is called: * - The `eventChangesHandler` will be triggered immediately with the current list of events. * - Subsequent updates to events will also be handled automatically until the view is marked as unready. * * @returns void */ markViewAsReady(): void; /** * Cleans up subscriptions when the component or service is destroyed. * * @returns void */ destroy(): void; }