rendelo-common
TypeScript icon, indicating that this package has built-in type declarations

0.0.39 • Public • Published

Rendelo-Common Library

Rendelo-Common is an Angular library used for implementing functions, pipes, services etc., which are used in all of the angular projects made by Aranyklinika.

Table of contents

1. Installation
2. How to use
-2.1 Pipes
-2.2 Validators
-2.3 Services
3. External libraries

Installation

  1. Run the npm install rendelo-common command to install the package.
  2. Run npm install moment command to install moment.js. (Necessary for the library!)

How to use

Pipes

  1. Import RendeloPipesModule from rendelo-common in your app.module.ts file and also add it to the imports array!
  2. You can now use all pipes everywhere in your project. example: {{variableName | pipeName}}

Available pipes:

  • fileSize: Transforms a number to a file size unit based on its value. (from 0-3 » B to GB)
  • firstUpperCase: Transforms given string to start with an uppercase letter.
  • newTabLink: Extends anchor tag with arguments to open in a new tab.
  • operator: Returns modified string based on its original value, or stays the same if its unique.
  • plural: Transform given value into plural form.
  • safeHtml: Bypass security and trust the given value to be safe HTML.
  • safeScript: Bypass security and trust the given value to be safe JavaScript.
  • safeStyle: Bypass security and trust the given value to be safe style value (CSS).
  • safeUrl: Bypass security and trust the given value to be a safe style URL.
  • status: Return message based on its status model value.

Validators

  1. Import validator-name from rendelo-common in the component-name.component.ts file, where you want to use it.
  2. Add the validator in your Reactive form validators array.

Available validators:

  • ValidateDate: Check if the given input is a valid date or not.
  • ValidateTaj: Check if the given input contains a valid TAJ number.
  • ValidateForbidden: Check if the given input contains the forbidden values from the forbiddenValues array.

Services

  1. Import service-name from rendelo-common in your component-name.component.ts file.
  2. Create an instance of the service in the components constructor
  3. You can use the service in your component!

Available services:

  • CommonService: Collection of useful functions, which may be used in more parts of the application.
  • TimerService: Implements a timer, which can be fully customized.

Used external libraries

This library was generated with Angular CLI

Package Sidebar

Install

npm i rendelo-common

Weekly Downloads

0

Version

0.0.39

License

MIT

Unpacked Size

251 kB

Total Files

58

Last publish

Collaborators

  • mazsa97