@eclipse-scout/core
Version:
Eclipse Scout runtime
270 lines • 13.2 kB
TypeScript
/// <reference types="jquery" />
import { CalendarComponent, CalendarDirection, CalendarDisplayMode, CalendarEventMap, CalendarListComponent, CalendarModel, CalendarModesMenu, CalendarMoveData, CalendarResourceDo, CalendarSidebar, DateRange, EventHandler, GroupBox, InitModelOf, JsonDateRange, KeyStrokeContext, Menu, Point, PropertyChangeEvent, ResourcePanel, RoundingMode, Widget, YearPanel, YearPanelDateSelectEvent } from '../index';
export declare class Calendar extends Widget implements CalendarModel {
model: CalendarModel;
eventMap: CalendarEventMap;
self: Calendar;
monthViewNumberOfWeeks: number;
numberOfHourDivisions: number;
widthPerDivision: number;
heightPerDivision: number;
startHour: number;
heightPerHour: number;
heightPerDay: number;
spaceBeforeScrollTop: number;
workDayIndices: number[];
displayCondensed: boolean;
displayMode: CalendarDisplayMode;
components: CalendarComponent[];
selectedComponent: CalendarComponent;
loadInProgress: boolean;
selectedDate: Date;
selectorStart: Date;
selectorEnd: Date;
showDisplayModeSelection: boolean;
rangeSelectionAllowed: boolean;
resources: CalendarResourceDo[];
selectedResource: CalendarResourceDo;
defaultResource: CalendarResourceDo;
title: string;
useOverflowCells: boolean;
viewRange: DateRange;
calendarToggleListWidth: number;
calendarToggleYearWidth: number;
menuInjectionTarget: GroupBox;
modesMenu: CalendarModesMenu;
menus: Menu[];
calendarSidebar: CalendarSidebar;
yearPanel: YearPanel;
resourcePanel: ResourcePanel;
selectedRange: DateRange;
needsScrollToStartHour: boolean;
defaultMenuTypes: string[];
showCalendarSidebar: boolean;
showResourcePanel: boolean;
showListPanel: boolean;
$header: JQuery;
$range: JQuery;
$commands: JQuery;
$grids: JQuery;
$grid: JQuery;
$topGrid: JQuery;
$list: JQuery;
$listContainer: JQuery;
$listTitle: JQuery;
$progress: JQuery;
$headerRow1: JQuery;
$headerRow2: JQuery;
$title: JQuery;
$select: JQuery;
$window: JQuery<Window>;
/**
* The narrow view range is different from the regular view range.
* It contains only dates that exactly match the requested dates,
* the regular view range contains also dates from the first and
* next month. The exact range is not sent to the server.
*/
protected _exactRange: DateRange;
/**
* When the list panel is shown, this list contains the scout.CalenderListComponent
* items visible on the list.
*/
protected _listComponents: CalendarListComponent[];
protected _menuInjectionTargetMenusChangedHandler: EventHandler<PropertyChangeEvent<Menu[], GroupBox>>;
/**
* Resources, which do not have a child resources
*/
protected _leafResources: CalendarResourceDo[];
/**
* Temporary data structure to store data while mouse actions are handled
* @internal
*/
_moveData: CalendarMoveData;
/** @internal */
_rangeSelectionStarted: boolean;
protected _mouseMoveHandler: (event: JQuery.MouseMoveEvent) => void;
protected _mouseUpHandler: (event: JQuery.MouseUpEvent) => void;
protected _mouseMoveRangeSelectionHandler: (event: JQuery.MouseMoveEvent) => void;
protected _mouseUpRangeSelectionHandler: (event: JQuery.MouseUpEvent) => void;
constructor();
/**
* Enum providing display-modes for calender-like components like calendar and planner.
* @see ICalendarDisplayMode.java
*/
static DisplayMode: {
readonly DAY: 1;
readonly WEEK: 2;
readonly MONTH: 3;
readonly WORK_WEEK: 4;
};
/**
* Used as a multiplier in date calculations back- and forward (in time).
*/
static Direction: {
readonly BACKWARD: -1;
readonly FORWARD: 1;
};
static MenuType: {
readonly EmptySpace: "Calendar.EmptySpace";
readonly CalendarComponent: "Calendar.CalendarComponent";
};
isDay(): boolean;
isWeek(): boolean;
isMonth(): boolean;
isWorkWeek(): boolean;
protected _createKeyStrokeContext(): KeyStrokeContext;
protected _createDefaultResource(): CalendarResourceDo;
protected _init(model: InitModelOf<this>): void;
protected _updateResourcePanelDisplayable(): void;
setSelectedDate(date: Date | string): void;
protected _setSelectedDate(date: Date | string): void;
protected _renderSelectedDate(): void;
setDisplayMode(displayMode: CalendarDisplayMode): void;
protected _setDisplayMode(displayMode: CalendarDisplayMode): void;
protected _renderDisplayMode(oldDisplayMode?: CalendarDisplayMode): void;
protected _setViewRange(viewRange: DateRange | JsonDateRange): void;
protected _setRangeSelectionAllowed(rangeSelectionAllowed: boolean): void;
setSelectedRange(range: DateRange | JsonDateRange): void;
protected _setMenus(menus: Menu[]): void;
protected _setMenuInjectionTarget(menuInjectionTarget: GroupBox | string): void;
protected _checkMenuInjectionTarget(menuInjectionTarget: GroupBox): boolean;
protected _removeInjectedMenus(menuInjectionTarget: GroupBox, injectedMenus: Menu[]): Menu[];
setShowCalendarSidebar(showCalendarSidebar: boolean): void;
setShowResourcePanel(showResourcePanel: boolean): void;
setShowListPanel(showListPanel: boolean): void;
protected _render(): void;
protected _renderProperties(): void;
setResources(resources: CalendarResourceDo[]): void;
protected _setResources(resources: CalendarResourceDo[]): void;
protected _renderResources(): void;
protected _updateResourcePanel(): void;
protected _validateSelectedResource(): void;
setComponents(components: CalendarComponent[]): void;
protected _setComponents(components: CalendarComponent[]): void;
addComponents(components: CalendarComponent[]): void;
protected _renderComponents(): void;
protected _renderSelectedComponent(): void;
protected _renderLoadInProgress(): void;
updateScrollPosition(animate: boolean): void;
protected _updateScrollPosition(scrollToInitialTime: boolean, animate: boolean): void;
protected _updateScrollShadow(): void;
protected _scrollToSelectedComponent(animate: boolean): void;
protected _scrollToInitialTime(animate: boolean): void;
protected _onPreviousClick(): void;
protected _onNextClick(): void;
protected _dateParts(date: Date, modulo?: boolean): {
year: number;
month: number;
date: number;
day: number;
};
protected _navigateDate(direction: CalendarDirection): void;
protected _calcSelectedDate(direction: CalendarDirection): Date;
protected _updateModel(animate: boolean): void;
/**
* Calculates exact date range of displayed components based on selected-date.
*/
protected _calcExactRange(): DateRange;
/**
* Calculates the view-range, which is what the user sees in the UI.
* The view-range is wider than the exact-range in the monthly mode,
* as it contains also dates from the previous and next month.
*/
protected _calcViewRange(): DateRange;
protected _onTodayClick(event: JQuery.ClickEvent): void;
protected _onDisplayModeClick(event: JQuery.ClickEvent): void;
protected _onCalendarSidebarClick(event: JQuery.ClickEvent): void;
protected _onListClick(event: JQuery.ClickEvent): void;
protected _onDayColumnMouseDown(withTime: boolean, event: JQuery.MouseDownEvent): void;
protected _getSelectedDate(event: JQuery.MouseEventBase): Date;
protected _getSelectedSeconds(event: JQuery.MouseEventBase): number;
protected _getSelectedDateTime(event: JQuery.MouseEventBase): Date;
/**
* @param selectedComponent may be null when a day is selected
*/
protected _setSelection(selectedDate: Date, selectedResource: CalendarResourceDo | string, selectedComponent: CalendarComponent, updateScrollPosition: boolean, timeChanged: boolean): void;
protected _get$CalendarComponent($element: JQuery): JQuery<HTMLElement>;
protected _updateScreen(updateTopGrid: boolean, animate: boolean): void;
layoutSize(animate?: boolean): void;
protected _afterLayout($parent: JQuery, animate: boolean): void;
protected _defaultResourceVisible(components?: CalendarComponent[]): boolean;
isLeafResource(resourceId: string): boolean;
findResourceForComponent(component: CalendarComponent): CalendarResourceDo;
findResourceForId(resourceId: string): CalendarResourceDo;
protected _updateWeekdayNames(): void;
protected _updateScrollbars($parent: JQuery, animate: boolean): void;
protected _uninstallComponentScrollbars($parent: JQuery): void;
protected _updateTopGrid(): void;
protected _updateFullDayIndices(fullDayComponents?: CalendarComponent[]): void;
protected _calculateFullDayIndexKey(component: CalendarComponent, date: Date): string;
layoutYearPanel(): void;
layoutLabel(): void;
layoutAxis(): void;
protected _onYearPanelDateSelect(event: YearPanelDateSelectEvent): void;
protected _updateListPanel(): void;
protected _remove(): void;
/**
* Renders the panel on the left, showing all components of the selected date.
*/
protected _renderListPanel(): void;
protected _filterCurrentDate(component: CalendarComponent): boolean;
protected _filterVisibleComponents(component: CalendarComponent): boolean;
/** @internal */
_selectedComponentChanged(component: CalendarComponent, resourceId: string, partDay: Date, updateScrollPosition: boolean): void;
protected _onDayContextMenu(event: JQuery.ContextMenuEvent): void;
/** @internal */
_showContextMenu(event: JQuery.ContextMenuEvent, allowedType: string): void;
protected _calculateContextMenuVisible(event: JQuery.ContextMenuEvent): boolean;
protected _onResourceVisibilityChanged(event: PropertyChangeEvent<string[]>): void;
protected _updateResourceVisibility(updatedResources: [resourceId: string, visible: boolean][]): void;
protected _updateResourcesVisibleProperty(resourceId: string, visible: boolean): void;
protected _arrangeComponents(): void;
protected _getComponents($children: JQuery): CalendarComponent[];
/** @internal */
_sort(components: CalendarComponent[]): void;
/**
* Arrange components (stack width, stack index) per day
*/
protected _arrange(components: CalendarComponent[], day: Date): void;
protected _allEndBefore(columns: CalendarComponent[], pos: number, day: Date): boolean;
protected _findReplaceableColumn(columns: CalendarComponent[], pos: number, day: Date): number;
protected _endsBefore(component: CalendarComponent, pos: number, day: Date): boolean;
protected _arrangeComponentSetPlacement($children: JQuery, day: Date): void;
protected _calculateStackKey(date: Date, resourceId?: string): string;
get$Scrollable(): JQuery;
protected _onMouseDown(event: JQuery.MouseDownEvent): void;
protected _onMouseMove(event: JQuery.MouseMoveEvent): void;
protected _scrollViewportWhileDragging(event: JQuery.MouseMoveEvent): void;
protected _onMouseUp(event: JQuery.MouseUpEvent): void;
protected _onComponentMouseDown(event: JQuery.MouseDownEvent, component: CalendarComponent): void;
protected _onComponentMouseMove(event: JQuery.MouseMoveEvent): void;
protected _onComponentMouseUp(event: JQuery.MouseUpEvent): void;
protected _whileComponentMove(): void;
protected _endComponentMove(): void;
protected _setComponentLogicalPosition(component: CalendarComponent, logicalPosition: Point): void;
protected _getCalendarComponentForMouseEvent(event: JQuery.MouseDownEvent): CalendarComponent;
protected _updateLeafResources(): void;
protected _newMoveData(event: JQuery.MouseDownEvent): CalendarMoveData;
toLogicalPosition(point: Point, roundingMode?: RoundingMode): Point;
toLogicalPosition(x: number, y: number, roundingMode?: RoundingMode): Point;
protected _hourMinuteByDivision(number: number): {
hour: number;
minute: number;
};
protected _dayPositionByDivision(number: number): number;
/** @internal */
_dayPosition(hour: number, minutes: number): number;
protected _format(date: Date, pattern: string): string;
protected _sortFromTo(c1: CalendarComponent, c2: CalendarComponent): number;
protected _startRangeSelection(event: JQuery.MouseDownEvent, selectedResourceChanged: boolean): void;
protected _findDayInCalendar(selectedDate: Date): JQuery;
protected _findSelectedResourceColumn(selectedDate: Date): JQuery;
protected _setRangeSelection(): void;
protected _removeRangeSelection(): void;
protected _appendCalendarRangeSelection(date: Date, fromTime: Date, toTime: Date): void;
protected _getHours(date: Date): number;
protected _onMouseMoveRangeSelection(event: JQuery.MouseMoveEvent): void;
protected _onMouseUpRangeSelection(event: JQuery.MouseUpEvent): void;
protected _updateSelectedRange(): void;
}
//# sourceMappingURL=Calendar.d.ts.map