@progress/kendo-angular-dateinputs
Version:
Kendo UI for Angular Date Inputs Package - Everything you need to add date selection functionality to apps (DatePicker, TimePicker, DateInput, DateRangePicker, DateTimePicker, Calendar, and MultiViewCalendar).
71 lines (70 loc) • 2.3 kB
JavaScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
import { Keys, normalizeKeys } from "@progress/kendo-angular-common";
/**
* @hidden
*/
export const requiresZoneOnBlur = (ngControl) => ngControl &&
(!ngControl.touched || (ngControl.control && ngControl.control.updateOn === 'blur'));
/**
* @hidden
*/
export const preventDefault = (args) => args.preventDefault();
/**
* @hidden
*/
export const currentFocusTarget = (blurArgs) => blurArgs.relatedTarget || document.activeElement;
/**
* @hidden
*/
export const isPresent = (value) => value !== undefined && value !== null;
/**
* @hidden
*/
export const isNullOrDate = (value) => value === null || value instanceof Date;
/**
* @hidden
*/
export const isTruthy = (value) => !!value;
/**
* @hidden
*
* If the provided parameter is an array with at least one item
* and all items in the array are numbers, returns `true.
*/
export const isNumberArray = (value) => Array.isArray(value) && value.length > 0 && value.every(item => typeof item === 'number');
/**
* @hidden
*
* If the provided parameter is an array with at least one item
* and all items in the array are dates, returns `true`.
*/
export const isDateArray = (value) => Array.isArray(value) && value.length > 0 && value.every(item => item instanceof Date);
/**
* @hidden
*/
export const isArrowWithShiftPressed = (args) => {
const code = normalizeKeys(args);
return args.shiftKey && (code === Keys.ArrowRight || code === Keys.ArrowLeft || code === Keys.ArrowDown || code === Keys.ArrowUp);
};
/**
* @hidden
*/
export const selectors = {
infiniteCalendarTable: '.k-content .k-calendar-table',
multiViewCalendarTable: '.k-calendar-table'
};
/**
* @hidden
*/
export const attributeNames = {
ariaActiveDescendant: 'aria-activedescendant',
ariaControls: 'aria-controls',
ariaExpanded: 'aria-expanded',
ariaHasPopup: 'aria-haspopup',
valueNow: 'aria-valuenow',
valuetext: 'aria-valuetext',
ariaInvalid: 'aria-invalid'
};