Skip to content

Commit 75cddfe

Browse files
committed
feat: @coreui/angular-chartjs (wip)
1 parent fedcea1 commit 75cddfe

27 files changed

+661
-19
lines changed

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
],
1111
"parserOptions": {
1212
"project": [
13-
"tsconfig.json"
13+
"./tsconfig.json"
1414
],
1515
"createDefaultProgram": true
1616
},

angular.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,46 @@
5151
}
5252
}
5353
}
54+
},
55+
"coreui-angular-chartjs": {
56+
"projectType": "library",
57+
"root": "projects/coreui-angular-chartjs",
58+
"sourceRoot": "projects/coreui-angular-chartjs/src",
59+
"prefix": "c",
60+
"architect": {
61+
"build": {
62+
"builder": "@angular-devkit/build-angular:ng-packagr",
63+
"options": {
64+
"project": "projects/coreui-angular-chartjs/ng-package.json"
65+
},
66+
"configurations": {
67+
"production": {
68+
"tsConfig": "projects/coreui-angular-chartjs/tsconfig.lib.prod.json"
69+
},
70+
"development": {
71+
"tsConfig": "projects/coreui-angular-chartjs/tsconfig.lib.json"
72+
}
73+
},
74+
"defaultConfiguration": "production"
75+
},
76+
"test": {
77+
"builder": "@angular-devkit/build-angular:karma",
78+
"options": {
79+
"main": "projects/coreui-angular-chartjs/src/test.ts",
80+
"tsConfig": "projects/coreui-angular-chartjs/tsconfig.spec.json",
81+
"karmaConfig": "projects/coreui-angular-chartjs/karma.conf.js"
82+
}
83+
},
84+
"lint": {
85+
"builder": "@angular-eslint/builder:lint",
86+
"options": {
87+
"lintFilePatterns": [
88+
"projects/coreui-angular-chartjs/**/*.ts",
89+
"projects/coreui-angular-chartjs/**/*.html"
90+
]
91+
}
92+
}
93+
}
5494
}
5595
},
5696
"defaultProject": "coreui-angular"

package.json

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,24 @@
55
"license": "MIT",
66
"author": "The CoreUI Team (https://github.com/orgs/coreui/people)",
77
"scripts": {
8-
"ng": "ng",
8+
"lib": "ng",
99
"watch:lib:dev": "ng build coreui-angular --watch --configuration development",
1010
"build:lib:prod": "ng build coreui-angular",
1111
"test:lib:dev": "ng test coreui-angular",
12-
"test-lib:prod": "ng test coreui-angular --karmaConfig=projects/coreui-angular/karma.conf.github.js",
12+
"test:lib:prod": "ng test coreui-angular --karmaConfig=projects/coreui-angular/karma.conf.github.js",
1313
"prepublish:lib": "ng lint coreui-angular && ng test coreui-angular --watch=false && ng build coreui-angular",
1414
"publish:lib": "cd dist/coreui-angular/ && npm publish --tag next --dry-run",
1515
"lint:lib": "ng lint coreui-angular",
16-
"link:lib": "cd dist/coreui-angular/ && npm link"
16+
"link:lib": "cd dist/coreui-angular/ && npm link",
17+
"chartjs": "ng",
18+
"watch:chartjs:dev": "ng build coreui-angular-chartjs --watch --configuration development",
19+
"build:chartjs:prod": "ng build coreui-angular-chartjs",
20+
"test:chartjs:dev": "ng test coreui-angular-chartjs",
21+
"test:chartjs:prod": "ng test coreui-angular-chartjs --karmaConfig=projects/coreui-angular-chartjs/karma.conf.github.js",
22+
"prepublish:chartjs": "ng lint coreui-angular-chartjs && ng test coreui-angular-chartjs --watch=false && ng build coreui-angular-chartjs",
23+
"publish:chartjs": "cd dist/coreui-angular-chartjs/ && npm publish --tag next --dry-run",
24+
"lint:chartjs": "ng lint coreui-angular-chartjs",
25+
"link:chartjs": "cd dist/coreui-angular-chartjs/ && npm link"
1726
},
1827
"private": true,
1928
"dependencies": {
@@ -43,20 +52,24 @@
4352
"@angular/cli": "~12.2.13",
4453
"@angular/compiler-cli": "~12.2.13",
4554
"@angular/language-service": "~12.2.13",
55+
"@coreui/chartjs": "^3.0.0",
4656
"@types/jasmine": "~3.8.2",
57+
"@types/lodash": "^4.14.177",
4758
"@types/node": "^16.11.9",
4859
"@typescript-eslint/eslint-plugin": "~4.33.0",
4960
"@typescript-eslint/parser": "~4.33.0",
50-
"chart.js": "^2.9.4",
61+
"chart.js": "^3.6.0",
5162
"eslint": "^7.32.0",
5263
"jasmine-core": "~3.8.0",
5364
"karma": "~6.3.9",
5465
"karma-chrome-launcher": "~3.1.0",
5566
"karma-coverage": "~2.0.3",
5667
"karma-jasmine": "~4.0.1",
5768
"karma-jasmine-html-reporter": "^1.7.0",
69+
"lodash.assign": "^4.2.0",
70+
"lodash.find": "^4.6.0",
71+
"lodash.merge": "^4.6.2",
5872
"ng-packagr": "~12.2.5",
59-
"ng2-charts": "~2.4.3",
6073
"prettier": "^2.4.1",
6174
"typescript": "~4.3.5"
6275
},
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"extends": "../../.eslintrc.json",
3+
"ignorePatterns": [
4+
"!**/*"
5+
],
6+
"overrides": [
7+
{
8+
"files": [
9+
"*.ts"
10+
],
11+
"parserOptions": {
12+
"project": [
13+
"./projects/coreui-angular-chartjs/tsconfig.lib.json",
14+
"./projects/coreui-angular-chartjs/tsconfig.spec.json"
15+
],
16+
"createDefaultProgram": true
17+
},
18+
"rules": {
19+
"@angular-eslint/directive-selector": [
20+
"error",
21+
{
22+
"type": "attribute",
23+
"prefix": "c",
24+
"style": "camelCase"
25+
}
26+
],
27+
"@angular-eslint/component-selector": [
28+
"error",
29+
{
30+
"type": "element",
31+
"prefix": "c",
32+
"style": "kebab-case"
33+
}
34+
]
35+
}
36+
},
37+
{
38+
"files": [
39+
"*.html"
40+
],
41+
"rules": {}
42+
}
43+
]
44+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 creativeLabs Łukasz Holeczek
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# CoreuiAngularChartjs
2+
3+
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.2.0.
4+
5+
## Code scaffolding
6+
7+
Run `ng generate component component-name --project coreui-angular-chartjs` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project coreui-angular-chartjs`.
8+
> Note: Don't forget to add `--project coreui-angular-chartjs` or else it will be added to the default project in your `angular.json` file.
9+
10+
## Build
11+
12+
Run `ng build coreui-angular-chartjs` to build the project. The build artifacts will be stored in the `dist/` directory.
13+
14+
## Publishing
15+
16+
After building your library with `ng build coreui-angular-chartjs`, go to the dist folder `cd dist/coreui-angular-chartjs` and run `npm publish`.
17+
18+
## Running unit tests
19+
20+
Run `ng test coreui-angular-chartjs` to execute the unit tests via [Karma](https://karma-runner.github.io).
21+
22+
## Further help
23+
24+
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.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Karma configuration file, see link for more information
2+
// https://karma-runner.github.io/1.0/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'),
13+
require('@angular-devkit/build-angular/plugins/karma')
14+
],
15+
client: {
16+
jasmine: {
17+
// you can add configuration options for Jasmine here
18+
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
19+
// for example, you can disable the random execution with `random: false`
20+
// or set a specific seed with `seed: 4321`
21+
},
22+
clearContext: false // leave Jasmine Spec Runner output visible in browser
23+
},
24+
jasmineHtmlReporter: {
25+
suppressAll: true // removes the duplicated traces
26+
},
27+
coverageReporter: {
28+
dir: require('path').join(__dirname, '../../coverage/coreui-angular-chartjs'),
29+
subdir: '.',
30+
reporters: [
31+
{ type: 'html' },
32+
{ type: 'text-summary' }
33+
]
34+
},
35+
reporters: ['progress', 'kjhtml'],
36+
port: 9876,
37+
colors: true,
38+
logLevel: config.LOG_INFO,
39+
autoWatch: true,
40+
browsers: ['Chrome'],
41+
singleRun: false,
42+
restartOnFileChange: true
43+
});
44+
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3+
"dest": "../../dist/coreui-angular-chartjs",
4+
"lib": {
5+
"entryFile": "src/public-api.ts"
6+
}
7+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "@coreui/angular-chartjs",
3+
"description": "Angular wrapper component for Chart.js",
4+
"version": "2.0.0-alpha.0",
5+
"homepage": "https://coreui.io/angular/docs/components/chart/",
6+
"bugs": {
7+
"url": "https://github.com/coreui/coreui-angular/issues"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/coreui/coreui-angular.git"
12+
},
13+
"license": "MIT",
14+
"author": "The CoreUI Team (https://github.com/orgs/coreui/people)",
15+
"peerDependencies": {
16+
"@angular/common": "^12.2.0",
17+
"@angular/core": "^12.2.0",
18+
"@coreui/chartjs": "^3.0.0",
19+
"chart.js": "^3.6.0"
20+
},
21+
"dependencies": {
22+
"tslib": "^2.3.0"
23+
}
24+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<canvas
2+
#canvasElement
3+
(click)="handleOnClick($event)"
4+
[height]="height"
5+
[id]="id"
6+
[width]="width"
7+
role="img">
8+
<ng-content></ng-content>
9+
</canvas>

0 commit comments

Comments
 (0)