-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ref-table): initial setup 🎉 #41
- Loading branch information
Showing
25 changed files
with
595 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# RefTable | ||
|
||
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.0.0. | ||
|
||
## Code scaffolding | ||
|
||
Run `ng generate component component-name --project ref-table` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project ref-table`. | ||
> Note: Don't forget to add `--project ref-table` or else it will be added to the default project in your `angular.json` file. | ||
## Build | ||
|
||
Run `ng build ref-table` to build the project. The build artifacts will be stored in the `dist/` directory. | ||
|
||
## Publishing | ||
|
||
After building your library with `ng build ref-table`, go to the dist folder `cd dist/ref-table` and run `npm publish`. | ||
|
||
## Running unit tests | ||
|
||
Run `ng test ref-table` to execute the unit tests via [Karma](https://karma-runner.github.io). | ||
|
||
## Further help | ||
|
||
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Karma configuration file, see link for more information | ||
// https://karma-runner.github.io/1.0/config/configuration-file.html | ||
|
||
module.exports = function (config) { | ||
config.set({ | ||
basePath: '', | ||
frameworks: ['jasmine', '@angular-devkit/build-angular'], | ||
plugins: [ | ||
require('karma-jasmine'), | ||
require('karma-chrome-launcher'), | ||
require('karma-jasmine-html-reporter'), | ||
require('karma-coverage'), | ||
require('@angular-devkit/build-angular/plugins/karma') | ||
], | ||
client: { | ||
clearContext: false // leave Jasmine Spec Runner output visible in browser | ||
}, | ||
coverageReporter: { | ||
dir: require('path').join(__dirname, '../../coverage/ref-table'), | ||
subdir: '.', | ||
reporters: [ | ||
{ type: 'html' }, | ||
{ type: 'text-summary' } | ||
] | ||
}, | ||
reporters: ['progress', 'kjhtml'], | ||
port: 9876, | ||
colors: true, | ||
logLevel: config.LOG_INFO, | ||
autoWatch: true, | ||
browsers: ['Chrome'], | ||
singleRun: false, | ||
restartOnFileChange: true | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json", | ||
"dest": "../../dist/ref-table", | ||
"lib": { | ||
"entryFile": "src/public-api.ts" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json", | ||
"dest": "../../dist/@jaspero/fb-ref-table", | ||
"lib": { | ||
"entryFile": "src/public-api.ts" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"name": "@jaspero/fb-ref-table", | ||
"version": "0.0.1", | ||
"peerDependencies": { | ||
"@angular/common": "^11.0.0", | ||
"@angular/core": "^11.0.0" | ||
}, | ||
"dependencies": { | ||
"tslib": "^2.0.0" | ||
}, | ||
"release": { | ||
"pkgRoot": "../../dist/@jaspero/fb-ref-table", | ||
"branch": "master", | ||
"verifyConditions": [ | ||
"@semantic-release/changelog", | ||
"@semantic-release/npm", | ||
"@semantic-release/git" | ||
], | ||
"prepare": [ | ||
"@semantic-release/changelog", | ||
"@semantic-release/npm", | ||
"@semantic-release/git" | ||
], | ||
"publish": [ | ||
"@semantic-release/npm", | ||
[ | ||
"@semantic-release/github", | ||
{ | ||
"assets": [ | ||
"dist/@jaspero/fb-ref-table" | ||
] | ||
} | ||
] | ||
], | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import {CommonModule} from '@angular/common'; | ||
import {NgModule} from '@angular/core'; | ||
import {MatButtonModule} from '@angular/material/button'; | ||
import {MatCardModule} from '@angular/material/card'; | ||
import {MatIconModule} from '@angular/material/icon'; | ||
import {FormBuilderContextService, FormBuilderModule} from '@jaspero/form-builder'; | ||
import {TranslocoModule} from '@ngneat/transloco'; | ||
import {RefTableComponent} from './ref-table/ref-table.component'; | ||
|
||
@NgModule({ | ||
declarations: [RefTableComponent], | ||
imports: [ | ||
CommonModule, | ||
|
||
FormBuilderModule, | ||
|
||
MatCardModule, | ||
MatButtonModule, | ||
MatIconModule, | ||
|
||
TranslocoModule | ||
] | ||
}) | ||
export class FbRefTableModule { | ||
constructor( | ||
private ctx: FormBuilderContextService | ||
) { | ||
this.ctx.registerField( | ||
'ref-table', | ||
RefTableComponent | ||
); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
projects/ref-table/src/lib/ref-table/ref-table.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<mat-card> | ||
<mat-card-header> | ||
<mat-card-title>{{cData.label}}</mat-card-title> | ||
</mat-card-header> | ||
|
||
<mat-card-content> | ||
<div class="item" *ngFor="let item of items; index as index"> | ||
<button class="item-delete" mat-icon-button color="warn" (click)="remove(item, index)"> | ||
<mat-icon>cancel</mat-icon> | ||
</button> | ||
<fb-form-builder [data]="item.data"></fb-form-builder> | ||
</div> | ||
</mat-card-content> | ||
|
||
<mat-card-actions> | ||
<button mat-stroked-button color="primary" (click)="add()"> | ||
{{cData.addLabel | transloco}} | ||
</button> | ||
</mat-card-actions> | ||
</mat-card> |
12 changes: 12 additions & 0 deletions
12
projects/ref-table/src/lib/ref-table/ref-table.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.item { | ||
display: flex; | ||
justify-content: space-between; | ||
|
||
&-delete { | ||
padding-top: 1rem; | ||
} | ||
|
||
fb-form-builder { | ||
width: 100%; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
projects/ref-table/src/lib/ref-table/ref-table.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { RefTableComponent } from './ref-table.component'; | ||
|
||
describe('RefTableComponent', () => { | ||
let component: RefTableComponent; | ||
let fixture: ComponentFixture<RefTableComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ RefTableComponent ] | ||
}) | ||
.compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(RefTableComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
Oops, something went wrong.