Skip to content

Commit

Permalink
feat: upgrade to angular RC5
Browse files Browse the repository at this point in the history
BREAKING CHANGE:

Angular RC5 is now required

The Resizable and ResizeHandle directives are now no longer exported. Instead you must use the ResizableModule. See the readme or the demo app for an example of how to do this.
  • Loading branch information
Matt Lewis committed Aug 12, 2016
1 parent 9c76aac commit 9557c0a
Show file tree
Hide file tree
Showing 10 changed files with 537 additions and 529 deletions.
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,32 @@ Then use it in your app like so:

```typescript
import {Component} from '@angular/core';
import {Resizable} from 'angular2-resizable';
import {ResizeEvent} from 'angular2-resizable';

@Component({
selector: 'demo-app',
directives: [Resizable],
// you should add some styles to the element. See the demo folder for a more fleshed out example
template: '<div mwl-resizable (resizeEnd)="onResizeEnd($event)"></div>'
})
export class DemoApp {
export class MyComponent {

onResizeEnd(event: any): void {
onResizeEnd(event: ResizeEvent): void {
console.log('Element was resized', event);
}

}

// now use within your apps module
import {NgModule} from '@angular/core';
import {ResizableModule} from 'angular2-resizable';

@NgModule({
declarations: [MyComponent],
imports: [ResizableModule],
bootstrap: [MyComponent]
})
class MyModule {}

```

You may also find it useful to view the [demo source](https://github.com/mattlewis92/angular2-resizable/blob/master/demo/demo.ts).
Expand Down
10 changes: 2 additions & 8 deletions angular2-resizable.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
import {Resizable} from './src/resizable.directive';

export * from './src/resizable.directive';

// for angular-cli
export default {
directives: [Resizable]
};
export * from './src/resizable.module';
export {ResizeEvent} from './src/resizable.directive';
6 changes: 2 additions & 4 deletions demo/demo.ts → demo/demo.component.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import {Component} from '@angular/core';
import {NgStyle} from '@angular/common';
import {Resizable, ResizeEvent, ResizeHandle} from './../angular2-resizable';
import {ResizeEvent} from './../angular2-resizable';

@Component({
selector: 'demo-app',
directives: [Resizable, ResizeHandle, NgStyle],
styles: [`
.rectangle {
position: relative;
Expand Down Expand Up @@ -47,7 +45,7 @@ import {Resizable, ResizeEvent, ResizeHandle} from './../angular2-resizable';
</div>
`
})
export class DemoApp {
export class Demo {

public style: Object = {};

Expand Down
11 changes: 11 additions & 0 deletions demo/demo.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {ResizableModule} from './../angular2-resizable';
import {Demo} from './demo.component';

@NgModule({
declarations: [Demo],
imports: [BrowserModule, ResizableModule],
bootstrap: [Demo]
})
export class DemoModule {}
6 changes: 3 additions & 3 deletions demo/entry.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import 'reflect-metadata';
import 'zone.js/dist/zone';
import {enableProdMode} from '@angular/core';
import {bootstrap} from '@angular/platform-browser-dynamic';
import {DemoApp} from './demo';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {DemoModule} from './demo.module';

declare var ENV: string;
if (ENV === 'production') {
enableProdMode();
}

bootstrap(DemoApp);
platformBrowserDynamic().bootstrapModule(DemoModule);
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"url": "git+https://github.com/mattlewis92/angular2-resizable.git"
},
"keywords": [
"angular2"
"angular2",
"resizable"
],
"author": "Matt Lewis",
"license": "MIT",
Expand All @@ -35,11 +36,11 @@
},
"homepage": "https://github.com/mattlewis92/angular2-resizable#readme",
"devDependencies": {
"@angular/common": "2.0.0-rc.4",
"@angular/compiler": "2.0.0-rc.4",
"@angular/core": "2.0.0-rc.4",
"@angular/platform-browser": "2.0.0-rc.4",
"@angular/platform-browser-dynamic": "2.0.0-rc.4",
"@angular/common": "2.0.0-rc.5",
"@angular/compiler": "2.0.0-rc.5",
"@angular/core": "2.0.0-rc.5",
"@angular/platform-browser": "2.0.0-rc.5",
"@angular/platform-browser-dynamic": "2.0.0-rc.5",
"chai": "~3.5.0",
"commitizen": "~2.8.1",
"concurrently": "~2.2.0",
Expand Down Expand Up @@ -78,7 +79,7 @@
"zone.js": "~0.6.12"
},
"peerDependencies": {
"@angular/core": "2.0.0-rc.4"
"@angular/core": "2.0.0-rc.5"
},
"files": [
"angular2-resizable.js",
Expand Down
2 changes: 1 addition & 1 deletion src/resizable.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ export class Resizable implements OnInit, AfterViewInit {
/**
* @private
*/
constructor(private renderer: Renderer, private elm: ElementRef) {}
constructor(private renderer: Renderer, public elm: ElementRef) {}

/**
* @private
Expand Down
8 changes: 8 additions & 0 deletions src/resizable.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {NgModule} from '@angular/core';
import {Resizable, ResizeHandle} from './resizable.directive';

@NgModule({
declarations: [Resizable, ResizeHandle],
exports: [Resizable, ResizeHandle]
})
export class ResizableModule {}
10 changes: 6 additions & 4 deletions test/entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@ import 'zone.js/dist/zone';
import 'zone.js/dist/long-stack-trace-zone';
import 'zone.js/dist/async-test';
import 'rxjs';
import {setBaseTestProviders} from '@angular/core/testing';
import {
TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS
TestBed
} from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
import {use} from 'chai';
import * as sinonChai from 'sinon-chai';

use(sinonChai);

setBaseTestProviders(TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS, TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS);
TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());

declare var require: any;
const testsContext: any = require.context('./', true, /\.spec/);
Expand Down
Loading

0 comments on commit 9557c0a

Please sign in to comment.