Přeskočit na hlavní obsah

Core library

Core library

Core library handles common functionalities like constants, functions, pipes, validation etc.

It has important role in applications, because it accepts and handle application code/identifier ASOL_APP_ID injection token.

AsolPlatformCoreModule.forRoot('ASOLEU-unique-application-id')

Injection Tokens

  • ASOL_APP_ID - unique application code/identifier

Constants

  • Customization constant – contains constants for user customization
  • Paging constant – contains max paging value (int max in c#)
  • ASOL_LOCALE_CONSTANTS - default localization en-US constants

Functions

  • convertDate – converts date into string and back used in date time pickers
  • dataUrltoFile – converts url to file
  • formatBytes – formats number to Bytes, KB, MB etc.
  • generateId – generates unique identifier based on optional length
  • getbaseLocation – get base href from document
  • getNameFromHeader - Extracts file name from Http header
  • injectScript - Inserts js script before last child in head element
  • isFormGroup - Check whether abstract control is formgroup
  • mapReplacer – converts Map to object for serialization
  • mapReviver – converts object to Map type
  • markForValidation - function used to mark all properties of formGroup as touched to validate the form group
  • pollWhile - Polling until condition is met
  • pollingOnResolved - Polling after data is resolved and processed
  • removeScripts - Removes js script from DOM by id or URL
  • removeSlash – removes trailing slash from string
  • stringFormat - function used to replace string placeholders with desired content (similar to string.format in C#)
  • provideTranslations - adds a given trans key into providers and initializes that key in AsolTranslationService with given dictionary

Models

  • Key value pair interface
  • AsolSelectedItem - interface containing value, text, disabled, used in select component

Pipes

  • formatBytesPipe – pipe used with formatBytes function
  • safePipe – string sanitizer based on type (html, script, style, etc.)
  • enumToSelect – pipes used to convert enum to selectedItems
  • enumToStringValue – pipe converts enum key to string value
  • unknownToObject – pipe converts 'unknown' to
  • shortenText - Shortens the text by the required number of characters.
  • Localize pipe – used with localize function
  • Localized pipe - provides simplified work with translations

Router

  • AsolCachingReusingStrategy - This custom rout reuse strategy allows to cache the component for immediate back navigation

Types

  • AsolButtonType - Button definition

Services

  • AsolLocalizationService – service to get current locale, to check for valid language and to store language
  • AsolTranslationService – service for providing translation based on initialized file

Validation

  • AsolValidateAsolEmail – validates is email end with assecosol.com
  • AsolMustMatch – used to match two string values (like password and confirm password)
  • AsolPhoneNumberValidator – user to validate phone numbers
  • AsolSimpleUrlValidator – validates if url is valid
  • AsolValidateUrl – validates if url is valid
  • AsolDecimalNumberValidator - Validator for decimal number -> if value is number and it has x decimal places
  • AsolMaxLengthValidator - Custom version of 'maxLengthValidator' validation function
  • AsolMaxValidator - Custom version of 'maxValidator' validation function
  • AsolMinLengthValidator - Custom version of 'minLengthValidator' validation function
  • AsolMinValidator - Custom version of 'minValidator' validation function
  • AsolRequiredTrueValidator - Custom version of 'requiredTrue' validation function

Translation

Core library also contains commonly used translations and error messages they are already initialized, but you still need to add its key to translation constants of the application.
To use general or error translations use ASOL_TRANS constant from Core library.

General translation

Key: apt-general

General translation contains translation for:

  • Change
  • Save
  • Close
  • Cancel
  • Back
  • Next
  • Reset
  • Submit
  • Saved
  • Error
  • CopiedToClipboard
  • Ok
  • Delete
  • Edit
  • RecordCreationInProgress
  • RecordCreationSuccess
  • RecordUpdateInProgress
  • RecordUpdateSuccess
  • RecordRemoveInProgress
  • RecordRemoveSuccess
  • DeleteConfirmation
  • Done
  • Yes
  • No
  • Add
  • Remove
  • UrlNotValid
  • NoData
  • Search
  • Enable
  • Disable
  • Enabled
  • Disabled
  • More
  • ValidFrom
  • ValidTo

Error translation

Key: apt-error

Error translation contains translation for:

  • AVAspaceErrorHeader
  • ValidationErrorHeader
  • UnexpectedErrorText
  • UnknownErrorText
  • InternalErrorText
  • TokenErrorHeader
  • TokenErrorText
  • IdentityErrorHeader
  • IdentityErrorText
  • TokenUnknownErrorText
  • EmailRequiredError
  • EmailInvalidError
  • PasswordRequiredError
  • PasswordConfirmRequiredError
  • PasswordConfirmMatchError
  • RequiredErrorMessage
  • GeneralValidationErrorMessage
  • AsolEmailError
  • InvalidPhoneNumber
  • InvalidUrl