1.19.1 • Published 4 years ago

ng-drivecommons v1.19.1

Weekly downloads
-
License
-
Repository
-
Last release
4 years ago

NG-DRIVE Commons

Motivation

Reuse components along Zara Drive applications

Install

npm i ng-drivecommons

Use

Styles

This package has a styles.scss file in root, you can import it in your project's angular.json if you want to reproduce the styles used in Drive.

        ....
        "styles": [
                "./node_modules/ng-drivecommons/styles.scss",
                ....
        ]

You can use our pre-defined variables too. They are in _variables.scss file at root level. You have to import the folder on each scss file where you want to use them like:

@import '~ng-drivecommons/variables';

By default this library implements two themes, light and mixed. With required style modifications for inner components.

Components

To use these components in your Zara Drive application you should import the module ComponentsModule from 'ng-drivecommons' in your application module.

You probably want to import them in your shared module, so you can use these component in all your application instead of import them one time per module.

These component are inmutable, you can't modify methods unless you extend your own component from one of these, and implement your own templates and css.

The component DriveTopbarComponent can use other components inside using the configuration paramenters menus and filters, if you want to know more refer to the docs.

Exported components

Exported components are:

Services

To use these services you need to provide them with your environment variables. In order to do this you should import ServicesModule from 'ng-drivecommons' in your app.module as follows

import { environment } from 'environments/environment';

@NgModule({
    ...
    imports: [
        ...
        ServicesModule.forRoot(environment)
    ]
})

Environment object should be like it is specified in DOCS.

Optionally you can send a implementations object too, with your custom implementations for these services,

Exported services

Exported services are:

  • DriveBroadcasterService: Allow us to create subscriptions with some key, so we can send messages through these subscriptions, and receive them as a subscriptor to do some action
  • DriveAuthService: Does a request to /credentials endpoint and returns received user data.
  • DriveUserService: Saves user theme and get user avatar from /user/user-avatar endpoint
  • DriveLogService: Make posts to /log endpoint
  • DriveFilterService: Encapsulates drive filters common methods like get, set, reset and getQueryString

These services can be used as they are, or you can extend your custom service from one of these and modify or add your custom methods, then you have to send the implementations as an attribute of implementation in forRoot method.

These service are injected as singletons using DI strategy, like:

@NgModule({
})
export class ServicesModule {
    public static forRoot(environment: Environment, impl: Implementations = {} as any): ModuleWithProviders {
        return {
            ngModule: ServicesModule,
            providers: [
                ....
                {
                    provide: DriveFilterService,
                    useClass: impl.filterService || DriveFilterService
                },
                ....

More info

More info in DOCS.

Development

npm install

To build for production, run:

npm run build

To run the unit tests for the components, run:

npm test

You'll find the compiled module under /drive_commons/dist dir.

Naming Components

All of the web components must use the prefix drive.

Deployment

Every release is built and deployed to npm via Github Actions.

Maintainers

Contributing

See Contributing


Changelog

See Changelog

1.19.1

4 years ago

1.19.0

4 years ago

1.18.1

4 years ago

1.18.0

4 years ago

1.17.0

4 years ago

1.16.1

4 years ago

1.16.0

4 years ago

1.15.2

4 years ago

1.15.1

4 years ago

1.15.0

4 years ago

1.14.2

4 years ago

1.14.1

4 years ago

1.14.0

4 years ago

1.13.0

4 years ago

1.12.1

4 years ago

1.12.0

4 years ago

1.11.7

4 years ago

1.11.6

4 years ago

1.11.5

4 years ago

1.11.4

4 years ago

1.11.3

4 years ago

1.11.2

4 years ago

1.11.1

4 years ago

1.11.0

4 years ago

1.10.3

4 years ago

1.10.2

4 years ago

1.10.1

4 years ago

1.9.3

4 years ago

1.9.2

4 years ago

1.10.0

4 years ago

1.9.1

4 years ago

1.9.0

4 years ago

1.8.4

4 years ago

1.8.3

4 years ago

1.8.2

4 years ago

1.8.1

4 years ago

1.8.0

4 years ago

1.7.2

4 years ago

1.7.1

4 years ago

1.7.0

4 years ago

1.6.8

4 years ago

1.6.7

4 years ago

1.6.6

4 years ago

1.6.4

4 years ago

1.6.3

4 years ago

1.5.4

4 years ago

1.6.2

4 years ago

1.6.1

4 years ago

1.6.0

4 years ago

1.6.5

4 years ago

1.5.3

4 years ago

1.5.2

4 years ago

1.5.0

4 years ago

1.4.3

4 years ago

1.4.2

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

0.5.0

4 years ago

0.4.5

4 years ago

0.4.3

4 years ago

0.4.2

4 years ago

0.4.1

4 years ago

0.4.0

4 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

1.0.0

5 years ago