@emartech/ui-framework-utils
TypeScript icon, indicating that this package has built-in type declarations

9.0.0 • Public • Published

UI Framework Utils

Installation

npm install @emartech/ui-framework-utils

Public Utilities

HTMLCustomElement

Base class for Emarsys UI webcomponents. It provides the following capabilities:

  • Automatic binding of getters and setters to observed attributes
  • Automatic debouncing of the render() or _render() methods (requestRender())
  • Callback for when children of the element are changed (childrenChangedCallback())

Attribute Conversion Utilities

Functions that are used to convert HTML attributes to given types.

  • convertAttributeToBoolean(value)
  • convertAttributeToString(value)
  • convertAttributeToArray(value)
  • convertAttributeToObject(value)

Keyboard Accessibility Utilites

Functions that are used to find and test elements for keyboard accessbility:

  • isKeyboardFocusable(element)
  • queryKeyboardFocusableAll(parentElement)
  • queryKeyboardFocusable(parentElement)

Formatting utilites

Functions that format values based on provided options:

Date utilites

Functions for handling date-related operations in the dateUtils object (based on dateFns):

Properties

  • invalidDateString
  • formats
  • locales

Methods

  • createInvalidDateObject()
  • getFormatsByUserConfig(userConfig)
  • getLocaleWithFallback(locale)
  • parse(value)
  • parseByFormat(value, phpFormat)
  • parseWithoutTime(value)
  • parseWithoutTimeByFormat(value, phpFormat)
  • format(date, formatString, options)
  • formatByLocale(date, { locale, short })
  • formatByName(date, formatName, userConfig)
  • formatDistance(date, baseDate, options)
  • startOfMonth(date)
  • startOfWeek(date)
  • endOfMonth(date)
  • eachDayOfInterval({ start, end }, options)
  • getYear(date)
  • getMonth(date)
  • getDate(date)
  • setMonth(date, month)
  • addMonths(date, months)
  • addWeeks(date, weeks)
  • addDays(date, days)
  • subMonths(date, months)
  • subDays(date, days)
  • subHours(date, hours)
  • isBefore(date, dateToCompare)
  • isAfter(date, dateToCompare)
  • isToday(date)
  • isEqual(dateLeft, dateRight)
  • isSameDay(dateLeft, dateRight)
  • isWithinInterval(date, { start, end })
  • isValid(date)

Adding Languages

If you want to add a new language to the Emarsys UI, you also have to add it to this utility library in the following places:

  1. src/date/locales.js: Date formatter utility locale config
  2. src/format-number/abbreviations.js: Number formatter abbreviations
  3. src/format-duration/abbreviations.js: Duration formatter abbreviations
  4. src/dateformatter/index.js: Legacy date formatter (deprecated)

Currently supported languages: en, de, es, fr, pt, ru, tr, cn, jp, cz, ko.

Keywords

none

Install

npm i @emartech/ui-framework-utils

DownloadsWeekly Downloads

237

Version

9.0.0

License

ISC

Unpacked Size

6.43 MB

Total Files

46

Last publish

Collaborators

  • thomaskmartin
  • emarsys-security
  • norbert-levajsics-emarsys
  • ronnykrosse
  • vszegedi
  • sap-am
  • nnieman-sap
  • ariceem
  • dwolter_emarsys
  • rcsullag
  • ttoth2
  • tbucsanszki
  • dszunomar
  • dschuppa
  • andras.sarro
  • ndomke
  • sevket-ataseven
  • plsap
  • janetriley
  • mattfeldhake_emarsys
  • atittel
  • andrasp3a
  • mruell
  • adroszler
  • erikpetroemar
  • rimo86
  • tillmannr
  • markjarvis
  • geczirobert
  • tsiraitnpm
  • bankyadam
  • bborsi
  • zbalazs
  • ziyadg
  • pintera
  • sigee
  • apoon
  • ianhelmrich
  • varszegik
  • rkumari03
  • cseby92
  • bozsadam
  • jfillmore
  • viktor.szell
  • bencekadaremar
  • roxanams
  • dkocsis-emarsys
  • demajo_ems
  • marko.fritzsche
  • agrucza
  • dmorvai
  • nish343
  • kolosh
  • azorahai3904
  • skrivoo
  • mark.adorjan
  • burci
  • dimitrovn
  • ivanfroehlich
  • iulianmihai
  • xueboliang
  • greszter
  • bercziand
  • okovalenko
  • criley
  • drewhodsonsap
  • jviesersap
  • sixstep
  • sap-jjf
  • sapfs
  • attilamuller01
  • prasadpomaji
  • scotthetrick
  • oliverweisenburger
  • maurogreco
  • nicolaeciumac
  • asciortino1
  • pendicg24
  • marton.matusek
  • adamszabolcs
  • btalos
  • bence.uto
  • daniels1404
  • saphendricksjoerg
  • mmartin2
  • fenyopeti
  • mmothersill
  • brandon-sap
  • pjohnson02
  • mhunyady
  • faridtoubal
  • mengjiao.zhao
  • ushnpm
  • dkorpos
  • xin.he
  • viau
  • zsomborh
  • muddam
  • nvkaur2
  • jbleclerc
  • b-laczko
  • jamescocker
  • arnaud.buchholz
  • jerryrichardson
  • retfalvibence
  • akapa
  • mkls
  • probalazs
  • kaaj
  • knagy
  • pecc
  • kszalontai
  • rehreth
  • mhegedus
  • mmartin
  • bsoos
  • emarsys-deployer
  • draven
  • npospischek-emartech
  • judge
  • daniel.banky
  • szeist
  • rgargya
  • marton.papp.emarsys
  • dgyenes
  • s.viktor
  • m4w4q7
  • david.barkoczi
  • qw3r
  • tamas.toth
  • gergaczd
  • gerike
  • alkra
  • epgrubmair
  • morban
  • ettancos
  • epmartini
  • gabor.balla.emarsys
  • mzsombor
  • ejpersson
  • ejwalker
  • llosonczy
  • iben12
  • kartonfarkas
  • adamoa
  • mbarna
  • peva
  • bforgacs
  • kozma
  • ngabor84
  • zerosuxx
  • edosrecki
  • eadaniel
  • selator
  • kkimak
  • szb
  • gaborb
  • glendvai
  • lveraszto
  • rdoczi
  • fentosi
  • boristomic
  • mbazso
  • dmihalek
  • lhalasz
  • evspasevski
  • eslesnjakovic
  • dsztanko
  • tbugar
  • fqqdk
  • eggarcia
  • ems-zoltan-kohalmy
  • menyhertfatyol
  • zoltanrideg-emarsys
  • sarakoll
  • mmolnar-emar
  • attila.gal
  • benjamingehl
  • tdorkaa
  • lkonya
  • gpap_ema
  • vimtaai
  • lloki-emarsys
  • borzi
  • pmaksa_emarsys
  • dfarago