Skip to content

Commit

Permalink
Merge pull request #11 from Kr0san89/feature/standalone_component
Browse files Browse the repository at this point in the history
Feature/standalone component
  • Loading branch information
Kr0san89 authored Jun 24, 2022
2 parents 6d0834e + a0d6a86 commit 2d36403
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 19 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ If you still use Angular <= 12 please use the original package. https://www.npmj
Add `ClickOutsideModule` to your list of module imports:

```typescript
import {NgClickOutsideModule} from 'ng-click-outside2';
import {NgClickOutsideDirective} from 'ng-click-outside2';

@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, NgClickOutsideModule],
imports: [BrowserModule, NgClickOutsideDirective],
bootstrap: [AppComponent]
})
class AppModule {}
Expand Down Expand Up @@ -81,11 +81,11 @@ export class AppComponent {
// change imports
import { ClickOutsideModule } from 'ng-click-outside';
// to
import {NgClickOutsideModule} from 'ng-click-outside2';
import {NgClickOutsideDirective} from 'ng-click-outside2';
// and in Module import
ClickOutsideModule
// to
NgClickOutsideModule
NgClickOutsideDirective
```
---
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"build": "ng build",
"build:lib": "ng build ng-click-outside2 && cp README.md dist/ng-click-outside2",
"publish:lib": "cd dist/ng-click-outside2 && npm publish",
"publish:next:lib": "cd dist/ng-click-outside2 && npm publish --tag alpha",
"watch": "ng build --watch --configuration development",
"test": "ng test",
"lint": "ng lint",
Expand Down Expand Up @@ -60,4 +61,4 @@
"ng-packagr": "^14.0.0",
"typescript": "~4.7.3"
}
}
}
4 changes: 2 additions & 2 deletions projects/demo/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppComponent } from './app.component';
import {NgClickOutsideModule} from 'ng-click-outside2';
import {NgClickOutsideDirective} from "ng-click-outside2";

@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule.withServerTransition({ appId: 'serverApp' }),
NgClickOutsideModule
NgClickOutsideDirective
],
providers: [],
bootstrap: [AppComponent]
Expand Down
8 changes: 3 additions & 5 deletions projects/ng-click-outside2/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ng-click-outside2",
"version": "11.0.0",
"version": "11.1.0",
"description": "Angular directive for handling click events outside an element.",
"license": "MIT",
"keywords": [
Expand All @@ -18,9 +18,7 @@
"author": "Eugene Cheung, Manuel Schmidt",
"peerDependencies": {
"@angular/common": ">=14.0.0",
"@angular/core": ">=14.0.0"
},
"dependencies": {
"tslib": "^2.1.0"
"@angular/core": ">=14.0.0",
"tslib": ">=2.1.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import {
} from '@angular/core';
import {DOCUMENT} from '@angular/common';

@Directive({selector: '[clickOutside]'})
@Directive({
selector: '[clickOutside]',
standalone: true,
})
export class NgClickOutsideDirective implements OnInit, OnChanges, OnDestroy {

@Input() clickOutsideEnabled = true;
Expand Down
11 changes: 5 additions & 6 deletions projects/ng-click-outside2/src/lib/ng-click-outside.module.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import {NgModule} from '@angular/core';
import {NgClickOutsideDirective} from './ng-click-outside.directive';


const exportDeclarations = [NgClickOutsideDirective];

/**
* @deprecated use NgClickOutsideDirective directly as it is a Standalone Component, the Module will be removed in Version 12
*/
@NgModule({
declarations: exportDeclarations,
imports: [],
exports: exportDeclarations
imports: [NgClickOutsideDirective],
exports: [NgClickOutsideDirective]
})
export class NgClickOutsideModule {
}

0 comments on commit 2d36403

Please sign in to comment.