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

Atualização para o Angular v8 #3

Open
wants to merge 5 commits into
base: master
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
60 changes: 0 additions & 60 deletions .angular-cli.json

This file was deleted.

132 changes: 132 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"edge-completer": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"assets": [
"src/assets",
"src/favicon.ico"
],
"styles": [
"src/styles.css"
],
"scripts": []
},
"configurations": {
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "edge-completer:build"
},
"configurations": {
"production": {
"browserTarget": "edge-completer:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "edge-completer:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"scripts": [],
"styles": [
"src/styles.css"
],
"assets": [
"src/assets",
"src/favicon.ico"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"edge-completer-e2e": {
"root": "e2e",
"sourceRoot": "e2e",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "edge-completer:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"e2e/tsconfig.e2e.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "edge-completer",
"schematics": {
"@schematics/angular:component": {
"prefix": "app",
"styleext": "css"
},
"@schematics/angular:directive": {
"prefix": "app"
}
}
}
10 changes: 4 additions & 6 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,22 @@
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular/cli'],
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular/cli/plugins/karma')
require('@angular-devkit/build-angular/plugins/karma')
],
client:{
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
reports: [ 'html', 'lcovonly' ],
dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ],
fixWebpackSourcePaths: true
},
angularCli: {
environment: 'dev'
},

reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
Expand Down
3 changes: 2 additions & 1 deletion ng-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"$schema": "./node_modules/ng-packagr/ng-package.schema.json",
"lib": {
"entryFile": "public_api.ts"
}
},
"whitelistedNonPeerDependencies": ["."]
}
39 changes: 20 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "edge-completer",
"version": "1.0.1",
"version": "1.1.0",
"license": "MIT",
"scripts": {
"ng": "ng",
Expand All @@ -10,42 +10,43 @@
"lint": "ng lint",
"e2e": "ng e2e",
"packagr": "ng-packagr -p ng-package.json && cp -R src/assets dist/assets",
"packagr-win": "ng-packagr -p ng-package.json && xcopy /E src\\assets dist\\assets\\ && cd dist && rmdir /Q /S node_modules && npm pack"
"packagr-win": "ng-packagr -p ng-package.json && xcopy /E src\\assets dist\\assets\\ && cd dist && npm pack"
},
"private": false,
"dependencies": {
"@angular/animations": "^5.2.0",
"@angular/common": "^5.2.0",
"@angular/compiler": "^5.2.0",
"@angular/core": "^5.2.0",
"@angular/forms": "^5.2.0",
"@angular/http": "^5.2.0",
"@angular/platform-browser": "^5.2.0",
"@angular/platform-browser-dynamic": "^5.2.0",
"@angular/router": "^5.2.0",
"@angular/common": "^8.1.1",
"@angular/compiler": "^8.1.1",
"@angular/core": "^8.1.1",
"@angular/forms": "^8.1.1",
"@angular/http": "^7.2.15",
"@angular/platform-browser": "^8.1.1",
"@angular/platform-browser-dynamic": "^8.1.1",
"@angular/router": "^8.1.1",
"core-js": "^2.4.1",
"rxjs": "^5.5.6",
"zone.js": "^0.8.19"
"rxjs": "^6.5.2",
"tslib": "^1.9.0",
"zone.js": "^0.9.1"
},
"devDependencies": {
"@angular/cli": "1.6.7",
"@angular/compiler-cli": "^5.2.0",
"@angular/language-service": "^5.2.0",
"@angular-devkit/build-angular": "^0.801.1",
"@angular/cli": "^8.1.1",
"@angular/compiler-cli": "^8.1.1",
"@angular/language-service": "^8.1.1",
"@types/jasmine": "~2.8.3",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "^4.0.1",
"codelyzer": "^5.1.0",
"jasmine-core": "~2.8.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"ng-packagr": "^2.0.0",
"ng-packagr": "^5.3.0",
"protractor": "~5.1.2",
"ts-node": "~4.1.0",
"tslint": "~5.9.1",
"typescript": "~2.5.3"
"typescript": "~3.4.5"
}
}
21 changes: 6 additions & 15 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
<!--The content below is only a placeholder and can be replaced.-->
<div style="text-align:center">
<h1>
Welcome to {{ title }}!
Edge-completer demo
</h1>
<img width="300" alt="Angular Logo" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg==">
</div>
<h2>Here are some links to help you start: </h2>
<ul>
<li>
<h2><a target="_blank" rel="noopener" href="https://angular.io/tutorial">Tour of Heroes</a></h2>
</li>
<li>
<h2><a target="_blank" rel="noopener" href="https://github.com/angular/angular-cli/wiki">CLI Documentation</a></h2>
</li>
<li>
<h2><a target="_blank" rel="noopener" href="https://blog.angular.io/">Angular blog</a></h2>
</li>
</ul>

<edge-completer></edge-completer>
<edge-completer [datasource]="dataService" [minSearchLength]="0" [openOnFocus]="true"
[textSearching]="false" [textNoResults]="'Nenhum resultado encontrado'"
(selected)="onDropdownChange($event)"
[fieldTabindex]="0"
[pause]="0"></edge-completer>

16 changes: 16 additions & 0 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { Component } from '@angular/core';
import {CompleterItem} from './edge-completer/shared/completer-item';
import {CompleterData} from './edge-completer/shared/completer-data';
import {CompleterService} from './edge-completer/shared/completer-service';

@Component({
selector: 'app-root',
Expand All @@ -7,4 +10,17 @@ import { Component } from '@angular/core';
})
export class AppComponent {
title = 'app';

searchData = [{key: 'Item 1', value: 'valor do item 1'}, {key: 'Item 2', value: 'valor do item 2'}];

dataService: CompleterData;

constructor(private completerService: CompleterService) {
this.dataService = completerService.local(this.searchData, 'key', 'key');
}

onDropdownChange($event: CompleterItem) {
if ($event)
alert('Você selecionou ' + $event.originalObject.key);
}
}
7 changes: 3 additions & 4 deletions src/app/edge-completer/directives/ctr-input.directive.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { Directive, ElementRef, EventEmitter, Host, HostListener, Input, Output } from '@angular/core';
import { Subscription } from 'rxjs/Subscription';
import { Subscription , Observable } from 'rxjs';
import { NgModel } from '@angular/forms';
import { CtrCompleterDirective } from './ctr-completer.directive';
import { CompleterItem } from '../shared/completer-item';
import { isNil } from '../shared/globals';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/timer';
import { timer } from 'rxjs';



Expand Down Expand Up @@ -171,7 +170,7 @@ export class CtrInputDirective {
}

if (this.completer.isOpen) {
this.blurTimer = Observable.timer(200).subscribe(() => this.doBlur());
this.blurTimer = timer(200).subscribe(() => this.doBlur());
}
}

Expand Down
Loading