0.39.16-schematics.20240430-1745 • Published 13 days ago

@energycap/components v0.39.16-schematics.20240430-1745

Weekly downloads
2,424
License
-
Repository
-
Last release
13 days ago

EnergyCAP Components

A collection of common components used in EnergyCAP's Angular applications.

Install

npm install @energycap/components

Usage

Import library into the root ngModule of your application

@import {ComponentsModule} from '@energycap/components'

@NgModule({
  imports: [
    ComponentsModule
  ]
})
export class AppModule {}

Logo Assets Setup

The AppBarComponent includes an app icon image with a default path of '/assets/images/icon.svg'. You can either copy the assets that come bundled with the library:

// angular.json
"build": {
  // ...
  "options": {
    // ...
    "assets": [
      // ...
      {
        "glob": "**/*",
        "input": "./node_modules/@energycap/components/src/assets/images",
        "output": "./assets/images"
      }
    ]
  }
}

or customize the path by passing a value to the [iconPath] input on the <ec-app-bar> component.

<ec-app-bar iconPath="path/to/my/icon.svg">

Note: This can also be a fully qualified URL like: https://cdn.freebiesupply.com/images/large/2x/apple-logo-transparent.png.


Logo Assets Setup

The AppBarComponent includes an app icon image with a default path of '/assets/images/icon.svg'. You can either copy the assets that come bundled with the library:

// angular.json
"build": {
  // ...
  "options": {
    // ...
    "assets": [
      // ...
      {
        "glob": "**/*",
        "input": "./node_modules/@energycap/components/assets/images",
        "output": "./assets/images"
      }
    ]
  }
}

or customize the path by passing a value to the [iconPath] input on the <ec-app-bar> component.

<ec-app-bar iconPath="path/to/my/icon.svg">

Note: This can also be a fully qualified URL like: https://cdn.freebiesupply.com/images/large/2x/apple-logo-transparent.png.

Form Control Validation Messages Setup

This library provides helpful validation messages for the components. We have provided default messages which should be fine for most users, however they do require a bit of extra setup.

The following is the recommended process for an Angular application:

1. Update angular.json

The validation messages are provided in a file called en_US.json that ships with this library. The easiest way to make them available to your Angular application is to add the following to angular.json:

// ...
"build": {
  // ...
  "options": {
    // ...
    "assets": [
      // ...
      {
        "glob": "**/*.json",
        "input": "./node_modules/@energycap/components/src/assets/locales",
        "output": "./assets/locales/"
      }
    ]
  }
}

2. Install an Http Loader

There is already a peer dependency on @ngx-translate, which is the mechanism we use to provide the validation messages, so our recommendation is to use their http-loader.

Note: This library does not support translation to any language other than English at this time.

npm install @ngx-translate/http-loader --save

3. Update AppModule

Update your app.module.ts to use the http-loader:

import { HttpClient, HttpClientModule } from '@angular/common/http';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
//...
export function HttpLoaderFactory(http: HttpClient) {
  return new TranslateHttpLoader(http, "/assets/locales/");
}

@NgModule({
  imports: [
    HttpClientModule,
    TranslateModule.forRoot({
      loader: {
        provide: TranslateLoader,
        useFactory: HttpLoaderFactory,
        deps: [HttpClient]
      }
    })
  ]

4. Update AppComponent

Update your app.component.ts:

import { TranslateService } from '@ngx-translate/core';

constructor(private translate: TranslateService) {
  translate.setDefaultLang('en_US');
  translate.use('en_US');
}

That's it!


Icons

This library uses icons from @energycap/energycap-icons package, which is listed as a peer dependency. Refer to their documentation for configuring the webfont implementation.


Unsupported Browsers

This library does not support Internet Explorer. We've provided a helpful script that will mask the screen when a user attempts to use an application built with this library. To add this feature to your application, add the unsupported-browser.js script to the scripts array in the angular.json file.

// ...
"build": {
  // ...
  "options": {
    // ...
    "scripts": [
      "./node_modules/@energycap/components/src/assets/scripts/unsupported-browser.js"
    ]
  }
}

More Info

For a list of available components and their usage: 1. Pull the energycap-libs repo 2. Run:

npm install
npm start
  1. Navigate to http://localhost:4200/
0.39.15

18 days ago

0.39.14

1 month ago

0.39.13

2 months ago

0.39.10

2 months ago

0.39.9

2 months ago

0.39.8

3 months ago

0.39.7

3 months ago

0.39.6

3 months ago

0.39.5

4 months ago

0.39.4

4 months ago

0.39.3

5 months ago

0.37.3

9 months ago

0.37.2

9 months ago

0.37.1

9 months ago

0.37.0

9 months ago

0.37.6

8 months ago

0.37.5

8 months ago

0.37.4

8 months ago

0.39.1

6 months ago

0.39.0

6 months ago

0.39.2

6 months ago

0.36.4

9 months ago

0.36.3

10 months ago

0.36.2

10 months ago

0.36.1

10 months ago

0.36.0

11 months ago

0.36.5

9 months ago

0.38.2

8 months ago

0.38.1

8 months ago

0.38.0

8 months ago

0.38.7

7 months ago

0.38.6

7 months ago

0.38.5

7 months ago

0.38.4

7 months ago

0.38.3

7 months ago

0.35.1

11 months ago

0.33.4

12 months ago

0.33.3

12 months ago

0.33.2

12 months ago

0.33.1

1 year ago

0.33.0

1 year ago

0.35.0

11 months ago

0.34.0

11 months ago

0.32.30

1 year ago

0.32.20

1 year ago

0.32.29

1 year ago

0.32.28

1 year ago

0.32.27

1 year ago

0.32.26

1 year ago

0.32.25

1 year ago

0.32.24

1 year ago

0.32.23

1 year ago

0.32.22

1 year ago

0.32.21

1 year ago

0.32.19

1 year ago

0.32.18

1 year ago

0.32.17

1 year ago

0.32.16

1 year ago

0.32.15

1 year ago

0.32.14

1 year ago

0.32.13

1 year ago

0.32.12

1 year ago

0.32.11

1 year ago

0.31.6

2 years ago

0.31.5

2 years ago

0.31.4

2 years ago

0.31.3

2 years ago

0.32.8

2 years ago

0.32.7

2 years ago

0.32.6

2 years ago

0.32.5

2 years ago

0.32.4

2 years ago

0.32.3

2 years ago

0.32.2

2 years ago

0.32.1

2 years ago

0.32.9

2 years ago

0.32.0

2 years ago

0.32.10

1 year ago

0.31.2

2 years ago

0.31.1

2 years ago

0.31.0

2 years ago

0.30.4

2 years ago

0.30.3

2 years ago

0.30.2

2 years ago

0.30.1

2 years ago

0.30.0

2 years ago

0.28.12

2 years ago

0.28.15

2 years ago

0.28.14

2 years ago

0.28.13

2 years ago

0.29.0

2 years ago

0.29.1

2 years ago

0.28.9

2 years ago

0.28.11

2 years ago

0.28.10

2 years ago

0.28.8

2 years ago

0.28.7

2 years ago

0.28.6

2 years ago

0.28.5

2 years ago

0.28.4

2 years ago

0.27.12

2 years ago

0.28.1

2 years ago

0.28.3

2 years ago

0.28.2

2 years ago

0.27.11

2 years ago

0.27.10

2 years ago

0.28.0

2 years ago

0.26.11

2 years ago

0.26.10

2 years ago

0.27.2

2 years ago

0.27.1

2 years ago

0.27.0

2 years ago

0.27.9

2 years ago

0.27.8

2 years ago

0.27.7

2 years ago

0.27.6

2 years ago

0.27.5

2 years ago

0.27.4

2 years ago

0.27.3

2 years ago

0.26.9

2 years ago

0.26.8

2 years ago

0.26.7

2 years ago

0.26.3

3 years ago

0.26.6

2 years ago

0.26.5

2 years ago

0.26.4

3 years ago

0.25.3

3 years ago

0.25.2

3 years ago

0.26.2

3 years ago

0.26.1

3 years ago

0.26.0

3 years ago

0.25.1

3 years ago

0.25.0

3 years ago

0.24.2

3 years ago

0.24.1

3 years ago

0.24.0

3 years ago

0.23.2

3 years ago

0.23.1

3 years ago

0.23.0

3 years ago

0.22.1

3 years ago

0.22.0

3 years ago

0.21.22

3 years ago

0.21.21

3 years ago

0.21.20

3 years ago

0.21.18

3 years ago

0.21.19

3 years ago

0.21.16

3 years ago

0.21.17

3 years ago

0.21.14

3 years ago

0.21.15

3 years ago

0.21.12

3 years ago

0.21.13

3 years ago

0.21.10

3 years ago

0.21.11

3 years ago

0.21.9

3 years ago

0.21.8

3 years ago

0.21.7

3 years ago

0.21.6

3 years ago

0.21.5

3 years ago

0.21.4

3 years ago

0.21.3

3 years ago

0.21.2

3 years ago

0.21.1

3 years ago

0.21.0

3 years ago

0.20.1

3 years ago

0.20.0

3 years ago

0.19.2

3 years ago

0.19.1

3 years ago

0.19.0

3 years ago

0.18.1

3 years ago

0.18.0

3 years ago

0.17.3

3 years ago

0.17.2

3 years ago

0.17.1

4 years ago

0.17.0

4 years ago

0.16.1

4 years ago

0.16.0

4 years ago

0.15.3

4 years ago

0.15.2

4 years ago

0.15.1

4 years ago

0.15.0

4 years ago

0.14.3

4 years ago

0.14.2

4 years ago

0.14.1

4 years ago

0.10.5

4 years ago

0.10.4

4 years ago

0.14.0

4 years ago

0.13.6

4 years ago

0.13.5

4 years ago

0.13.4

4 years ago

0.13.3

4 years ago

0.13.2

4 years ago

0.13.1

4 years ago

0.13.0

4 years ago

0.12.4

4 years ago

0.12.3

4 years ago

0.12.2

4 years ago

0.12.1

4 years ago

0.12.0

4 years ago

0.11.7

4 years ago

0.11.6

4 years ago

0.11.5

4 years ago

0.11.4

4 years ago

0.11.3

4 years ago

0.11.2

4 years ago

0.11.1

4 years ago

0.11.0

4 years ago

0.10.3

4 years ago

0.10.2

4 years ago

0.10.1

4 years ago

0.10.0

4 years ago

0.9.4

4 years ago

0.9.3

4 years ago

0.9.2

4 years ago

0.9.1

4 years ago

0.9.0

4 years ago

0.8.7

4 years ago

0.8.6

4 years ago

0.8.5

4 years ago

0.8.4

4 years ago

0.8.3

4 years ago

0.8.2

4 years ago

0.8.1

4 years ago

0.7.0

4 years ago

0.6.0

4 years ago

0.5.1-c9194ae.0

4 years ago

0.5.0

4 years ago

0.4.1

4 years ago

0.4.0

4 years ago

0.3.0

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6-rc.5

5 years ago

0.0.6

5 years ago

0.0.6-rc.4

5 years ago

0.0.6-rc.3

5 years ago

0.0.6-rc.2

5 years ago

0.0.6-rc.1

5 years ago

0.0.6-rc.0

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago