Skip to content

Commit

Permalink
Chore/release 12.1.0 (#188)
Browse files Browse the repository at this point in the history
* fix: set prefix correctly

* chore: update version
  • Loading branch information
maxisam authored May 28, 2019
1 parent 960e78d commit 1ee66ab
Show file tree
Hide file tree
Showing 9 changed files with 213 additions and 177 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ testem.log
# System Files
.DS_Store
Thumbs.db
package-lock.json
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,16 @@ Or updating parameters directly like so

### Conditionally render host

You can also use the structural directive *ngxClipboardIfSupported to conditionally render the host element
You can also use the structural directive \*ngxClipboardIfSupported to conditionally render the host element

```html
<button ngxClipboard *ngxClipboardIfSupported [cbContent]="'target string'" (cbOnSuccess)="isCopied = true">Copy</button>
<button ngxClipboard *ngxClipboardIfSupported [cbContent]="'target string'" (cbOnSuccess)="isCopied = true">Copy</button>
```

_Special thanks to @surajpoddar16 for implementing this feature_

### Handle copy response globally

To handle copy response globally, you can subscribe to `copyResponse$` exposed by the `ClipboardService`

```
Expand All @@ -136,7 +139,7 @@ export class ClipboardResponseService {
) {
this.handleClipboardResponse();
}
handleClipboardResponse() {
this._clipboardService.copyObservable$.subscribe((res: IClipboardResponse) => {
if (res.isSuccess) {
Expand All @@ -147,6 +150,7 @@ export class ClipboardResponseService {
}
```

_Special thanks to @surajpoddar16 for implementing this feature_

## Example

Expand Down
49 changes: 38 additions & 11 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,15 @@
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["node_modules/@clr/ui/clr-ui.min.css", "node_modules/@clr/icons/clr-icons.min.css", "src/styles.css"],
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"node_modules/@clr/ui/clr-ui.min.css",
"node_modules/@clr/icons/clr-icons.min.css",
"src/styles.css"
],
"scripts": []
},
"configurations": {
Expand Down Expand Up @@ -66,16 +73,26 @@
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": ["src/styles.css"],
"styles": [
"src/styles.css"
],
"scripts": [],
"assets": ["src/favicon.ico", "src/assets"]
"assets": [
"src/favicon.ico",
"src/assets"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": ["src/tsconfig.app.json", "src/tsconfig.spec.json"],
"exclude": ["**/node_modules/**"]
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
Expand All @@ -95,7 +112,9 @@
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": ["**/node_modules/**"]
"exclude": [
"**/node_modules/**"
]
}
}
}
Expand All @@ -104,7 +123,7 @@
"root": "projects/ngx-clipboard",
"sourceRoot": "projects/ngx-clipboard/src",
"projectType": "library",
"prefix": "lib",
"prefix": "ngx",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
Expand All @@ -129,12 +148,20 @@
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": ["projects/ngx-clipboard/tsconfig.lib.json", "projects/ngx-clipboard/tsconfig.spec.json"],
"exclude": ["**/node_modules/**"]
"tsConfig": [
"projects/ngx-clipboard/tsconfig.lib.json",
"projects/ngx-clipboard/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "library-host"
"defaultProject": "library-host",
"cli": {
"packageManager": "yarn"
}
}
34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,34 @@
"build": "ng build ngx-clipboard --prod && npm run build-copy",
"test": "ng test ngx-clipboard",
"lint": "ng lint ngx-clipboard",
"publish:lib": "npm publish ./dist/lib",
"publish:lib:next": "npm publish ./dist/lib --tag next",
"publish:lib": "yarn publish ./dist/lib",
"publish:lib:next": "yarn publish ./dist/lib --tag next",
"build-copy": "cpx \"./README.md\" \"./dist/lib\"",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "~7.2.0",
"@angular/common": "~7.2.0",
"@angular/compiler": "~7.2.0",
"@angular/core": "~7.2.0",
"@angular/forms": "~7.2.0",
"@angular/platform-browser": "~7.2.0",
"@angular/platform-browser-dynamic": "~7.2.0",
"@angular/router": "~7.2.0",
"@angular/animations": "~7.2.15",
"@angular/common": "~7.2.15",
"@angular/compiler": "~7.2.15",
"@angular/core": "~7.2.15",
"@angular/forms": "~7.2.15",
"@angular/platform-browser": "~7.2.15",
"@angular/platform-browser-dynamic": "~7.2.15",
"@angular/router": "~7.2.15",
"core-js": "^2.5.4",
"rxjs": "~6.3.3",
"rxjs": "~6.5.2",
"tslib": "^1.9.0",
"zone.js": "~0.8.26",
"ngx-clipboard": "12.0.0-beta.1",
"ngx-window-token": "2.0.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.13.0",
"@angular-devkit/build-ng-packagr": "~0.13.0",
"@angular/cli": "~7.3.4",
"@angular/compiler-cli": "~7.2.0",
"@angular/language-service": "~7.2.0",
"@angular-devkit/build-angular": "~0.13.9",
"@angular-devkit/build-ng-packagr": "~0.13.9",
"@angular/cli": "~7.3.9",
"@angular/compiler-cli": "~7.2.15",
"@angular/language-service": "~7.2.15",
"@types/node": "~8.9.4",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
Expand All @@ -52,7 +52,7 @@
"tsickle": ">=0.34.0",
"tslib": "^1.9.0",
"tslint": "~5.11.0",
"typescript": "~3.2.2",
"typescript": "~3.2.4",
"@webcomponents/custom-elements": "^1.2.1",
"@clr/ui": "^0.13.6",
"@clr/angular": "^0.13.6",
Expand Down
2 changes: 1 addition & 1 deletion projects/ngx-clipboard/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ngx-clipboard",
"description": "angular 2 clipboard",
"version": "12.0.1",
"version": "12.1.0",
"author": {
"name": "Sam Lin",
"email": "[email protected]"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
import { Directive, OnChanges, TemplateRef, ViewContainerRef, OnInit } from '@angular/core';
import { Directive, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';

import { ClipboardService } from './ngx-clipboard.service';

@Directive({
// tslint:disable-next-line:directive-selector
selector: '[ngxClipboardIfSupported]',
selector: '[ngxClipboardIfSupported]'
})
export class ClipboardIfSupportedDirective implements OnInit {
constructor(
private _clipboardService: ClipboardService,
private _viewContainerRef: ViewContainerRef,
private _templateRef: TemplateRef<any>
) {}
constructor(private _clipboardService: ClipboardService, private _viewContainerRef: ViewContainerRef, private _templateRef: TemplateRef<any>) {}

ngOnInit() {
if (this._clipboardService.isSupported) {
this._viewContainerRef.createEmbeddedView(this._templateRef);
}
if (this._clipboardService.isSupported) {
this._viewContainerRef.createEmbeddedView(this._templateRef);
}
}
}
3 changes: 1 addition & 2 deletions projects/ngx-clipboard/src/lib/ngx-clipboard.directive.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { Directive, EventEmitter, HostListener, Input, OnDestroy, OnInit, Output } from '@angular/core';

import { ClipboardService } from './ngx-clipboard.service';
import { IClipboardResponse } from './interface';
import { ClipboardService } from './ngx-clipboard.service';

@Directive({
// tslint:disable-next-line:directive-selector
selector: '[ngxClipboard]'
})
export class ClipboardDirective implements OnInit, OnDestroy {
Expand Down
4 changes: 2 additions & 2 deletions projects/ngx-clipboard/tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"directive-selector": [
true,
"attribute",
"lib",
"ngx",
"camelCase"
],
"component-selector": [
true,
"element",
"lib",
"ngx",
"kebab-case"
]
}
Expand Down
Loading

0 comments on commit 1ee66ab

Please sign in to comment.