tigascorreia-input 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +13 -0
- package/README.md +28 -0
- package/angular.json +128 -0
- package/browserslist +12 -0
- package/index.ts +1 -0
- package/karma.conf.js +44 -0
- package/package.json +48 -0
- package/protractor.conf.js +30 -0
- package/src/app/app.component.css +36 -0
- package/src/app/app.component.html +55 -0
- package/src/app/app.component.spec.ts +49 -0
- package/src/app/app.component.ts +10 -0
- package/src/app/app.module.ts +24 -0
- package/src/app/lib/au-fa-input/_au-fa-input-default-theme.scss +17 -0
- package/src/app/lib/au-fa-input/_au-fa-input-red-theme.scss +11 -0
- package/src/app/lib/au-fa-input/au-fa-input.component.html +2 -0
- package/src/app/lib/au-fa-input/au-fa-input.component.scss +3 -0
- package/src/app/lib/au-fa-input/au-fa-input.component.spec.ts +25 -0
- package/src/app/lib/au-fa-input/au-fa-input.component.ts +39 -0
- package/src/app/lib/au-input.module.ts +14 -0
- package/src/app/lib/common/common.css +27 -0
- package/src/app/lib/common/input-ref.directive.spec.ts +8 -0
- package/src/app/lib/common/input-ref.directive.ts +20 -0
- package/src/assets/.gitkeep +0 -0
- package/src/environments/environment.prod.ts +3 -0
- package/src/environments/environment.ts +8 -0
- package/src/favicon.ico +0 -0
- package/src/index.html +34 -0
- package/src/main.ts +11 -0
- package/src/polyfills.ts +68 -0
- package/src/styles.css +1 -0
- package/src/test.ts +32 -0
- package/src/tsconfig.app.json +12 -0
- package/src/tsconfig.spec.json +19 -0
- package/src/typings.d.ts +5 -0
- package/tsconfig.json +21 -0
- package/tslint.json +116 -0
package/.editorconfig
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Editor configuration, see http://editorconfig.org
|
|
2
|
+
root = true
|
|
3
|
+
|
|
4
|
+
[*]
|
|
5
|
+
charset = utf-8
|
|
6
|
+
indent_style = space
|
|
7
|
+
indent_size = 2
|
|
8
|
+
insert_final_newline = true
|
|
9
|
+
trim_trailing_whitespace = true
|
|
10
|
+
|
|
11
|
+
[*.md]
|
|
12
|
+
max_line_length = off
|
|
13
|
+
trim_trailing_whitespace = false
|
package/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# AuSvgButton
|
|
2
|
+
|
|
3
|
+
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.0.1.
|
|
4
|
+
|
|
5
|
+
## Development server
|
|
6
|
+
|
|
7
|
+
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.
|
|
8
|
+
|
|
9
|
+
## Code scaffolding
|
|
10
|
+
|
|
11
|
+
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|module`.
|
|
12
|
+
|
|
13
|
+
## Build
|
|
14
|
+
|
|
15
|
+
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build.
|
|
16
|
+
|
|
17
|
+
## Running unit tests
|
|
18
|
+
|
|
19
|
+
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
20
|
+
|
|
21
|
+
## Running end-to-end tests
|
|
22
|
+
|
|
23
|
+
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
|
|
24
|
+
Before running the tests make sure you are serving the app via `ng serve`.
|
|
25
|
+
|
|
26
|
+
## Further help
|
|
27
|
+
|
|
28
|
+
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
|
package/angular.json
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
|
3
|
+
"version": 1,
|
|
4
|
+
"newProjectRoot": "projects",
|
|
5
|
+
"projects": {
|
|
6
|
+
"au-input": {
|
|
7
|
+
"root": "",
|
|
8
|
+
"sourceRoot": "src",
|
|
9
|
+
"projectType": "application",
|
|
10
|
+
"architect": {
|
|
11
|
+
"build": {
|
|
12
|
+
"builder": "@angular-devkit/build-angular:browser",
|
|
13
|
+
"options": {
|
|
14
|
+
"outputPath": "dist",
|
|
15
|
+
"index": "src/index.html",
|
|
16
|
+
"main": "src/main.ts",
|
|
17
|
+
"tsConfig": "src/tsconfig.app.json",
|
|
18
|
+
"polyfills": "src/polyfills.ts",
|
|
19
|
+
"assets": [
|
|
20
|
+
"src/assets",
|
|
21
|
+
"src/favicon.ico"
|
|
22
|
+
],
|
|
23
|
+
"styles": [
|
|
24
|
+
"src/styles.css"
|
|
25
|
+
],
|
|
26
|
+
"scripts": []
|
|
27
|
+
},
|
|
28
|
+
"configurations": {
|
|
29
|
+
"production": {
|
|
30
|
+
"optimization": true,
|
|
31
|
+
"outputHashing": "all",
|
|
32
|
+
"sourceMap": false,
|
|
33
|
+
"extractCss": true,
|
|
34
|
+
"namedChunks": false,
|
|
35
|
+
"aot": true,
|
|
36
|
+
"extractLicenses": true,
|
|
37
|
+
"vendorChunk": false,
|
|
38
|
+
"buildOptimizer": true,
|
|
39
|
+
"fileReplacements": [
|
|
40
|
+
{
|
|
41
|
+
"replace": "src/environments/environment.ts",
|
|
42
|
+
"with": "src/environments/environment.prod.ts"
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"serve": {
|
|
49
|
+
"builder": "@angular-devkit/build-angular:dev-server",
|
|
50
|
+
"options": {
|
|
51
|
+
"browserTarget": "au-input:build"
|
|
52
|
+
},
|
|
53
|
+
"configurations": {
|
|
54
|
+
"production": {
|
|
55
|
+
"browserTarget": "au-input:build:production"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"extract-i18n": {
|
|
60
|
+
"builder": "@angular-devkit/build-angular:extract-i18n",
|
|
61
|
+
"options": {
|
|
62
|
+
"browserTarget": "au-input:build"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"test": {
|
|
66
|
+
"builder": "@angular-devkit/build-angular:karma",
|
|
67
|
+
"options": {
|
|
68
|
+
"main": "src/test.ts",
|
|
69
|
+
"karmaConfig": "./karma.conf.js",
|
|
70
|
+
"polyfills": "src/polyfills.ts",
|
|
71
|
+
"tsConfig": "src/tsconfig.spec.json",
|
|
72
|
+
"scripts": [],
|
|
73
|
+
"styles": [
|
|
74
|
+
"src/styles.css"
|
|
75
|
+
],
|
|
76
|
+
"assets": [
|
|
77
|
+
"src/assets",
|
|
78
|
+
"src/favicon.ico"
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"lint": {
|
|
83
|
+
"builder": "@angular-devkit/build-angular:tslint",
|
|
84
|
+
"options": {
|
|
85
|
+
"tsConfig": [
|
|
86
|
+
"src/tsconfig.app.json",
|
|
87
|
+
"src/tsconfig.spec.json"
|
|
88
|
+
],
|
|
89
|
+
"exclude": []
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
"au-input-e2e": {
|
|
95
|
+
"root": "",
|
|
96
|
+
"sourceRoot": "",
|
|
97
|
+
"projectType": "application",
|
|
98
|
+
"architect": {
|
|
99
|
+
"e2e": {
|
|
100
|
+
"builder": "@angular-devkit/build-angular:protractor",
|
|
101
|
+
"options": {
|
|
102
|
+
"protractorConfig": "./protractor.conf.js",
|
|
103
|
+
"devServerTarget": "au-input:serve"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"lint": {
|
|
107
|
+
"builder": "@angular-devkit/build-angular:tslint",
|
|
108
|
+
"options": {
|
|
109
|
+
"tsConfig": [
|
|
110
|
+
"e2e/tsconfig.e2e.json"
|
|
111
|
+
],
|
|
112
|
+
"exclude": []
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"defaultProject": "au-input",
|
|
119
|
+
"schematics": {
|
|
120
|
+
"@schematics/angular:component": {
|
|
121
|
+
"prefix": "",
|
|
122
|
+
"styleext": "css"
|
|
123
|
+
},
|
|
124
|
+
"@schematics/angular:directive": {
|
|
125
|
+
"prefix": ""
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
package/browserslist
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
|
|
2
|
+
# For additional information regarding the format and rule options, please see:
|
|
3
|
+
# https://github.com/browserslist/browserslist#queries
|
|
4
|
+
|
|
5
|
+
# You can see what browsers were selected by your queries by running:
|
|
6
|
+
# npx browserslist
|
|
7
|
+
|
|
8
|
+
> 0.5%
|
|
9
|
+
last 2 versions
|
|
10
|
+
Firefox ESR
|
|
11
|
+
not dead
|
|
12
|
+
not IE 9-11 # For IE 9-11 support, remove 'not'.
|
package/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {AuInputModule} from "./src/app/lib/au-input.module";
|
package/karma.conf.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Karma configuration file, see link for more information
|
|
2
|
+
// https://karma-runner.github.io/0.13/config/configuration-file.html
|
|
3
|
+
|
|
4
|
+
module.exports = function (config) {
|
|
5
|
+
config.set({
|
|
6
|
+
basePath: '',
|
|
7
|
+
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
|
8
|
+
plugins: [
|
|
9
|
+
require('karma-jasmine'),
|
|
10
|
+
require('karma-chrome-launcher'),
|
|
11
|
+
require('karma-jasmine-html-reporter'),
|
|
12
|
+
require('karma-coverage-istanbul-reporter'),
|
|
13
|
+
require('@angular-devkit/build-angular/plugins/karma')
|
|
14
|
+
],
|
|
15
|
+
client:{
|
|
16
|
+
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
|
17
|
+
},
|
|
18
|
+
files: [
|
|
19
|
+
|
|
20
|
+
],
|
|
21
|
+
preprocessors: {
|
|
22
|
+
|
|
23
|
+
},
|
|
24
|
+
mime: {
|
|
25
|
+
'text/x-typescript': ['ts','tsx']
|
|
26
|
+
},
|
|
27
|
+
coverageIstanbulReporter: {
|
|
28
|
+
dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ],
|
|
29
|
+
fixWebpackSourcePaths: true
|
|
30
|
+
},
|
|
31
|
+
angularCli: {
|
|
32
|
+
environment: 'dev'
|
|
33
|
+
},
|
|
34
|
+
reporters: config.angularCli && config.angularCli.codeCoverage
|
|
35
|
+
? ['progress', 'coverage-istanbul']
|
|
36
|
+
: ['progress', 'kjhtml'],
|
|
37
|
+
port: 9876,
|
|
38
|
+
colors: true,
|
|
39
|
+
logLevel: config.LOG_INFO,
|
|
40
|
+
autoWatch: true,
|
|
41
|
+
browsers: ['Chrome'],
|
|
42
|
+
singleRun: false
|
|
43
|
+
});
|
|
44
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tigascorreia-input",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"ng": "ng",
|
|
7
|
+
"start": "ng serve",
|
|
8
|
+
"build": "ng build",
|
|
9
|
+
"test": "ng test",
|
|
10
|
+
"lint": "ng lint",
|
|
11
|
+
"e2e": "ng e2e"
|
|
12
|
+
},
|
|
13
|
+
"private": false,
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@angular/animations": "8.0.0",
|
|
16
|
+
"@angular/common": "8.0.0",
|
|
17
|
+
"@angular/compiler": "8.0.0",
|
|
18
|
+
"@angular/core": "8.0.0",
|
|
19
|
+
"@angular/forms": "8.0.0",
|
|
20
|
+
"@angular/platform-browser": "8.0.0",
|
|
21
|
+
"@angular/platform-browser-dynamic": "8.0.0",
|
|
22
|
+
"@angular/router": "8.0.0",
|
|
23
|
+
"core-js": "^2.4.1",
|
|
24
|
+
"rxjs": "6.5.2",
|
|
25
|
+
"zone.js": "~0.9.1"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@angular-devkit/build-angular": "~0.800.0",
|
|
29
|
+
"@angular/cli": "^8.0.1",
|
|
30
|
+
"@angular/compiler-cli": "8.0.0",
|
|
31
|
+
"@angular/language-service": "8.0.0",
|
|
32
|
+
"@types/jasmine": "~2.5.53",
|
|
33
|
+
"@types/jasminewd2": "~2.0.2",
|
|
34
|
+
"@types/node": "~6.0.60",
|
|
35
|
+
"codelyzer": "^5.0.1",
|
|
36
|
+
"jasmine-core": "~2.6.2",
|
|
37
|
+
"jasmine-spec-reporter": "~4.1.0",
|
|
38
|
+
"karma": "^4.1.0",
|
|
39
|
+
"karma-chrome-launcher": "~2.1.1",
|
|
40
|
+
"karma-cli": "~1.0.1",
|
|
41
|
+
"karma-coverage-istanbul-reporter": "^1.2.1",
|
|
42
|
+
"karma-jasmine": "~1.1.0",
|
|
43
|
+
"karma-jasmine-html-reporter": "^0.2.2",
|
|
44
|
+
"ts-node": "~3.2.0",
|
|
45
|
+
"tslint": "~5.7.0",
|
|
46
|
+
"typescript": "~3.4.5"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Protractor configuration file, see link for more information
|
|
2
|
+
// https://github.com/angular/protractor/blob/master/lib/config.ts
|
|
3
|
+
|
|
4
|
+
const { SpecReporter } = require('jasmine-spec-reporter');
|
|
5
|
+
|
|
6
|
+
exports.config = {
|
|
7
|
+
allScriptsTimeout: 11000,
|
|
8
|
+
specs: [
|
|
9
|
+
'./e2e/**/*.e2e-spec.ts'
|
|
10
|
+
],
|
|
11
|
+
capabilities: {
|
|
12
|
+
'browserName': 'chrome'
|
|
13
|
+
},
|
|
14
|
+
directConnect: true,
|
|
15
|
+
baseUrl: 'http://localhost:4200/',
|
|
16
|
+
framework: 'jasmine',
|
|
17
|
+
jasmineNodeOpts: {
|
|
18
|
+
showColors: true,
|
|
19
|
+
defaultTimeoutInterval: 30000,
|
|
20
|
+
print: function() {}
|
|
21
|
+
},
|
|
22
|
+
beforeLaunch: function() {
|
|
23
|
+
require('ts-node').register({
|
|
24
|
+
project: 'e2e/tsconfig.e2e.json'
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
onPrepare() {
|
|
28
|
+
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
|
|
29
|
+
}
|
|
30
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
.container {
|
|
3
|
+
margin: 0 auto;
|
|
4
|
+
max-width: 300px;
|
|
5
|
+
padding-top:65px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
label {
|
|
9
|
+
width: 100px;
|
|
10
|
+
text-align: right;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.form-row {
|
|
14
|
+
width:500px;
|
|
15
|
+
margin-bottom: 10px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
input {
|
|
20
|
+
height: 25px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.normal-input {
|
|
24
|
+
width:150px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
h1 {
|
|
28
|
+
text-align: center;
|
|
29
|
+
margin-bottom: 30px;
|
|
30
|
+
margin-top: 50px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
au-fa-input {
|
|
34
|
+
height: 30px;
|
|
35
|
+
}
|
|
36
|
+
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<header class="l-header">
|
|
2
|
+
<ul class="top-menu disable-link-styles">
|
|
3
|
+
<li class="logo-small-container">
|
|
4
|
+
<a class="v-center-block-parent">
|
|
5
|
+
<img class="v-center-block logo-small angular-university-logo"
|
|
6
|
+
src="https://angular-academy.s3.amazonaws.com/main-logo/main-page-logo-small-hat.png"
|
|
7
|
+
data-pin-nopin="true">
|
|
8
|
+
</a>
|
|
9
|
+
</li>
|
|
10
|
+
<li>
|
|
11
|
+
<a>Inputs</a>
|
|
12
|
+
</li>
|
|
13
|
+
</ul>
|
|
14
|
+
</header>
|
|
15
|
+
|
|
16
|
+
<body>
|
|
17
|
+
<div class="container">
|
|
18
|
+
<h1>Font Awesome</h1>
|
|
19
|
+
|
|
20
|
+
<div class="form">
|
|
21
|
+
<div class="form-row ">
|
|
22
|
+
<label>Normal Input:</label>
|
|
23
|
+
<input class="normal-input" type="email" name="email" placeholder="E-mail">
|
|
24
|
+
</div>
|
|
25
|
+
<div class="form-row au-fa-input-red-theme">
|
|
26
|
+
<label>Email: </label>
|
|
27
|
+
<au-fa-input id="email-field" icon="envelope" placeholder="E-mail">
|
|
28
|
+
<input #input placeholder="E-mail" class="test-class">
|
|
29
|
+
</au-fa-input>
|
|
30
|
+
</div>
|
|
31
|
+
<div class="form-row">
|
|
32
|
+
<label>Password:</label>
|
|
33
|
+
<au-fa-input id="password-field" icon="lock" placeholder="Password">
|
|
34
|
+
<input #input placeholder="Password" type="password" class="test-class">
|
|
35
|
+
</au-fa-input>
|
|
36
|
+
</div>
|
|
37
|
+
<div class="form-row">
|
|
38
|
+
<label>Stripe:</label>
|
|
39
|
+
<au-fa-input id="stripe-field" icon="cc-stripe" placeholder="Stripe">
|
|
40
|
+
<input #input placeholder="Stripe">
|
|
41
|
+
</au-fa-input>
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<div class="form-row">
|
|
45
|
+
<label>Paypal:</label>
|
|
46
|
+
<au-fa-input id="paypal-field" icon="paypal" placeholder="Paypal">
|
|
47
|
+
<input #input placeholder="Paypal">
|
|
48
|
+
</au-fa-input>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
</body>
|
|
55
|
+
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { AppComponent } from './app.component';
|
|
4
|
+
import { AuFaInputComponent } from './lib/au-fa-input/au-fa-input.component';
|
|
5
|
+
import { InputRefDirective } from './lib/common/input-ref.directive';
|
|
6
|
+
import { DebugElement } from '@angular/core';
|
|
7
|
+
import { By } from '@angular/platform-browser';
|
|
8
|
+
|
|
9
|
+
describe('AppComponent', () => {
|
|
10
|
+
let component: AppComponent,
|
|
11
|
+
fixture: ComponentFixture<AppComponent>,
|
|
12
|
+
el: DebugElement,
|
|
13
|
+
emailField: DebugElement;
|
|
14
|
+
|
|
15
|
+
beforeEach(async(() => {
|
|
16
|
+
TestBed.configureTestingModule({
|
|
17
|
+
declarations: [
|
|
18
|
+
AppComponent, AuFaInputComponent, InputRefDirective
|
|
19
|
+
],
|
|
20
|
+
}).compileComponents();
|
|
21
|
+
}));
|
|
22
|
+
|
|
23
|
+
beforeEach(() => {
|
|
24
|
+
fixture = TestBed.createComponent(AppComponent);
|
|
25
|
+
component = fixture.debugElement.componentInstance;
|
|
26
|
+
el = fixture.debugElement;
|
|
27
|
+
emailField = el.query(By.css('#email-field'));
|
|
28
|
+
fixture.detectChanges();
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
it('should create the app', async(() => {
|
|
32
|
+
expect(component).toBeTruthy();
|
|
33
|
+
}));
|
|
34
|
+
|
|
35
|
+
it('should create a font awsome email input', async(() => {
|
|
36
|
+
const emailField = el.query(By.css('#email-field'));
|
|
37
|
+
|
|
38
|
+
expect(emailField).toBeTruthy();
|
|
39
|
+
}));
|
|
40
|
+
|
|
41
|
+
it('should inclue the correct email icon inside the email input', async(() => {
|
|
42
|
+
console.warn(emailField.nativeElement);
|
|
43
|
+
expect(emailField.query(By.css('i.icon.fa.fa-envelope'))).toBeTruthy();
|
|
44
|
+
}));
|
|
45
|
+
|
|
46
|
+
it('should have projected the correct test input inside the email field', async(() => {
|
|
47
|
+
expect(emailField.query(By.css('input.test-class')));
|
|
48
|
+
}));
|
|
49
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BrowserModule } from '@angular/platform-browser';
|
|
2
|
+
import { NgModule } from '@angular/core';
|
|
3
|
+
import { FormsModule } from '@angular/forms';
|
|
4
|
+
import { AppComponent } from './app.component';
|
|
5
|
+
|
|
6
|
+
import {HttpClientModule} from "@angular/common/http";
|
|
7
|
+
import { AuFaInputComponent } from './lib/au-fa-input/au-fa-input.component';
|
|
8
|
+
import { InputRefDirective } from './lib/common/input-ref.directive';
|
|
9
|
+
import { AuInputModule } from './lib/au-input.module';
|
|
10
|
+
|
|
11
|
+
@NgModule({
|
|
12
|
+
declarations: [
|
|
13
|
+
AppComponent,
|
|
14
|
+
],
|
|
15
|
+
imports: [
|
|
16
|
+
BrowserModule,
|
|
17
|
+
FormsModule,
|
|
18
|
+
HttpClientModule,
|
|
19
|
+
AuInputModule
|
|
20
|
+
],
|
|
21
|
+
providers: [],
|
|
22
|
+
bootstrap: [AppComponent]
|
|
23
|
+
})
|
|
24
|
+
export class AppModule { }
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
:host{
|
|
3
|
+
background: white;
|
|
4
|
+
border-color: lightgray;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
$border-color: dodgerblue;
|
|
8
|
+
|
|
9
|
+
:host-context{
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
&.input-focus{
|
|
13
|
+
border-color: $border-color;
|
|
14
|
+
-webkit-box-shadow: 0px 0px 5px $border-color;
|
|
15
|
+
box-shadow: 0px 0px 5px $border-color;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { AuFaInputComponent } from './au-fa-input.component';
|
|
4
|
+
|
|
5
|
+
describe('AuFaInputComponent', () => {
|
|
6
|
+
let component: AuFaInputComponent;
|
|
7
|
+
let fixture: ComponentFixture<AuFaInputComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async(() => {
|
|
10
|
+
TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ AuFaInputComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
fixture = TestBed.createComponent(AuFaInputComponent);
|
|
18
|
+
component = fixture.componentInstance;
|
|
19
|
+
fixture.detectChanges();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { AfterContentInit, Component, ContentChild, HostBinding, Input, OnInit, ViewEncapsulation } from '@angular/core';
|
|
2
|
+
import { InputRefDirective } from '../common/input-ref.directive';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'au-fa-input',
|
|
6
|
+
templateUrl: './au-fa-input.component.html',
|
|
7
|
+
styleUrls: ['./au-fa-input.component.scss']
|
|
8
|
+
})
|
|
9
|
+
export class AuFaInputComponent implements OnInit, AfterContentInit{
|
|
10
|
+
@Input()
|
|
11
|
+
icon: string;
|
|
12
|
+
|
|
13
|
+
@ContentChild(InputRefDirective, {static: false})
|
|
14
|
+
input: InputRefDirective;
|
|
15
|
+
|
|
16
|
+
constructor() { }
|
|
17
|
+
|
|
18
|
+
ngOnInit() {}
|
|
19
|
+
|
|
20
|
+
get classes() {
|
|
21
|
+
const cssClasses = {
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (this.icon) {
|
|
25
|
+
cssClasses[`fa-` + this.icon] = true
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return cssClasses;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
ngAfterContentInit(): void {
|
|
32
|
+
console.log(this.input);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@HostBinding('class.input-focus')
|
|
36
|
+
get isInputFocus() {
|
|
37
|
+
return this.input ? this.input.focus : false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NgModule } from "@angular/core";
|
|
2
|
+
import { AuFaInputComponent } from "./au-fa-input/au-fa-input.component";
|
|
3
|
+
import { InputRefDirective } from "./common/input-ref.directive";
|
|
4
|
+
import { CommonModule } from "@angular/common";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@NgModule({
|
|
8
|
+
imports: [CommonModule],
|
|
9
|
+
declarations: [AuFaInputComponent, InputRefDirective],
|
|
10
|
+
exports:[AuFaInputComponent, InputRefDirective]
|
|
11
|
+
})
|
|
12
|
+
export class AuInputModule{
|
|
13
|
+
|
|
14
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
.icon{
|
|
3
|
+
width: 20px;
|
|
4
|
+
text-align: center;
|
|
5
|
+
padding-left: 5px;
|
|
6
|
+
padding-right: 2px;
|
|
7
|
+
border: none;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
:host{
|
|
11
|
+
border-width: 1px;
|
|
12
|
+
border-style: solid;
|
|
13
|
+
padding: 1px 0;
|
|
14
|
+
display: inline-block;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
:host(.input-focus){
|
|
18
|
+
outline: none;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
:host ::ng-deep input{
|
|
22
|
+
border: none;
|
|
23
|
+
outline: none;
|
|
24
|
+
height: 100%;
|
|
25
|
+
margin: 1px 0;
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Directive, HostListener } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Directive({
|
|
4
|
+
selector: 'au-fa-input input',
|
|
5
|
+
})
|
|
6
|
+
export class InputRefDirective {
|
|
7
|
+
focus = false;
|
|
8
|
+
|
|
9
|
+
constructor() { }
|
|
10
|
+
|
|
11
|
+
@HostListener('focus')
|
|
12
|
+
onFocus(){
|
|
13
|
+
this.focus = true;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@HostListener('blur')
|
|
17
|
+
onBlur(){
|
|
18
|
+
this.focus = false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// The file contents for the current environment will overwrite these during build.
|
|
2
|
+
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
|
|
3
|
+
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
|
|
4
|
+
// The list of which env maps to which file can be found in `.angular-cli.json`.
|
|
5
|
+
|
|
6
|
+
export const environment = {
|
|
7
|
+
production: false
|
|
8
|
+
};
|
package/src/favicon.ico
ADDED
|
Binary file
|
package/src/index.html
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>Angular Advanced: The Angular Library Laboratory - Build Your Own Library </title>
|
|
6
|
+
<base href="/">
|
|
7
|
+
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
9
|
+
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
|
10
|
+
|
|
11
|
+
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
|
12
|
+
|
|
13
|
+
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
|
|
14
|
+
|
|
15
|
+
<link rel="stylesheet" href="https://angular-academy.s3.amazonaws.com/bundles/bundle.20170214122720.min.css" >
|
|
16
|
+
|
|
17
|
+
<style>
|
|
18
|
+
|
|
19
|
+
/*
|
|
20
|
+
.au-fa-input.override[css] {
|
|
21
|
+
display: block;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
</style>
|
|
27
|
+
|
|
28
|
+
</head>
|
|
29
|
+
<body>
|
|
30
|
+
|
|
31
|
+
<app-root>Loading...</app-root>
|
|
32
|
+
|
|
33
|
+
</body>
|
|
34
|
+
</html>
|
package/src/main.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { enableProdMode } from '@angular/core';
|
|
2
|
+
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
|
3
|
+
|
|
4
|
+
import { AppModule } from './app/app.module';
|
|
5
|
+
import { environment } from './environments/environment';
|
|
6
|
+
|
|
7
|
+
if (environment.production) {
|
|
8
|
+
enableProdMode();
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
platformBrowserDynamic().bootstrapModule(AppModule);
|
package/src/polyfills.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file includes polyfills needed by Angular and is loaded before the app.
|
|
3
|
+
* You can add your own extra polyfills to this file.
|
|
4
|
+
*
|
|
5
|
+
* This file is divided into 2 sections:
|
|
6
|
+
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
|
|
7
|
+
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
|
|
8
|
+
* file.
|
|
9
|
+
*
|
|
10
|
+
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
|
11
|
+
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
|
|
12
|
+
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
|
|
13
|
+
*
|
|
14
|
+
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/***************************************************************************************************
|
|
18
|
+
* BROWSER POLYFILLS
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
|
|
22
|
+
// import 'core-js/es6/symbol';
|
|
23
|
+
// import 'core-js/es6/object';
|
|
24
|
+
// import 'core-js/es6/function';
|
|
25
|
+
// import 'core-js/es6/parse-int';
|
|
26
|
+
// import 'core-js/es6/parse-float';
|
|
27
|
+
// import 'core-js/es6/number';
|
|
28
|
+
// import 'core-js/es6/math';
|
|
29
|
+
// import 'core-js/es6/string';
|
|
30
|
+
// import 'core-js/es6/date';
|
|
31
|
+
// import 'core-js/es6/array';
|
|
32
|
+
// import 'core-js/es6/regexp';
|
|
33
|
+
// import 'core-js/es6/map';
|
|
34
|
+
// import 'core-js/es6/set';
|
|
35
|
+
|
|
36
|
+
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
|
|
37
|
+
// import 'classlist.js'; // Run `npm install --save classlist.js`.
|
|
38
|
+
|
|
39
|
+
/** IE10 and IE11 requires the following to support `@angular/animation`. */
|
|
40
|
+
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
/** Evergreen browsers require these. **/
|
|
44
|
+
import 'core-js/es6/reflect';
|
|
45
|
+
import 'core-js/es7/reflect';
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
/** ALL Firefox browsers require the following to support `@angular/animation`. **/
|
|
49
|
+
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
/***************************************************************************************************
|
|
54
|
+
* Zone JS is required by Angular itself.
|
|
55
|
+
*/
|
|
56
|
+
import 'zone.js/dist/zone'; // Included with Angular CLI.
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
/***************************************************************************************************
|
|
61
|
+
* APPLICATION IMPORTS
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Date, currency, decimal and percent pipes.
|
|
66
|
+
* Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
|
|
67
|
+
*/
|
|
68
|
+
// import 'intl'; // Run `npm install --save intl`.
|
package/src/styles.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/* You can add global styles to this file, and also import other style files */
|
package/src/test.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
|
2
|
+
|
|
3
|
+
import 'zone.js/dist/long-stack-trace-zone';
|
|
4
|
+
import 'zone.js/dist/proxy.js';
|
|
5
|
+
import 'zone.js/dist/sync-test';
|
|
6
|
+
import 'zone.js/dist/jasmine-patch';
|
|
7
|
+
import 'zone.js/dist/async-test';
|
|
8
|
+
import 'zone.js/dist/fake-async-test';
|
|
9
|
+
import { getTestBed } from '@angular/core/testing';
|
|
10
|
+
import {
|
|
11
|
+
BrowserDynamicTestingModule,
|
|
12
|
+
platformBrowserDynamicTesting
|
|
13
|
+
} from '@angular/platform-browser-dynamic/testing';
|
|
14
|
+
|
|
15
|
+
// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
|
|
16
|
+
declare var __karma__: any;
|
|
17
|
+
declare var require: any;
|
|
18
|
+
|
|
19
|
+
// Prevent Karma from running prematurely.
|
|
20
|
+
__karma__.loaded = function () {};
|
|
21
|
+
|
|
22
|
+
// First, initialize the Angular testing environment.
|
|
23
|
+
getTestBed().initTestEnvironment(
|
|
24
|
+
BrowserDynamicTestingModule,
|
|
25
|
+
platformBrowserDynamicTesting()
|
|
26
|
+
);
|
|
27
|
+
// Then we find all the tests.
|
|
28
|
+
const context = require.context('./', true, /\.spec\.ts$/);
|
|
29
|
+
// And load the modules.
|
|
30
|
+
context.keys().map(context);
|
|
31
|
+
// Finally, start Karma to run the tests.
|
|
32
|
+
__karma__.start();
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "../out-tsc/spec",
|
|
5
|
+
"baseUrl": "",
|
|
6
|
+
"types": [
|
|
7
|
+
"jasmine",
|
|
8
|
+
"node"
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"test.ts",
|
|
13
|
+
"polyfills.ts"
|
|
14
|
+
],
|
|
15
|
+
"include": [
|
|
16
|
+
"**/*.spec.ts",
|
|
17
|
+
"**/*.d.ts"
|
|
18
|
+
]
|
|
19
|
+
}
|
package/src/typings.d.ts
ADDED
package/tsconfig.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compileOnSave": false,
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"outDir": "./dist/out-tsc",
|
|
6
|
+
"baseUrl": "src",
|
|
7
|
+
"sourceMap": true,
|
|
8
|
+
"declaration": false,
|
|
9
|
+
"moduleResolution": "node",
|
|
10
|
+
"emitDecoratorMetadata": true,
|
|
11
|
+
"experimentalDecorators": true,
|
|
12
|
+
"target": "es2015",
|
|
13
|
+
"typeRoots": [
|
|
14
|
+
"node_modules/@types"
|
|
15
|
+
],
|
|
16
|
+
"lib": [
|
|
17
|
+
"es2016",
|
|
18
|
+
"dom"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
}
|
package/tslint.json
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
{
|
|
2
|
+
"rulesDirectory": [
|
|
3
|
+
"node_modules/codelyzer"
|
|
4
|
+
],
|
|
5
|
+
"rules": {
|
|
6
|
+
"callable-types": true,
|
|
7
|
+
"class-name": true,
|
|
8
|
+
"comment-format": [
|
|
9
|
+
true,
|
|
10
|
+
"check-space"
|
|
11
|
+
],
|
|
12
|
+
"curly": true,
|
|
13
|
+
"eofline": true,
|
|
14
|
+
"forin": true,
|
|
15
|
+
"import-blacklist": [true],
|
|
16
|
+
"import-spacing": true,
|
|
17
|
+
"indent": [
|
|
18
|
+
true,
|
|
19
|
+
"spaces"
|
|
20
|
+
],
|
|
21
|
+
"interface-over-type-literal": true,
|
|
22
|
+
"label-position": true,
|
|
23
|
+
"max-line-length": [
|
|
24
|
+
true,
|
|
25
|
+
140
|
|
26
|
+
],
|
|
27
|
+
"member-access": false,
|
|
28
|
+
"member-ordering": [
|
|
29
|
+
true,
|
|
30
|
+
"static-before-instance",
|
|
31
|
+
"variables-before-functions"
|
|
32
|
+
],
|
|
33
|
+
"no-arg": true,
|
|
34
|
+
"no-bitwise": true,
|
|
35
|
+
"no-console": [
|
|
36
|
+
true,
|
|
37
|
+
"debug",
|
|
38
|
+
"info",
|
|
39
|
+
"time",
|
|
40
|
+
"timeEnd",
|
|
41
|
+
"trace"
|
|
42
|
+
],
|
|
43
|
+
"no-construct": true,
|
|
44
|
+
"no-debugger": true,
|
|
45
|
+
"no-duplicate-variable": true,
|
|
46
|
+
"no-empty": false,
|
|
47
|
+
"no-empty-interface": true,
|
|
48
|
+
"no-eval": true,
|
|
49
|
+
"no-inferrable-types": [true, "ignore-params"],
|
|
50
|
+
"no-shadowed-variable": true,
|
|
51
|
+
"no-string-literal": false,
|
|
52
|
+
"no-string-throw": true,
|
|
53
|
+
"no-switch-case-fall-through": true,
|
|
54
|
+
"no-trailing-whitespace": true,
|
|
55
|
+
"no-unused-expression": true,
|
|
56
|
+
"no-use-before-declare": true,
|
|
57
|
+
"no-var-keyword": true,
|
|
58
|
+
"object-literal-sort-keys": false,
|
|
59
|
+
"one-line": [
|
|
60
|
+
true,
|
|
61
|
+
"check-open-brace",
|
|
62
|
+
"check-catch",
|
|
63
|
+
"check-else",
|
|
64
|
+
"check-whitespace"
|
|
65
|
+
],
|
|
66
|
+
"prefer-const": true,
|
|
67
|
+
"quotemark": [
|
|
68
|
+
true,
|
|
69
|
+
"single"
|
|
70
|
+
],
|
|
71
|
+
"radix": true,
|
|
72
|
+
"semicolon": [
|
|
73
|
+
"always"
|
|
74
|
+
],
|
|
75
|
+
"triple-equals": [
|
|
76
|
+
true,
|
|
77
|
+
"allow-null-check"
|
|
78
|
+
],
|
|
79
|
+
"typedef-whitespace": [
|
|
80
|
+
true,
|
|
81
|
+
{
|
|
82
|
+
"call-signature": "nospace",
|
|
83
|
+
"index-signature": "nospace",
|
|
84
|
+
"parameter": "nospace",
|
|
85
|
+
"property-declaration": "nospace",
|
|
86
|
+
"variable-declaration": "nospace"
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
"typeof-compare": true,
|
|
90
|
+
"unified-signatures": true,
|
|
91
|
+
"variable-name": false,
|
|
92
|
+
"whitespace": [
|
|
93
|
+
true,
|
|
94
|
+
"check-branch",
|
|
95
|
+
"check-decl",
|
|
96
|
+
"check-operator",
|
|
97
|
+
"check-separator",
|
|
98
|
+
"check-type"
|
|
99
|
+
],
|
|
100
|
+
|
|
101
|
+
"directive-selector": [true, "attribute", "app", "camelCase"],
|
|
102
|
+
"component-selector": [true, "element", "app", "kebab-case"],
|
|
103
|
+
"no-inputs-metadata-property": true,
|
|
104
|
+
"no-outputs-metadata-property": true,
|
|
105
|
+
"no-host-metadata-property": true,
|
|
106
|
+
"no-input-rename": true,
|
|
107
|
+
"no-output-rename": true,
|
|
108
|
+
"use-lifecycle-interface": true,
|
|
109
|
+
"use-pipe-transform-interface": true,
|
|
110
|
+
"component-class-suffix": true,
|
|
111
|
+
"directive-class-suffix": true,
|
|
112
|
+
"no-access-missing-member": true,
|
|
113
|
+
"templates-use-public": true,
|
|
114
|
+
"invoke-injectable": true
|
|
115
|
+
}
|
|
116
|
+
}
|