@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
122 lines (121 loc) • 4.66 kB
TypeScript
import { ADCIDateAdapter, ADCIDateFormatter, ADCIDateRangeChangeEvent, ADCILabels, ADCIOptions, ADCITableEvent } from '@asadi/angular-date-components/core';
import { ADCIResourceSchedulerEvent, ADCIResourceSchedulerEventSelectEvent, ADCIResourceSchedulerResource, ADCIResourceSchedulerTableEvent } from '../../interface.global';
import { ADCResourceSchedulerTools } from '../../utils/resource-scheduler.tools';
/**
* The `AdcResourceSchedulerBase` class provides the base functionality for resource schedulers.
* It manages date navigation, event changes, and resource updates. Derived classes are expected to
* implement specific handling for buttons, event changes, resource changes, and date range changes.
*/
export declare abstract class AdcResourceSchedulerBase {
private readonly destory$;
private readonly dateChangeService;
private readonly resourceSchedulerSource;
private isViewReady;
/**
* The date adapter used for formatting and managing date operations in the resouce scheduler.
*/
readonly dateAdapter: ADCIDateAdapter;
/**
* The date formatter used to format dates in the resource scheduler.
*/
readonly dateFormatter: ADCIDateFormatter;
/**
* Utility tools for working with resource scheduler data.
*/
readonly tools: ADCResourceSchedulerTools;
/**
* Optional labels used for localizing or customizing the text displayed in the resource scheduler.
*/
readonly labels?: ADCILabels;
/**
* start of date provided in the scheduler component use it to set initial date range.
*/
readonly startOf: string | null;
readonly options: ADCIOptions;
/**
* Initializes the resource scheduler by subscribing to date and resource changes, and setting up event handlers.
*/
init(): void;
/**
* Handler for the init view. This method should implement logic for setting the initial view date.
*
* @returns void
*/
abstract initViewHanlder(): void;
/**
* Abstract method for handling the "Today" button click.
* Must be implemented by subclasses.
*/
abstract todayButtonHandler(): void;
/**
* Abstract method for handling the "Previous" button click.
* Must be implemented by subclasses.
*/
abstract previousButtonHandler(): void;
/**
* Abstract method for handling the "Next" button click.
* Must be implemented by subclasses.
*/
abstract nextButtonHandler(): void;
/**
* Abstract method for handling changes to events.
* Must be implemented by subclasses.
*
* @param events - The events that have changed, or undefined if there are no events.
*/
abstract eventChangesHandler(events: ADCIResourceSchedulerEvent[]): void;
/**
* Abstract method for handling changes to resources.
* Must be implemented by subclasses.
*
* @param resources - The resources that have changed.
*/
abstract resourceChangesHandler(resources: ADCIResourceSchedulerResource[]): void;
/**
* Abstract method for handling changes to holidays.
* Must be implemented by subclasses.
*
* @param holidays - The updated list of holidays.
*/
abstract holidaysChangesHandler(holidays: string[]): void;
/**
* Abstract method for handling changes to weekends.
* Must be implemented by subclasses.
*
* @param weekends - The updated list of weekends.
*/
abstract weekendChangesHandler(weekends: number[]): void;
/**
* Handles date range change events and forwards them to the resource scheduler source.
*
* @param e - The date range change event.
*/
dateRangeChange(e: ADCIDateRangeChangeEvent): void;
/**
* Handles date range select events and forwards them to the resource scheduler source.
*
* @param e - The date range select event.
*/
dateRangeSelect(e: ADCIResourceSchedulerTableEvent): void;
/**
* Handles event select events and forwards them to the resource scheduler source.
*
* @param e - The event select event.
*/
eventClick(e: ADCIResourceSchedulerEventSelectEvent): 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;
/**
* Destroys the resource scheduler instance and cleans up any active subscriptions.
*/
destory(): void;
}