Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(directive): as standalone #69

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions projects/uiowa/digit-only/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,21 @@ npm i @uiowa/digit-only

```typescript
// in your Angular module
import { DigitOnlyModule } from '@uiowa/digit-only';
import {
DigitOnlyDirective,
MaskDirective,
} from '@uiowa/digit-only';

@NgModule({
declarations: [
...
],
imports: [
BrowserModule,
DigitOnlyModule

// DigitOnly
DigitOnlyDirective,
MaskDirective,
],
...
})
Expand Down
4 changes: 2 additions & 2 deletions projects/uiowa/digit-only/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
},
"license": "MIT",
"peerDependencies": {
"@angular/common": ">=12.0.0",
"@angular/core": ">=12.0.0"
"@angular/common": ">=16.0.0",
"@angular/core": ">=16.0.0"
},
"dependencies": {
"tslib": "^2.3.0"
Expand Down
1 change: 1 addition & 0 deletions projects/uiowa/digit-only/src/lib/digit-only.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from '@angular/core';

@Directive({
standalone: true,
selector: '[digitOnly]',
})
export class DigitOnlyDirective implements OnChanges {
Expand Down
10 changes: 0 additions & 10 deletions projects/uiowa/digit-only/src/lib/digit-only.module.ts

This file was deleted.

1 change: 1 addition & 0 deletions projects/uiowa/digit-only/src/lib/mask.directive.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Directive, ElementRef, HostListener, OnInit } from '@angular/core';

@Directive({
standalone: true,
selector: '[mask]',
})
export class MaskDirective implements OnInit {
Expand Down
1 change: 0 additions & 1 deletion projects/uiowa/digit-only/src/public-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@

export * from './lib/digit-only.directive';
export * from './lib/mask.directive';
export * from './lib/digit-only.module';
15 changes: 10 additions & 5 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
import { RouterModule } from '@angular/router';

import {
DigitOnlyDirective,
MaskDirective,
} from '../../projects/uiowa/digit-only/src/public-api';
import { AppComponent } from './app.component';
import { DigitOnlyDemosComponent } from './digit-only-demos/digit-only-demos.component';
import { MaskDemosComponent } from './mask-demos/mask-demos.component';
import { DigitOnlyModule } from '../../projects/uiowa/digit-only/src/public-api';
// import { DigitOnlyModule } from '@uiowa/digit-only';

@NgModule({
declarations: [AppComponent, DigitOnlyDemosComponent, MaskDemosComponent],
imports: [
BrowserModule,
FormsModule,
DigitOnlyModule,
RouterModule.forRoot([
{ path: '', pathMatch: 'full', redirectTo: 'demo' },
{ path: 'demo', component: DigitOnlyDemosComponent },
{ path: 'mask', component: MaskDemosComponent },
{ path: '**', redirectTo: '' },
]),

// DigitOnly
DigitOnlyDirective,
MaskDirective,
],
providers: [],
bootstrap: [AppComponent],
Expand Down
5 changes: 2 additions & 3 deletions src/app/digit-only-demos/digit-only-demos.component.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';

@Component({
selector: 'app-digit-only-demos',
templateUrl: './digit-only-demos.component.html',
styleUrls: ['./digit-only-demos.component.css'],
})
export class DigitOnlyDemosComponent implements OnInit {
export class DigitOnlyDemosComponent {
amount: string = '';
min = 0;
max = 10;
Expand All @@ -14,7 +14,6 @@ export class DigitOnlyDemosComponent implements OnInit {

constructor() {}

ngOnInit(): void {}
watchAmountValue() {
const value = Number(this.amount);
this.amount = value.toFixed(2);
Expand Down
13 changes: 3 additions & 10 deletions src/app/mask-demos/mask-demos.component.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';

@Component({
selector: 'app-mask-demos',
templateUrl: './mask-demos.component.html',
styleUrls: ['./mask-demos.component.css']
styleUrls: ['./mask-demos.component.css'],
})
export class MaskDemosComponent implements OnInit {

constructor() { }

ngOnInit(): void {
}

}
export class MaskDemosComponent {}