Working Frontend
This commit is contained in:
16
.browserslistrc
Normal file
16
.browserslistrc
Normal file
@ -0,0 +1,16 @@
|
||||
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
|
||||
# For additional information regarding the format and rule options, please see:
|
||||
# https://github.com/browserslist/browserslist#queries
|
||||
|
||||
# For the full list of supported browsers by the Angular framework, please see:
|
||||
# https://angular.io/guide/browser-support
|
||||
|
||||
# You can see what browsers were selected by your queries by running:
|
||||
# npx browserslist
|
||||
|
||||
last 1 Chrome version
|
||||
last 1 Firefox version
|
||||
last 2 Edge major versions
|
||||
last 2 Safari major versions
|
||||
last 2 iOS major versions
|
||||
Firefox ESR
|
2
.dockerignore
Normal file
2
.dockerignore
Normal file
@ -0,0 +1,2 @@
|
||||
environment.prod.ts
|
||||
environment.ts
|
13
.editorconfig
Normal file
13
.editorconfig
Normal file
@ -0,0 +1,13 @@
|
||||
# Editor configuration, see https://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
max_line_length = off
|
||||
trim_trailing_whitespace = false
|
44
.gitignore
vendored
Normal file
44
.gitignore
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||
environment.prod.ts
|
||||
environment.ts
|
||||
|
||||
# Compiled output
|
||||
/dist
|
||||
/tmp
|
||||
/out-tsc
|
||||
/bazel-out
|
||||
|
||||
# Node
|
||||
/node_modules
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
|
||||
# IDEs and editors
|
||||
.idea/
|
||||
.project
|
||||
.classpath
|
||||
.c9/
|
||||
*.launch
|
||||
.settings/
|
||||
*.sublime-workspace
|
||||
|
||||
# Visual Studio Code
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
.history/*
|
||||
|
||||
# Miscellaneous
|
||||
/.angular/cache
|
||||
.sass-cache/
|
||||
/connect.lock
|
||||
/coverage
|
||||
/libpeerconnection.log
|
||||
testem.log
|
||||
/typings
|
||||
|
||||
# System files
|
||||
.DS_Store
|
||||
Thumbs.db
|
3
.vscode/extensions.json
vendored
Normal file
3
.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"recommendations": ["angular.ng-template"]
|
||||
}
|
19
.vscode/launch.json
vendored
Normal file
19
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "ng serve",
|
||||
"type": "pwa-chrome",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "npm: start",
|
||||
"url": "http://localhost:4200/"
|
||||
},
|
||||
{
|
||||
"name": "ng test",
|
||||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "npm: test",
|
||||
"url": "http://localhost:9876/debug.html"
|
||||
}
|
||||
]
|
||||
}
|
41
.vscode/tasks.json
vendored
Normal file
41
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "start",
|
||||
"isBackground": true,
|
||||
"problemMatcher": {
|
||||
"owner": "typescript",
|
||||
"pattern": "$tsc",
|
||||
"background": {
|
||||
"activeOnStart": true,
|
||||
"beginsPattern": {
|
||||
"regexp": "(.*?)"
|
||||
},
|
||||
"endsPattern": {
|
||||
"regexp": "bundle generation complete"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "test",
|
||||
"isBackground": true,
|
||||
"problemMatcher": {
|
||||
"owner": "typescript",
|
||||
"pattern": "$tsc",
|
||||
"background": {
|
||||
"activeOnStart": true,
|
||||
"beginsPattern": {
|
||||
"regexp": "(.*?)"
|
||||
},
|
||||
"endsPattern": {
|
||||
"regexp": "bundle generation complete"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
3
Dockerfile
Normal file
3
Dockerfile
Normal file
@ -0,0 +1,3 @@
|
||||
FROM nginx:1.17.1-alpine
|
||||
COPY dist/todo-frontend /usr/share/nginx/html
|
||||
EXPOSE 80
|
48
README.md
Normal file
48
README.md
Normal file
@ -0,0 +1,48 @@
|
||||
# TodoFrontend
|
||||
|
||||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.2.2.
|
||||
|
||||
| :warning: WARNING |
|
||||
|:---------------------------|
|
||||
| You need too configure `src/environments/environment.ts` & `src/environments/environment.prod.ts` first |
|
||||
|
||||
## Example src/environments/environment.prod.ts
|
||||
```typescript
|
||||
export const environment = {
|
||||
production: true,
|
||||
url: 'http://localhost:8080'
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
## Example src/environments/environment.ts
|
||||
```typescript
|
||||
export const environment = {
|
||||
production: false,
|
||||
url: 'http://localhost:8081'
|
||||
};
|
||||
```
|
||||
## Development server
|
||||
|
||||
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
|
||||
|
||||
## Code scaffolding
|
||||
|
||||
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
|
||||
|
||||
## Build
|
||||
|
||||
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
||||
|
||||
## Running end-to-end tests
|
||||
|
||||
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
|
||||
|
||||
## 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.
|
||||
|
108
angular.json
Normal file
108
angular.json
Normal file
@ -0,0 +1,108 @@
|
||||
{
|
||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||
"version": 1,
|
||||
"newProjectRoot": "projects",
|
||||
"projects": {
|
||||
"todo-frontend": {
|
||||
"projectType": "application",
|
||||
"schematics": {
|
||||
"@schematics/angular:application": {
|
||||
"strict": true
|
||||
}
|
||||
},
|
||||
"root": "",
|
||||
"sourceRoot": "src",
|
||||
"prefix": "app",
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@angular-devkit/build-angular:browser",
|
||||
"options": {
|
||||
"outputPath": "dist/todo-frontend",
|
||||
"index": "src/index.html",
|
||||
"main": "src/main.ts",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"tsConfig": "tsconfig.app.json",
|
||||
"assets": [
|
||||
"src/favicon.ico",
|
||||
"src/assets"
|
||||
],
|
||||
"styles": [
|
||||
"./node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css",
|
||||
"src/styles.css"
|
||||
],
|
||||
"scripts": []
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"budgets": [
|
||||
{
|
||||
"type": "initial",
|
||||
"maximumWarning": "500kb",
|
||||
"maximumError": "1mb"
|
||||
},
|
||||
{
|
||||
"type": "anyComponentStyle",
|
||||
"maximumWarning": "2kb",
|
||||
"maximumError": "4kb"
|
||||
}
|
||||
],
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.prod.ts"
|
||||
}
|
||||
],
|
||||
"outputHashing": "all"
|
||||
},
|
||||
"development": {
|
||||
"buildOptimizer": false,
|
||||
"optimization": false,
|
||||
"vendorChunk": true,
|
||||
"extractLicenses": false,
|
||||
"sourceMap": true,
|
||||
"namedChunks": true
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "production"
|
||||
},
|
||||
"serve": {
|
||||
"builder": "@angular-devkit/build-angular:dev-server",
|
||||
"configurations": {
|
||||
"production": {
|
||||
"browserTarget": "todo-frontend:build:production"
|
||||
},
|
||||
"development": {
|
||||
"browserTarget": "todo-frontend:build:development"
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "development"
|
||||
},
|
||||
"extract-i18n": {
|
||||
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||
"options": {
|
||||
"browserTarget": "todo-frontend:build"
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"builder": "@angular-devkit/build-angular:karma",
|
||||
"options": {
|
||||
"main": "src/test.ts",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"tsConfig": "tsconfig.spec.json",
|
||||
"karmaConfig": "karma.conf.js",
|
||||
"assets": [
|
||||
"src/favicon.ico",
|
||||
"src/assets"
|
||||
],
|
||||
"styles": [
|
||||
"./node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css",
|
||||
"src/styles.css"
|
||||
],
|
||||
"scripts": []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultProject": "todo-frontend"
|
||||
}
|
44
karma.conf.js
Normal file
44
karma.conf.js
Normal file
@ -0,0 +1,44 @@
|
||||
// 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: {
|
||||
jasmine: {
|
||||
// you can add configuration options for Jasmine here
|
||||
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
|
||||
// for example, you can disable the random execution with `random: false`
|
||||
// or set a specific seed with `seed: 4321`
|
||||
},
|
||||
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
||||
},
|
||||
jasmineHtmlReporter: {
|
||||
suppressAll: true // removes the duplicated traces
|
||||
},
|
||||
coverageReporter: {
|
||||
dir: require('path').join(__dirname, './coverage/todo-frontend'),
|
||||
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
|
||||
});
|
||||
};
|
19441
package-lock.json
generated
Normal file
19441
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
42
package.json
Normal file
42
package.json
Normal file
@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "todo-frontend",
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
"build": "ng build",
|
||||
"watch": "ng build --watch --configuration development",
|
||||
"test": "ng test"
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@angular/animations": "~13.2.0",
|
||||
"@angular/cdk": "^13.2.3",
|
||||
"@angular/common": "~13.2.0",
|
||||
"@angular/compiler": "~13.2.0",
|
||||
"@angular/core": "~13.2.0",
|
||||
"@angular/forms": "~13.2.0",
|
||||
"@angular/material": "^13.2.3",
|
||||
"@angular/platform-browser": "~13.2.0",
|
||||
"@angular/platform-browser-dynamic": "~13.2.0",
|
||||
"@angular/router": "~13.2.0",
|
||||
"axios": "^0.25.0",
|
||||
"rxjs": "~7.5.0",
|
||||
"tslib": "^2.3.0",
|
||||
"zone.js": "~0.11.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "~13.2.2",
|
||||
"@angular/cli": "~13.2.2",
|
||||
"@angular/compiler-cli": "~13.2.0",
|
||||
"@types/jasmine": "~3.10.0",
|
||||
"@types/node": "^12.11.1",
|
||||
"jasmine-core": "~4.0.0",
|
||||
"karma": "~6.3.0",
|
||||
"karma-chrome-launcher": "~3.1.0",
|
||||
"karma-coverage": "~2.1.0",
|
||||
"karma-jasmine": "~4.0.0",
|
||||
"karma-jasmine-html-reporter": "~1.7.0",
|
||||
"typescript": "~4.5.2"
|
||||
}
|
||||
}
|
10
src/app/app-routing.module.ts
Normal file
10
src/app/app-routing.module.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
|
||||
const routes: Routes = [];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forRoot(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class AppRoutingModule { }
|
0
src/app/app.component.css
Normal file
0
src/app/app.component.css
Normal file
45
src/app/app.component.html
Normal file
45
src/app/app.component.html
Normal file
@ -0,0 +1,45 @@
|
||||
|
||||
<!-- Toolbar -->
|
||||
<div class="toolbar" role="banner">
|
||||
<img
|
||||
width="40"
|
||||
alt="Angular Logo"
|
||||
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg=="
|
||||
/>
|
||||
<span>DerGeorg Todo List </span>
|
||||
</div>
|
||||
|
||||
<div class="content" role="main">
|
||||
|
||||
<router-outlet></router-outlet>
|
||||
|
||||
<!-- Footer -->
|
||||
<footer>
|
||||
Love DerGeorg Todo-liste?
|
||||
<a href="https://github.com/BSCDevOpsWebDev" target="_blank" rel="noopener"> Give my repo a star.
|
||||
<div class="github-star-badge">
|
||||
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"/></svg>
|
||||
Star
|
||||
</div>
|
||||
</a>
|
||||
<a href="https://github.com/BSCDevOpsWebDev" target="_blank" rel="noopener">
|
||||
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z" fill="#1976d2"/><path d="M0 0h24v24H0z" fill="none"/></svg>
|
||||
</a>
|
||||
</footer>
|
||||
|
||||
<svg id="clouds" xmlns="http://www.w3.org/2000/svg" width="2611.084" height="485.677" viewBox="0 0 2611.084 485.677">
|
||||
<title>Gray Clouds Background</title>
|
||||
<path id="Path_39" data-name="Path 39" d="M2379.709,863.793c10-93-77-171-168-149-52-114-225-105-264,15-75,3-140,59-152,133-30,2.83-66.725,9.829-93.5,26.25-26.771-16.421-63.5-23.42-93.5-26.25-12-74-77-130-152-133-39-120-212-129-264-15-54.084-13.075-106.753,9.173-138.488,48.9-31.734-39.726-84.4-61.974-138.487-48.9-52-114-225-105-264,15a162.027,162.027,0,0,0-103.147,43.044c-30.633-45.365-87.1-72.091-145.206-58.044-52-114-225-105-264,15-75,3-140,59-152,133-53,5-127,23-130,83-2,42,35,72,70,86,49,20,106,18,157,5a165.625,165.625,0,0,0,120,0c47,94,178,113,251,33,61.112,8.015,113.854-5.72,150.492-29.764a165.62,165.62,0,0,0,110.861-3.236c47,94,178,113,251,33,31.385,4.116,60.563,2.495,86.487-3.311,25.924,5.806,55.1,7.427,86.488,3.311,73,80,204,61,251-33a165.625,165.625,0,0,0,120,0c51,13,108,15,157-5a147.188,147.188,0,0,0,33.5-18.694,147.217,147.217,0,0,0,33.5,18.694c49,20,106,18,157,5a165.625,165.625,0,0,0,120,0c47,94,178,113,251,33C2446.709,1093.793,2554.709,922.793,2379.709,863.793Z" transform="translate(142.69 -634.312)" fill="#eee"/>
|
||||
</svg>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
|
||||
<!-- * * * * * * * * * * * The content above * * * * * * * * * * * -->
|
||||
<!-- * * * * * * * * * * is only a placeholder * * * * * * * * * * -->
|
||||
<!-- * * * * * * * * * * and can be replaced. * * * * * * * * * * * -->
|
||||
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
|
||||
<!-- * * * * * * * * * * End of Placeholder * * * * * * * * * * * -->
|
||||
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
|
||||
|
||||
|
35
src/app/app.component.spec.ts
Normal file
35
src/app/app.component.spec.ts
Normal file
@ -0,0 +1,35 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { AppComponent } from './app.component';
|
||||
|
||||
describe('AppComponent', () => {
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [
|
||||
RouterTestingModule
|
||||
],
|
||||
declarations: [
|
||||
AppComponent
|
||||
],
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
it('should create the app', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.componentInstance;
|
||||
expect(app).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should have as title 'todo-frontend'`, () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.componentInstance;
|
||||
expect(app.title).toEqual('todo-frontend');
|
||||
});
|
||||
|
||||
it('should render title', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
fixture.detectChanges();
|
||||
const compiled = fixture.nativeElement as HTMLElement;
|
||||
expect(compiled.querySelector('.content span')?.textContent).toContain('todo-frontend app is running!');
|
||||
});
|
||||
});
|
15
src/app/app.component.ts
Normal file
15
src/app/app.component.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
templateUrl: './app.component.html',
|
||||
styleUrls: ['./app.component.css']
|
||||
})
|
||||
export class AppComponent {
|
||||
title = 'todo-frontend';
|
||||
constructor() {}
|
||||
|
||||
|
||||
ngOnInit(){
|
||||
}
|
||||
}
|
74
src/app/app.module.ts
Normal file
74
src/app/app.module.ts
Normal file
@ -0,0 +1,74 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { AppRoutingModule } from './app-routing.module';
|
||||
import { AppComponent } from './app.component';
|
||||
import { TaskComponent } from './task/task.component';
|
||||
import { TaskHolderComponent } from './task-holder/task-holder.component';
|
||||
import { TaskAddComponent } from './task-add/task-add.component';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'
|
||||
import {MatIconModule} from "@angular/material/icon";
|
||||
import {TaskService} from "./task.service";
|
||||
import {HttpClientModule} from "@angular/common/http";
|
||||
import {MatTabsModule} from "@angular/material/tabs";
|
||||
import {MatTableModule} from "@angular/material/table";
|
||||
import {MatCardModule} from "@angular/material/card";
|
||||
import {DragDropModule} from "@angular/cdk/drag-drop";
|
||||
import {FormsModule, ReactiveFormsModule} from "@angular/forms";
|
||||
import { CommonModule } from '@angular/common';
|
||||
import {MatRadioModule} from "@angular/material/radio";
|
||||
import {MatFormFieldModule} from "@angular/material/form-field";
|
||||
import {MatInputModule} from "@angular/material/input";
|
||||
import {MatButtonModule} from "@angular/material/button";
|
||||
import {MatGridListModule} from "@angular/material/grid-list";
|
||||
import {MatDividerModule} from "@angular/material/divider";
|
||||
import {MatSnackBarModule} from "@angular/material/snack-bar";
|
||||
import {MatDatepickerModule} from "@angular/material/datepicker";
|
||||
import {MatNativeDateModule} from "@angular/material/core";
|
||||
import {MatButtonToggleModule} from "@angular/material/button-toggle";
|
||||
import {TaskEditComponent} from "./task-edit/task-edit.component";
|
||||
import {MatDialogModule} from "@angular/material/dialog";
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
TaskComponent,
|
||||
TaskHolderComponent,
|
||||
TaskAddComponent,
|
||||
TaskEditComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
CommonModule,
|
||||
MatIconModule,
|
||||
AppRoutingModule,
|
||||
HttpClientModule,
|
||||
RouterModule.forRoot([
|
||||
{path: '', component: TaskHolderComponent},
|
||||
{path: 'add', component: TaskAddComponent},
|
||||
]),
|
||||
BrowserAnimationsModule,
|
||||
MatTabsModule,
|
||||
MatTableModule,
|
||||
MatCardModule,
|
||||
DragDropModule,
|
||||
FormsModule,
|
||||
MatRadioModule,
|
||||
MatFormFieldModule,
|
||||
MatInputModule,
|
||||
ReactiveFormsModule,
|
||||
MatButtonModule,
|
||||
MatGridListModule,
|
||||
MatDividerModule,
|
||||
MatSnackBarModule,
|
||||
MatDatepickerModule,
|
||||
MatNativeDateModule,
|
||||
MatButtonToggleModule,
|
||||
MatDialogModule,
|
||||
],
|
||||
providers: [
|
||||
TaskService
|
||||
],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
export class AppModule { }
|
16
src/app/date-utils.service.spec.ts
Normal file
16
src/app/date-utils.service.spec.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DateUtilsService } from './date-utils.service';
|
||||
|
||||
describe('DateUtilsService', () => {
|
||||
let service: DateUtilsService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(DateUtilsService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
35
src/app/date-utils.service.ts
Normal file
35
src/app/date-utils.service.ts
Normal file
@ -0,0 +1,35 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class DateUtilsService {
|
||||
|
||||
constructor() { }
|
||||
|
||||
timeToDisplayDate(time: string): string{
|
||||
return this.timeToDate(time).toLocaleDateString();
|
||||
}
|
||||
|
||||
timeToDate(time: string): Date {
|
||||
let d: Date = new Date()
|
||||
d.setTime(Number(time))
|
||||
return d;
|
||||
}
|
||||
|
||||
dateToTime(date: Date): string {
|
||||
return String(date.getTime());
|
||||
}
|
||||
|
||||
dateStringToDate(date: string): Date {
|
||||
return new Date(date);
|
||||
}
|
||||
|
||||
dateStringToTime(date: string): string{
|
||||
return String(this.dateStringToDate(date).getTime());
|
||||
}
|
||||
|
||||
dateStringToDisplayDate(date: string): string{
|
||||
return this.timeToDisplayDate(this.dateStringToTime(date))
|
||||
}
|
||||
}
|
26
src/app/task-add/task-add.component.css
Normal file
26
src/app/task-add/task-add.component.css
Normal file
@ -0,0 +1,26 @@
|
||||
|
||||
|
||||
.add-task-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.add-task-container > * {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.add-task-container form {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.add-task-container form > * {
|
||||
margin: 0 0;
|
||||
}
|
||||
.mat-form-field {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.add-task-container .mat-radio-button {
|
||||
margin-left:12px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
53
src/app/task-add/task-add.component.html
Normal file
53
src/app/task-add/task-add.component.html
Normal file
@ -0,0 +1,53 @@
|
||||
<mat-card class="add-task-container">
|
||||
<form class="add-task-container" [formGroup]="form">
|
||||
<!-- STATE -->
|
||||
<div style="color: red" *ngIf="form.invalid && form.value.state == ''">
|
||||
<label >State*: </label>
|
||||
<mat-radio-group formControlName="state" required>
|
||||
<mat-radio-button value="{{state}}" *ngFor="let state of states">{{state}}</mat-radio-button>
|
||||
</mat-radio-group>
|
||||
</div>
|
||||
<div *ngIf="!form.invalid || form.value.state != ''">
|
||||
<label >State*: </label>
|
||||
<mat-radio-group formControlName="state" required>
|
||||
<mat-radio-button value="{{state}}" *ngFor="let state of states">{{state}}</mat-radio-button>
|
||||
</mat-radio-group>
|
||||
</div>
|
||||
<!-- NAME -->
|
||||
<mat-form-field
|
||||
[hideRequiredMarker]="options.value.hideRequired"
|
||||
[floatLabel]="options.value.floatLabel">
|
||||
<input matInput placeholder="Title" required formControlName="name">
|
||||
</mat-form-field>
|
||||
<!-- Description -->
|
||||
<mat-form-field
|
||||
[hideRequiredMarker]="options.value.hideRequired"
|
||||
[floatLabel]="options.value.floatLabel">
|
||||
<input matInput placeholder="Description" required formControlName="description">
|
||||
</mat-form-field>
|
||||
<!-- Date -->
|
||||
<mat-form-field
|
||||
[hideRequiredMarker]="options.value.hideRequired"
|
||||
[floatLabel]="options.value.floatLabel">
|
||||
<input matInput [matDatepicker]="myDatepicker" formControlName="date" placeholder="Date" >
|
||||
<mat-datepicker-toggle matSuffix [for]="myDatepicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #myDatepicker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
<!-- Buttons -->
|
||||
<mat-grid-list cols="2" rowHeight="2:1">
|
||||
<mat-grid-tile>
|
||||
<button mat-raised-button (click)="submit()" [disabled]="form.invalid && !submitted">
|
||||
<mat-icon aria-hidden="false" aria-label="Done Icon">done</mat-icon>
|
||||
<span>Save Task</span>
|
||||
</button>
|
||||
</mat-grid-tile>
|
||||
<mat-grid-tile>
|
||||
<button mat-raised-button routerLink="/">
|
||||
<mat-icon aria-hidden="false" aria-label="Cancel Icon">close</mat-icon>
|
||||
<span>Cancel</span>
|
||||
</button>
|
||||
</mat-grid-tile>
|
||||
</mat-grid-list>
|
||||
</form>
|
||||
</mat-card>
|
||||
|
25
src/app/task-add/task-add.component.spec.ts
Normal file
25
src/app/task-add/task-add.component.spec.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { TaskAddComponent } from './task-add.component';
|
||||
|
||||
describe('TaskAddComponent', () => {
|
||||
let component: TaskAddComponent;
|
||||
let fixture: ComponentFixture<TaskAddComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ TaskAddComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(TaskAddComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
41
src/app/task-add/task-add.component.ts
Normal file
41
src/app/task-add/task-add.component.ts
Normal file
@ -0,0 +1,41 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import {FormBuilder, FormControl, FormGroup, Validators} from "@angular/forms";
|
||||
import {MatSnackBar} from "@angular/material/snack-bar";
|
||||
import {TaskService} from "../task.service";
|
||||
import {Router} from "@angular/router";
|
||||
|
||||
@Component({
|
||||
selector: 'app-task-add',
|
||||
templateUrl: './task-add.component.html',
|
||||
styleUrls: ['./task-add.component.css']
|
||||
})
|
||||
export class TaskAddComponent implements OnInit {
|
||||
public options: FormGroup;
|
||||
|
||||
constructor(fb: FormBuilder, private snackBar: MatSnackBar, private ts: TaskService, private router: Router) {
|
||||
this.options = fb.group({
|
||||
hideRequired: false,
|
||||
floatLabel: 'auto'
|
||||
})
|
||||
}
|
||||
|
||||
form = new FormGroup({
|
||||
name: new FormControl('', Validators.required),
|
||||
description: new FormControl('', Validators.required),
|
||||
state: new FormControl('', Validators.required),
|
||||
date: new FormControl((new Date()).toISOString(), Validators.required,)
|
||||
});
|
||||
|
||||
states = ["DONE", "DOING", "TODO"]
|
||||
submitted = false;
|
||||
submit(){
|
||||
this.submitted = true;
|
||||
if (!this.form.invalid) {
|
||||
this.ts.addTask(this.form.value.name, this.form.value.state, this.form.value.description, (new Date(this.form.value.date)).getTime().toString()).then(() => this.router.navigate(['/']))
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
}
|
0
src/app/task-edit/task-edit.component.css
Normal file
0
src/app/task-edit/task-edit.component.css
Normal file
18
src/app/task-edit/task-edit.component.html
Normal file
18
src/app/task-edit/task-edit.component.html
Normal file
@ -0,0 +1,18 @@
|
||||
<h1 mat-dialog-title>Edit {{data.name}}</h1>
|
||||
<div mat-dialog-content>
|
||||
<mat-form-field>
|
||||
<input matInput [(ngModel)]="data.name">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<textarea matInput [(ngModel)]="data.description" > </textarea>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput [matDatepicker]="myDatepicker" [(ngModel)]="data.date">
|
||||
<mat-datepicker-toggle matSuffix [for]="myDatepicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #myDatepicker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div mat-dialog-actions>
|
||||
<button mat-button (click)="onNoClick()">No Thanks</button>
|
||||
<button mat-button [mat-dialog-close]="data" cdkFocusInitial>Ok</button>
|
||||
</div>
|
25
src/app/task-edit/task-edit.component.spec.ts
Normal file
25
src/app/task-edit/task-edit.component.spec.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { TaskEditComponent } from './task-edit.component';
|
||||
|
||||
describe('TaskEditComponent', () => {
|
||||
let component: TaskEditComponent;
|
||||
let fixture: ComponentFixture<TaskEditComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ TaskEditComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(TaskEditComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
23
src/app/task-edit/task-edit.component.ts
Normal file
23
src/app/task-edit/task-edit.component.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import {Component, Inject, OnInit} from '@angular/core';
|
||||
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
|
||||
import {DateUtilsService} from "../date-utils.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-task-edit',
|
||||
templateUrl: './task-edit.component.html',
|
||||
})
|
||||
export class TaskEditComponent implements OnInit{
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<TaskEditComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
public ds: DateUtilsService) {
|
||||
}
|
||||
|
||||
onNoClick(): void {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.data.date = this.ds.dateStringToDate(this.data.date)
|
||||
}
|
||||
}
|
31
src/app/task-holder/task-holder.component.css
Normal file
31
src/app/task-holder/task-holder.component.css
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
.example-list {
|
||||
border: solid 1px #ccc;
|
||||
min-height: 60px;
|
||||
background: white;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
display: block;
|
||||
padding: 10px 50px 10px 50px;
|
||||
}
|
||||
|
||||
|
||||
.cdk-drag-preview {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.cdk-drag-placeholder {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.cdk-drag-animating {
|
||||
transition: transform 600ms cubic-bezier(0, 0, 0.2, 1);
|
||||
}
|
||||
|
||||
.example-box:last-child {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.example-list.cdk-drop-list-dragging .example-box:not(.cdk-drag-placeholder) {
|
||||
transition: transform 600ms cubic-bezier(0, 0, 0.2, 1);
|
||||
}
|
56
src/app/task-holder/task-holder.component.html
Normal file
56
src/app/task-holder/task-holder.component.html
Normal file
@ -0,0 +1,56 @@
|
||||
<div class="card-container">
|
||||
<button class="card card-small" tabindex="0" routerLink="/add">
|
||||
<mat-icon aria-hidden="false" aria-label="Example home icon">add</mat-icon>
|
||||
<span>Add Task</span>
|
||||
</button>
|
||||
<button class="card card-small" tabindex="0" (click)="demoData()">
|
||||
<mat-icon aria-hidden="false" aria-label="Example home icon">shuffle</mat-icon>
|
||||
<span>Add Random Demo Data</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>done</th>
|
||||
<th>doing</th>
|
||||
<th>todo</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div cdkDropList
|
||||
#doneList="cdkDropList"
|
||||
[cdkDropListData]="done"
|
||||
[cdkDropListConnectedTo]="[todoList, doingList]"
|
||||
class="example-list"
|
||||
(cdkDropListDropped)="drop($event)">
|
||||
<pre *ngFor="let task of done" cdkDrag>
|
||||
<app-task (deleteTask)="deleteTask($event, 'done')" [task]="task"></app-task>
|
||||
</pre>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div cdkDropList
|
||||
#doingList="cdkDropList"
|
||||
[cdkDropListData]="doing"
|
||||
[cdkDropListConnectedTo]="[doneList, todoList]"
|
||||
class="example-list"
|
||||
(cdkDropListDropped)="drop($event)">
|
||||
<pre *ngFor="let task of doing" cdkDrag>
|
||||
<app-task (deleteTask)="deleteTask($event, 'doing')" [task]="task"></app-task>
|
||||
</pre>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div cdkDropList
|
||||
#todoList="cdkDropList"
|
||||
[cdkDropListData]="todo"
|
||||
[cdkDropListConnectedTo]="[doneList, doingList]"
|
||||
class="example-list"
|
||||
(cdkDropListDropped)="drop($event)">
|
||||
<pre *ngFor="let task of todo" cdkDrag>
|
||||
<app-task (deleteTask)="deleteTask($event, 'todo')" [task]="task"></app-task>
|
||||
</pre>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
25
src/app/task-holder/task-holder.component.spec.ts
Normal file
25
src/app/task-holder/task-holder.component.spec.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { TaskHolderComponent } from './task-holder.component';
|
||||
|
||||
describe('TaskHolderComponent', () => {
|
||||
let component: TaskHolderComponent;
|
||||
let fixture: ComponentFixture<TaskHolderComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ TaskHolderComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(TaskHolderComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
139
src/app/task-holder/task-holder.component.ts
Normal file
139
src/app/task-holder/task-holder.component.ts
Normal file
@ -0,0 +1,139 @@
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {TaskService} from "../task.service";
|
||||
import {Task} from "../task.model";
|
||||
import {CdkDragDrop, CdkDropList, moveItemInArray, transferArrayItem} from "@angular/cdk/drag-drop";
|
||||
|
||||
@Component({
|
||||
selector: 'app-task-holder',
|
||||
templateUrl: './task-holder.component.html',
|
||||
styleUrls: ['./task-holder.component.css']
|
||||
})
|
||||
export class TaskHolderComponent implements OnInit{
|
||||
done: any = [];
|
||||
doing: any = [];
|
||||
todo: any = [];
|
||||
|
||||
constructor(private ts: TaskService) {}
|
||||
|
||||
ngOnInit():void{
|
||||
this.getData()
|
||||
}
|
||||
|
||||
demoData(){
|
||||
this.ts.generateDemoData().then(() => this.getData()).catch(err => alert(err));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Current item ordering will be saved. This is done by rearranging the ids. First index will get the lowest id and the last index the highest id
|
||||
* Example: [{id: 11, name: 1}, {id: 2, name: 2}, {id: 13, name: 3}] --> [{id: 2, name: 1}, {id: 11, name: 2}, {id: 13, name: 3}]
|
||||
*
|
||||
* When ordering is finished, data will be saved to DB and data will be refreshed
|
||||
* @param container Current Container to doOrdering
|
||||
*/
|
||||
doOrdering(container: CdkDropList<[]>){
|
||||
let result1 = [] as Task[];
|
||||
(result1 as Task[]) = container.data;
|
||||
let ids: number[] = [];
|
||||
result1.forEach(r => {
|
||||
|
||||
ids.push(parseInt(r.id))
|
||||
|
||||
})
|
||||
ids.sort(function(a, b) {
|
||||
return a - b;
|
||||
});
|
||||
let count = 0;
|
||||
result1.forEach(r => {
|
||||
r.id = ids[count] + "";
|
||||
count++;
|
||||
});
|
||||
// Change state enum after list change
|
||||
// 0 = done
|
||||
// 1 = doing
|
||||
// 2 = todo
|
||||
if (container.id == "cdk-drop-list-0") {
|
||||
this.done = result1 as [];
|
||||
} else if (container.id == "cdk-drop-list-1") {
|
||||
this.doing = result1 as [];
|
||||
} else if (container.id == "cdk-drop-list-2") {
|
||||
this.todo = result1 as [];
|
||||
}
|
||||
result1.forEach(r1 => {
|
||||
const newDate = new Date(r1.date);
|
||||
this.ts.editTask(r1.id, r1.name, r1.state, r1.description, newDate.getTime().toString()).catch(err => alert(err)).then(() => this.getData());
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Transferring item state from DONE, DOING and to do
|
||||
* When transferring is finished, items will be ordered by doOrdering and also be saved to DB
|
||||
* @param event Current drag and drop event
|
||||
*/
|
||||
doTransfer(event: CdkDragDrop<[]>){
|
||||
// Change state enum after list change
|
||||
// 0 = done
|
||||
// 1 = doing
|
||||
// 2 = todo
|
||||
let result = {} as Task;
|
||||
if (event.container.id == "cdk-drop-list-0") {
|
||||
(result as Task) = event.container.data[event.currentIndex];
|
||||
result.state = "DONE"
|
||||
this.done[event.currentIndex] = (result as never);
|
||||
} else if (event.container.id == "cdk-drop-list-1") {
|
||||
(result as Task) = event.container.data[event.currentIndex];
|
||||
result.state = "DOING"
|
||||
this.doing[event.currentIndex] = (result as never);
|
||||
} else if (event.container.id == "cdk-drop-list-2") {
|
||||
(result as Task) = event.container.data[event.currentIndex];
|
||||
result.state = "TODO"
|
||||
this.todo[event.currentIndex] = (result as never);
|
||||
}
|
||||
const newDate = new Date(result.date);
|
||||
this.ts.editTask(result.id, result.name, result.state, result.description, newDate.getTime().toString()).catch(err => alert(err)).then(() => this.doOrdering(event.container));
|
||||
|
||||
}
|
||||
|
||||
drop(event: CdkDragDrop<[]>) {
|
||||
if (event.previousContainer === event.container) {
|
||||
moveItemInArray(event.container.data, event.previousIndex, event.currentIndex);
|
||||
this.doOrdering(event.container)
|
||||
} else {
|
||||
transferArrayItem(event.previousContainer.data,
|
||||
event.container.data,
|
||||
event.previousIndex,
|
||||
event.currentIndex);
|
||||
this.doTransfer(event);
|
||||
}
|
||||
}
|
||||
|
||||
getData(){
|
||||
this.ts.filteredTodos("done").then(res => {
|
||||
this.done = res.data;
|
||||
}).catch(err => console.error(err))
|
||||
this.ts.filteredTodos("doing").then(res => {
|
||||
this.doing = res.data;
|
||||
}).catch(err => console.error(err))
|
||||
this.ts.filteredTodos("todo").then(res => {
|
||||
this.todo = res.data;
|
||||
}).catch(err => console.error(err))
|
||||
}
|
||||
|
||||
deleteTask(id: string, list: string) {
|
||||
switch (list) {
|
||||
case "todo":
|
||||
this.todo = this.filterDelete(this.todo, id)
|
||||
break
|
||||
case "doing":
|
||||
this.doing = this.filterDelete(this.doing, id)
|
||||
break
|
||||
case "done":
|
||||
this.done = this.filterDelete(this.done, id)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
filterDelete(list: any, id: string): any{
|
||||
return list.filter((i: any) => i.id != id)
|
||||
}
|
||||
}
|
7
src/app/task.model.spec.ts
Normal file
7
src/app/task.model.spec.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import { Task } from './task.model';
|
||||
|
||||
describe('Task', () => {
|
||||
it('should create an instance', () => {
|
||||
expect(new Task("", "", "", "", "2")).toBeTruthy();
|
||||
});
|
||||
});
|
52
src/app/task.model.ts
Normal file
52
src/app/task.model.ts
Normal file
@ -0,0 +1,52 @@
|
||||
export class Task {
|
||||
public name: string;
|
||||
public description: string;
|
||||
public date: any;
|
||||
public state: string;
|
||||
public id: string
|
||||
|
||||
|
||||
constructor(name: string, description: string, date: any, state: string, id: string = "0") {
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.date = date
|
||||
this.state = state;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
get getName(): string {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
set setName(value: string) {
|
||||
this.name = value;
|
||||
}
|
||||
|
||||
set setDescription(value: string) {
|
||||
this.description = value;
|
||||
}
|
||||
|
||||
get getDate(): string {
|
||||
return this.date;
|
||||
}
|
||||
|
||||
set setDate(value: string) {
|
||||
this.date = value;
|
||||
}
|
||||
|
||||
get getState(): string {
|
||||
return this.state;
|
||||
}
|
||||
|
||||
set setState(value: string) {
|
||||
this.state = value;
|
||||
}
|
||||
|
||||
get getId(): string {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
set setId(value: string) {
|
||||
this.id = value;
|
||||
}
|
||||
}
|
16
src/app/task.service.spec.ts
Normal file
16
src/app/task.service.spec.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { TaskService } from './task.service';
|
||||
|
||||
describe('TaskService', () => {
|
||||
let service: TaskService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(TaskService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
42
src/app/task.service.ts
Normal file
42
src/app/task.service.ts
Normal file
@ -0,0 +1,42 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import axios from "axios";
|
||||
import { environment } from '../environments/environment';
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class TaskService {
|
||||
private baseUrl = `${environment.url}`;
|
||||
|
||||
constructor() {}
|
||||
|
||||
filteredTodos(state: string): Promise<any> {
|
||||
return axios.get(`${this.baseUrl}/todos?state=${state}`)
|
||||
}
|
||||
|
||||
todos(): Promise<any> {
|
||||
return axios.get(`${this.baseUrl}/todos`)
|
||||
}
|
||||
|
||||
task(id: number | string): Promise<any> {
|
||||
return axios.get(`${this.baseUrl}/todo/${id}`)
|
||||
}
|
||||
|
||||
addTask(name: string, state: string, description: string, date: string){
|
||||
return axios.post(`${this.baseUrl}/todo?name=${encodeURI(name)}&description=${encodeURI(description)}&date=${encodeURI(date)}&state=${state}`)
|
||||
}
|
||||
|
||||
editTask(id: string, name: string, state: string, description: string, date: string){
|
||||
return axios.put(`${this.baseUrl}/todo/${id}?name=${encodeURI(name)}&description=${encodeURI(description)}&date=${encodeURI(date)}&state=${state}`)
|
||||
}
|
||||
|
||||
deleteTask(id:string){
|
||||
return axios.delete(`${this.baseUrl}/todo/${id}`)
|
||||
}
|
||||
|
||||
|
||||
generateDemoData(){
|
||||
return axios.post(`${this.baseUrl}/test`)
|
||||
}
|
||||
}
|
21
src/app/task/task.component.css
Normal file
21
src/app/task/task.component.css
Normal file
@ -0,0 +1,21 @@
|
||||
.edit-btn {
|
||||
background-color: #1976d2;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.task {
|
||||
width: 20em;
|
||||
margin: 0;
|
||||
background-color: #333333;
|
||||
}
|
||||
.task .title {
|
||||
color: white;
|
||||
}
|
||||
.task .sub{
|
||||
color: whitesmoke;
|
||||
}
|
||||
|
||||
.task .content {
|
||||
margin: 12px;
|
||||
color: white;
|
||||
}
|
16
src/app/task/task.component.html
Normal file
16
src/app/task/task.component.html
Normal file
@ -0,0 +1,16 @@
|
||||
<mat-card class="task">
|
||||
<mat-card-header class="header">
|
||||
<mat-card-title class="title">{{this.taskObj.name}}</mat-card-title>
|
||||
<mat-card-subtitle class="sub">{{this.date}}</mat-card-subtitle>
|
||||
</mat-card-header>
|
||||
<hr>
|
||||
<mat-card-content class="content">
|
||||
<p>
|
||||
{{this.taskObj.description}}
|
||||
</p>
|
||||
</mat-card-content>
|
||||
<mat-card-actions>
|
||||
<button (click)="delete(this.taskObj.id)" mat-mini-fab class="edit-btn"><mat-icon>delete</mat-icon></button>
|
||||
<button (click)="openDialog()" mat-mini-fab class="edit-btn"><mat-icon>edit</mat-icon></button>
|
||||
</mat-card-actions>
|
||||
</mat-card>
|
25
src/app/task/task.component.spec.ts
Normal file
25
src/app/task/task.component.spec.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { TaskComponent } from './task.component';
|
||||
|
||||
describe('TaskComponent', () => {
|
||||
let component: TaskComponent;
|
||||
let fixture: ComponentFixture<TaskComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ TaskComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(TaskComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
45
src/app/task/task.component.ts
Normal file
45
src/app/task/task.component.ts
Normal file
@ -0,0 +1,45 @@
|
||||
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
||||
import {Task} from "../task.model";
|
||||
import {MatDialog} from "@angular/material/dialog";
|
||||
import {TaskEditComponent} from "../task-edit/task-edit.component";
|
||||
import {DateUtilsService} from "../date-utils.service";
|
||||
import {TaskService} from "../task.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-task',
|
||||
templateUrl: './task.component.html',
|
||||
styleUrls: ['./task.component.css']
|
||||
})
|
||||
export class TaskComponent implements OnInit {
|
||||
@Input() task: any
|
||||
@Output() deleteTask = new EventEmitter<string>();
|
||||
public taskObj: Task = new Task("", "", "", "", "");
|
||||
public date: string = ""
|
||||
|
||||
ngOnInit(): void {
|
||||
this.taskObj = new Task(this.task["name"], this.task["description"], this.task["date"], this.task["state"], this.task["id"])
|
||||
this.date = this.ds.dateStringToDisplayDate(this.task["date"])
|
||||
}
|
||||
constructor(public dialog: MatDialog, public ds: DateUtilsService, public ts: TaskService) {}
|
||||
|
||||
delete(id: string): void{
|
||||
this.ts.deleteTask(id).then(() => this.deleteTask.emit(id))
|
||||
|
||||
}
|
||||
openDialog(): void {
|
||||
const dialogRef = this.dialog.open(TaskEditComponent, {
|
||||
data: this.taskObj
|
||||
});
|
||||
|
||||
dialogRef.beforeClosed().subscribe(() => {
|
||||
this.date = this.ds.dateStringToDisplayDate(this.taskObj.date)
|
||||
this.ts.editTask(this.taskObj.id, this.taskObj.name, this.taskObj.state, this.taskObj.description, this.ds.dateToTime(this.taskObj.date)).catch(er => alert("Edit Task error: " + er)).then(() => {
|
||||
|
||||
window.location.reload();
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
0
src/assets/.gitkeep
Normal file
0
src/assets/.gitkeep
Normal file
4
src/environments/environment.prod.ts.example
Normal file
4
src/environments/environment.prod.ts.example
Normal file
@ -0,0 +1,4 @@
|
||||
export const environment = {
|
||||
production: true,
|
||||
url: 'https://<DOMAIN>'
|
||||
};
|
4
src/environments/environment.ts.example
Normal file
4
src/environments/environment.ts.example
Normal file
@ -0,0 +1,4 @@
|
||||
export const environment = {
|
||||
production: false,
|
||||
url: 'https://<DOMAIN>'
|
||||
};
|
BIN
src/favicon.ico
Normal file
BIN
src/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 948 B |
16
src/index.html
Normal file
16
src/index.html
Normal file
@ -0,0 +1,16 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>TodoFrontend</title>
|
||||
<base href="/">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||
</head>
|
||||
<body class="mat-typography">
|
||||
<app-root></app-root>
|
||||
</body>
|
||||
</html>
|
12
src/main.ts
Normal file
12
src/main.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { enableProdMode } from '@angular/core';
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
|
||||
import { AppModule } from './app/app.module';
|
||||
import { environment } from './environments/environment';
|
||||
|
||||
if (environment.production) {
|
||||
enableProdMode();
|
||||
}
|
||||
|
||||
platformBrowserDynamic().bootstrapModule(AppModule)
|
||||
.catch(err => console.error(err));
|
53
src/polyfills.ts
Normal file
53
src/polyfills.ts
Normal file
@ -0,0 +1,53 @@
|
||||
/**
|
||||
* This file includes polyfills needed by Angular and is loaded before the app.
|
||||
* You can add your own extra polyfills to this file.
|
||||
*
|
||||
* This file is divided into 2 sections:
|
||||
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
|
||||
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
|
||||
* file.
|
||||
*
|
||||
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
||||
* automatically update themselves. This includes recent versions of Safari, Chrome (including
|
||||
* Opera), Edge on the desktop, and iOS and Chrome on mobile.
|
||||
*
|
||||
* Learn more in https://angular.io/guide/browser-support
|
||||
*/
|
||||
|
||||
/***************************************************************************************************
|
||||
* BROWSER POLYFILLS
|
||||
*/
|
||||
|
||||
/**
|
||||
* By default, zone.js will patch all possible macroTask and DomEvents
|
||||
* user can disable parts of macroTask/DomEvents patch by setting following flags
|
||||
* because those flags need to be set before `zone.js` being loaded, and webpack
|
||||
* will put import in the top of bundle, so user need to create a separate file
|
||||
* in this directory (for example: zone-flags.ts), and put the following flags
|
||||
* into that file, and then add the following code before importing zone.js.
|
||||
* import './zone-flags';
|
||||
*
|
||||
* The flags allowed in zone-flags.ts are listed here.
|
||||
*
|
||||
* The following flags will work for all browsers.
|
||||
*
|
||||
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
|
||||
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
|
||||
* (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
|
||||
*
|
||||
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
|
||||
* with the following flag, it will bypass `zone.js` patch for IE/Edge
|
||||
*
|
||||
* (window as any).__Zone_enable_cross_context_check = true;
|
||||
*
|
||||
*/
|
||||
|
||||
/***************************************************************************************************
|
||||
* Zone JS is required by default for Angular itself.
|
||||
*/
|
||||
import 'zone.js'; // Included with Angular CLI.
|
||||
|
||||
|
||||
/***************************************************************************************************
|
||||
* APPLICATION IMPORTS
|
||||
*/
|
300
src/styles.css
Normal file
300
src/styles.css
Normal file
@ -0,0 +1,300 @@
|
||||
html, body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif;
|
||||
}
|
||||
|
||||
:host {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
box-sizing: border-box;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
margin: 8px 0;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.spacer {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 60px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: #1976d2;
|
||||
color: white;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.toolbar img {
|
||||
margin: 0 16px;
|
||||
}
|
||||
|
||||
.toolbar #twitter-logo {
|
||||
height: 40px;
|
||||
margin: 0 8px;
|
||||
}
|
||||
|
||||
.toolbar #youtube-logo {
|
||||
height: 40px;
|
||||
margin: 0 16px;
|
||||
}
|
||||
|
||||
.toolbar #twitter-logo:hover,
|
||||
.toolbar #youtube-logo:hover {
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.content {
|
||||
display: flex;
|
||||
margin: 82px auto 32px;
|
||||
padding: 0 16px;
|
||||
max-width: 960px;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
svg.material-icons {
|
||||
height: 24px;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
svg.material-icons:not(:last-child) {
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.card svg.material-icons path {
|
||||
fill: #888;
|
||||
}
|
||||
|
||||
.card-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.card {
|
||||
all: unset;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #eee;
|
||||
background-color: #fafafa;
|
||||
height: 40px;
|
||||
width: 200px;
|
||||
margin: 0 8px 16px;
|
||||
padding: 16px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
transition: all 0.2s ease-in-out;
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
.card-container .card:not(:last-child) {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.card.card-small {
|
||||
height: 16px;
|
||||
width: 168px;
|
||||
}
|
||||
|
||||
.card-container .card:not(.highlight-card) {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.card-container .card:not(.highlight-card):hover {
|
||||
transform: translateY(-3px);
|
||||
box-shadow: 0 4px 17px rgba(0, 0, 0, 0.35);
|
||||
}
|
||||
|
||||
.card-container .card:not(.highlight-card):hover .material-icons path {
|
||||
fill: rgb(105, 103, 103);
|
||||
}
|
||||
|
||||
.card.highlight-card {
|
||||
background-color: #1976d2;
|
||||
color: white;
|
||||
font-weight: 600;
|
||||
border: none;
|
||||
width: auto;
|
||||
min-width: 30%;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.card.card.highlight-card span {
|
||||
margin-left: 60px;
|
||||
}
|
||||
|
||||
svg#rocket {
|
||||
width: 80px;
|
||||
position: absolute;
|
||||
left: -10px;
|
||||
top: -24px;
|
||||
}
|
||||
|
||||
svg#rocket-smoke {
|
||||
height: calc(100vh - 95px);
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 180px;
|
||||
z-index: -10;
|
||||
}
|
||||
|
||||
a,
|
||||
a:visited,
|
||||
a:hover {
|
||||
color: #1976d2;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #125699;
|
||||
}
|
||||
|
||||
.terminal {
|
||||
position: relative;
|
||||
width: 80%;
|
||||
max-width: 600px;
|
||||
border-radius: 6px;
|
||||
padding-top: 45px;
|
||||
margin-top: 8px;
|
||||
overflow: hidden;
|
||||
background-color: rgb(15, 15, 16);
|
||||
}
|
||||
|
||||
.terminal::before {
|
||||
content: "\2022 \2022 \2022";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 4px;
|
||||
background: rgb(58, 58, 58);
|
||||
color: #c2c3c4;
|
||||
width: 100%;
|
||||
font-size: 2rem;
|
||||
line-height: 0;
|
||||
padding: 14px 0;
|
||||
text-indent: 4px;
|
||||
}
|
||||
|
||||
.terminal pre {
|
||||
font-family: SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;
|
||||
color: white;
|
||||
padding: 0 1rem 1rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.circle-link {
|
||||
height: 40px;
|
||||
width: 40px;
|
||||
border-radius: 40px;
|
||||
margin: 8px;
|
||||
background-color: white;
|
||||
border: 1px solid #eeeeee;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
|
||||
transition: 1s ease-out;
|
||||
}
|
||||
|
||||
.circle-link:hover {
|
||||
transform: translateY(-0.25rem);
|
||||
box-shadow: 0 3px 15px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
footer {
|
||||
margin-top: 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
footer a {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.github-star-badge {
|
||||
color: #24292e;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 12px;
|
||||
padding: 3px 10px;
|
||||
border: 1px solid rgba(27,31,35,.2);
|
||||
border-radius: 3px;
|
||||
background-image: linear-gradient(-180deg,#fafbfc,#eff3f6 90%);
|
||||
margin-left: 4px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.github-star-badge:hover {
|
||||
background-image: linear-gradient(-180deg,#f0f3f6,#e6ebf1 90%);
|
||||
border-color: rgba(27,31,35,.35);
|
||||
background-position: -.5em;
|
||||
}
|
||||
|
||||
.github-star-badge .material-icons {
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
svg#clouds {
|
||||
position: fixed;
|
||||
bottom: -160px;
|
||||
left: -230px;
|
||||
z-index: -10;
|
||||
width: 1920px;
|
||||
}
|
||||
|
||||
/* Responsive Styles */
|
||||
@media screen and (max-width: 767px) {
|
||||
.card-container > *:not(.circle-link) ,
|
||||
.terminal {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.card:not(.highlight-card) {
|
||||
height: 16px;
|
||||
margin: 8px 0;
|
||||
}
|
||||
|
||||
.card.highlight-card span {
|
||||
margin-left: 72px;
|
||||
}
|
||||
|
||||
svg#rocket-smoke {
|
||||
right: 120px;
|
||||
transform: rotate(-5deg);
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 575px) {
|
||||
svg#rocket-smoke {
|
||||
display: none;
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
26
src/test.ts
Normal file
26
src/test.ts
Normal file
@ -0,0 +1,26 @@
|
||||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||
|
||||
import 'zone.js/testing';
|
||||
import { getTestBed } from '@angular/core/testing';
|
||||
import {
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting
|
||||
} from '@angular/platform-browser-dynamic/testing';
|
||||
|
||||
declare const require: {
|
||||
context(path: string, deep?: boolean, filter?: RegExp): {
|
||||
<T>(id: string): T;
|
||||
keys(): string[];
|
||||
};
|
||||
};
|
||||
|
||||
// First, initialize the Angular testing environment.
|
||||
getTestBed().initTestEnvironment(
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting(),
|
||||
);
|
||||
|
||||
// Then we find all the tests.
|
||||
const context = require.context('./', true, /\.spec\.ts$/);
|
||||
// And load the modules.
|
||||
context.keys().map(context);
|
15
tsconfig.app.json
Normal file
15
tsconfig.app.json
Normal file
@ -0,0 +1,15 @@
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./out-tsc/app",
|
||||
"types": []
|
||||
},
|
||||
"files": [
|
||||
"src/main.ts",
|
||||
"src/polyfills.ts"
|
||||
],
|
||||
"include": [
|
||||
"src/**/*.d.ts"
|
||||
]
|
||||
}
|
32
tsconfig.json
Normal file
32
tsconfig.json
Normal file
@ -0,0 +1,32 @@
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"compileOnSave": false,
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"outDir": "./dist/out-tsc",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"noImplicitOverride": true,
|
||||
"noPropertyAccessFromIndexSignature": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"sourceMap": true,
|
||||
"declaration": false,
|
||||
"downlevelIteration": true,
|
||||
"experimentalDecorators": true,
|
||||
"moduleResolution": "node",
|
||||
"importHelpers": true,
|
||||
"target": "es2017",
|
||||
"module": "es2020",
|
||||
"lib": [
|
||||
"es2020",
|
||||
"dom"
|
||||
]
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"enableI18nLegacyMessageIdFormat": false,
|
||||
"strictInjectionParameters": true,
|
||||
"strictInputAccessModifiers": true,
|
||||
"strictTemplates": true
|
||||
}
|
||||
}
|
18
tsconfig.spec.json
Normal file
18
tsconfig.spec.json
Normal file
@ -0,0 +1,18 @@
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./out-tsc/spec",
|
||||
"types": [
|
||||
"jasmine"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"src/test.ts",
|
||||
"src/polyfills.ts"
|
||||
],
|
||||
"include": [
|
||||
"src/**/*.spec.ts",
|
||||
"src/**/*.d.ts"
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user