See Demos or try in Stackblitz
- [] TODO
npm install --save @ng-lenta
yarn add @ng-lenta
import { NgLentaModule } from '@ng-lenta';
@NgModule({
declarations: [AppComponent],
imports: [NgLentaModule],
bootstrap: [AppComponent]
})
export class AppModule {}
To allow customization and theming, ng-lenta
bundle includes only generic styles that are necessary for correct layout and positioning. To get full look of the control, include one of the themes in your application. If you're using the Angular CLI, you can add this to your styles.scss
or include it in angular-cli.json
.
@import "~@ng-lenta/themes/default.theme.css";
// ... or
@import "~@ng-lenta/themes/material.theme.css";
You can also set global configuration and localization messages by providing custom NG_SELECT_DEFAULT_CONFIG
providers: [
{
provide: NG_LENTA_DEFAULT_CONFIG,
useValue: {
notFoundText: 'Custom not found'
}
}
]
If you are using SystemJS, you should also adjust your configuration to point to the UMD bundle.
In your systemjs config file, map
needs to tell the System loader where to look for ng-lenta
:
map: {
'@ng-lenta': 'node_modules/ng-lenta/bundles/ng-lenta.umd.js',
}
Input | Type | Default | Required | Description |
---|---|---|---|---|
[todo] | todo |
false |
no | Allows to create custom todo. |
Output | Description |
---|---|
(todo) | Fired todo |
Name | Description |
---|---|
todo | Opens todo |
ng-lenta component implements OnPush
change detection which means the dirty checking checks for immutable
data types. That means if you do object mutations like:
this.items.push({id: 1, name: 'New item'})
Component will not detect a change. Instead you need to do:
this.items.push({id: 1, name: 'New item'})
this.items = [...this.items];
This will cause the component to detect the change and update. Some might have concerns that
this is a pricey operation, however, it is much more performant than running ngDoCheck
and
constantly diffing the array.
If you are not happy with default styles you can easily override them with increased selector specificity or creating your own theme. E.g.
<ng-lenta class="custom"></ng-lenta>
.ng-lenta.custom {
border:0px;
min-height: 0px;
border-radius: 0;
}
.ng-lenta.custom .ng-lenta-container {
min-height: 0px;
border-radius: 0;
}
Contributions are welcome. You can start by looking at issues with label Help wanted or creating new Issue with proposal or bug report. Note that we are using https://conventionalcommits.org/ commits format.
Perform the clone-to-launch steps with these terminal commands.
git clone https://github.com/ng-lenta
cd ng-lenta
yarn
yarn run start
yarn run test
or
yarn run test:watch
To release to npm just run ./release.sh
, of course if you have permissions ;)