Outils

Il est possible d'importer ces fonctions pour vous aider avec des opérations de bases.

Exemple

import { prefixWithZeros, getDaysInMonth, isTouch } from '@orion.ui/orion';

const numberWithPrefix = prefixWithZeros(15, 6);
// sortie -> "000015"

const numberOfdays = getDaysInMonth(2, 2023);
// sortie -> 28

const isTouchableDevice = isTouch();
// sortie -> false (si écran non-tactile)

Fonctions

prefixWithZeros(number, length)string
number number | string
length number = 2
hoursToNumber(value, delimiter)number
value string
delimiter string = ':'
sleep(milliseconds)Promise
milliseconds number
isDefineOrTrue(val)boolean
val any
getDaysInMonth(weekNumber, year)number
weekNumber number
year number
getHoursInterval(start, end, pattern, hourSeparator)string
start Date
end Date
pattern string = 'De $start à $end'
hourSeparator string = 'h'
isIpad()boolean | undefined
isTouch()boolean
isMac()boolean
isWindows()boolean
highlightDomElement(element)void
element (HTMLElement | string | null | undefined)
handleTouchDevice()void
itemHas(item, prop)boolean
item Record<string, any>
prop any
itemIs(item, validationKeys)boolean
item Record<string, any>
validationKeys string[]
pickFrom(target, keys)Pick<T, K>
target T extends Record<string, any>
keys (K extends keyof T)[]
addPopoverBackdropCloseAbility()void