ui5-cc-chart 0.1.0 → 0.1.1
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/.commitlintrc.json +3 -0
- package/.editorconfig +22 -0
- package/.eslintignore +5 -0
- package/.eslintrc.json +13 -0
- package/.github/workflows/release-auto.yml +31 -0
- package/.husky/pre-commit +4 -0
- package/.husky/pre-push +4 -0
- package/.husky/skip.js +5 -0
- package/.lintstagedrc.json +3 -0
- package/.prettierignore +12 -0
- package/.prettierrc.json +18 -0
- package/CHANGELOG.md +14 -0
- package/Chart.css +1 -1
- package/Chart.js +68 -68
- package/ChartRecord.js +9 -11
- package/README.md +12 -0
- package/package.json +27 -1
package/.editorconfig
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# EditorConfig helps developers define and maintain consistent
|
|
2
|
+
# coding styles between different editors and IDEs
|
|
3
|
+
# editorconfig.org
|
|
4
|
+
|
|
5
|
+
root = true
|
|
6
|
+
|
|
7
|
+
[*]
|
|
8
|
+
# We recommend you to keep these unchanged
|
|
9
|
+
end_of_line = lf
|
|
10
|
+
charset = utf-8
|
|
11
|
+
trim_trailing_whitespace = true
|
|
12
|
+
insert_final_newline = true
|
|
13
|
+
|
|
14
|
+
# Change these settings to your own preference
|
|
15
|
+
indent_style = tab
|
|
16
|
+
|
|
17
|
+
[*.{yaml,yml,md,json,xml,properties}]
|
|
18
|
+
indent_size = 2
|
|
19
|
+
indent_style = space
|
|
20
|
+
|
|
21
|
+
[*.md]
|
|
22
|
+
trim_trailing_whitespace = false
|
package/.eslintignore
ADDED
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: Release (automatic)
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
|
|
7
|
+
|
|
8
|
+
env:
|
|
9
|
+
HUSKY_SKIP: true
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
release:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v2
|
|
16
|
+
with:
|
|
17
|
+
fetch-depth: 0
|
|
18
|
+
- uses: actions/setup-node@v2
|
|
19
|
+
with:
|
|
20
|
+
node-version: "16"
|
|
21
|
+
|
|
22
|
+
- name: Install dependencies
|
|
23
|
+
run: npm install
|
|
24
|
+
|
|
25
|
+
- name: Publish to NPM
|
|
26
|
+
run: |
|
|
27
|
+
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
|
|
28
|
+
echo ":::: Publishing as $(npm whoami)"
|
|
29
|
+
npm publish
|
|
30
|
+
env:
|
|
31
|
+
NPM_TOKEN: ${{ secrets.NPM_RELEASE_AUTH_TOKEN }}
|
package/.husky/pre-push
ADDED
package/.husky/skip.js
ADDED
package/.prettierignore
ADDED
package/.prettierrc.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"singleQuote": false,
|
|
3
|
+
"printWidth": 200,
|
|
4
|
+
"endOfLine": "lf",
|
|
5
|
+
"tabWidth": 4,
|
|
6
|
+
"useTabs": true,
|
|
7
|
+
"overrides": [
|
|
8
|
+
{
|
|
9
|
+
"files": ["*.yaml", "*.yml", "*.md", "*.json", "*.xml", "*.properties"],
|
|
10
|
+
"options": {
|
|
11
|
+
"useTabs": false,
|
|
12
|
+
"tabWidth": 2,
|
|
13
|
+
"keySeparator": "=",
|
|
14
|
+
"xmlWhitespaceSensitivity": "ignore"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
## 0.1.1 (2022-05-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* make line chart the default ([bd41b41](https://github.com/ui5-community/ui5-cc-chart/commit/bd41b4199c487a041d63b982bd87ed50c9077f3b))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* finalize public project ([6291ba6](https://github.com/ui5-community/ui5-cc-chart/commit/6291ba6102e7d15c1c8a50ff73770e4f842a55cd))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
package/Chart.css
CHANGED
package/Chart.js
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
sap.ui.define(["sap/ui/core/Control", "chart.js/auto", "sap/ui/dom/includeStylesheet"], function(Control, Chart, includeStylesheet) {
|
|
1
|
+
sap.ui.define(["sap/ui/core/Control", "chart.js/auto", "sap/ui/dom/includeStylesheet"], function (Control, Chart, includeStylesheet) {
|
|
2
|
+
return Control.extend("ui5-cc-chart.Chart", {
|
|
3
|
+
metadata: {
|
|
4
|
+
properties: {
|
|
5
|
+
type: {
|
|
6
|
+
type: "string",
|
|
7
|
+
defaultValue: "line",
|
|
8
|
+
},
|
|
9
|
+
title: "string",
|
|
10
|
+
color: "sap.ui.core.CSSColor",
|
|
11
|
+
},
|
|
12
|
+
aggregations: {
|
|
13
|
+
records: {
|
|
14
|
+
type: "ui5-cc-chart.ChartRecord",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
defaultAggregation: "records",
|
|
18
|
+
},
|
|
19
|
+
renderer: {
|
|
20
|
+
apiVersion: 2,
|
|
21
|
+
render: function (rm, chart) {
|
|
22
|
+
rm.openStart("div", chart);
|
|
23
|
+
rm.style("color", chart.getColor());
|
|
24
|
+
rm.class("chart");
|
|
25
|
+
rm.openEnd();
|
|
2
26
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
"type": {
|
|
7
|
-
type: "string",
|
|
8
|
-
defaultValue: "line"
|
|
9
|
-
},
|
|
10
|
-
"title": "string",
|
|
11
|
-
"color": "sap.ui.core.CSSColor"
|
|
12
|
-
},
|
|
13
|
-
aggregations: {
|
|
14
|
-
"records": {
|
|
15
|
-
type: "ui5-cc-chart.ChartRecord"
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
defaultAggregation: "records"
|
|
19
|
-
},
|
|
20
|
-
renderer: {
|
|
21
|
-
apiVersion: 2,
|
|
22
|
-
render: function(rm, chart) {
|
|
23
|
-
rm.openStart("div", chart);
|
|
24
|
-
rm.style("color", chart.getColor());
|
|
25
|
-
rm.class("chart");
|
|
26
|
-
rm.openEnd();
|
|
27
|
-
|
|
28
|
-
rm.openStart("canvas", chart.getId() + "-canvas");
|
|
29
|
-
rm.openEnd();
|
|
30
|
-
rm.close("canvas");
|
|
31
|
-
|
|
32
|
-
rm.close("div");
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
_getChartData: function() {
|
|
36
|
-
const aRecords = this.getRecords();
|
|
37
|
-
return {
|
|
38
|
-
labels: aRecords.map(record => {
|
|
39
|
-
return record.getLabel();
|
|
40
|
-
}),
|
|
41
|
-
datasets: [{
|
|
42
|
-
label: this.getTitle(),
|
|
43
|
-
backgroundColor: this.getColor(),
|
|
44
|
-
borderColor: this.getColor(),
|
|
45
|
-
data: aRecords.map(record => {
|
|
46
|
-
return record.getValue();
|
|
47
|
-
})
|
|
48
|
-
}]
|
|
49
|
-
};
|
|
50
|
-
},
|
|
51
|
-
init: function() {
|
|
52
|
-
includeStylesheet(sap.ui.require.toUrl("ui5-cc-chart/Chart.css"));
|
|
53
|
-
},
|
|
54
|
-
onAfterRendering: function() {
|
|
55
|
-
if (!this._chart) {
|
|
56
|
-
this._chart = new Chart(this.getDomRef("canvas"), {
|
|
57
|
-
type: this.getType(),
|
|
58
|
-
data: this._getChartData(),
|
|
59
|
-
options: {
|
|
60
|
-
responsive: true,
|
|
61
|
-
animation: false
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
} else {
|
|
65
|
-
this._chart.data = this._getChartData();
|
|
66
|
-
this._chart.update();
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
});
|
|
27
|
+
rm.openStart("canvas", chart.getId() + "-canvas");
|
|
28
|
+
rm.openEnd();
|
|
29
|
+
rm.close("canvas");
|
|
70
30
|
|
|
31
|
+
rm.close("div");
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
_getChartData: function () {
|
|
35
|
+
const aRecords = this.getRecords();
|
|
36
|
+
return {
|
|
37
|
+
labels: aRecords.map((record) => {
|
|
38
|
+
return record.getLabel();
|
|
39
|
+
}),
|
|
40
|
+
datasets: [
|
|
41
|
+
{
|
|
42
|
+
label: this.getTitle(),
|
|
43
|
+
backgroundColor: this.getColor(),
|
|
44
|
+
borderColor: this.getColor(),
|
|
45
|
+
data: aRecords.map((record) => {
|
|
46
|
+
return record.getValue();
|
|
47
|
+
}),
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
init: function () {
|
|
53
|
+
includeStylesheet(sap.ui.require.toUrl("ui5-cc-chart/Chart.css"));
|
|
54
|
+
},
|
|
55
|
+
onAfterRendering: function () {
|
|
56
|
+
if (!this._chart) {
|
|
57
|
+
this._chart = new Chart(this.getDomRef("canvas"), {
|
|
58
|
+
type: this.getType(),
|
|
59
|
+
data: this._getChartData(),
|
|
60
|
+
options: {
|
|
61
|
+
responsive: true,
|
|
62
|
+
animation: false,
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
} else {
|
|
66
|
+
this._chart.data = this._getChartData();
|
|
67
|
+
this._chart.update();
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
71
|
});
|
package/ChartRecord.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
sap.ui.define(["sap/ui/core/Element"], function(Element) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
});
|
|
11
|
-
|
|
1
|
+
sap.ui.define(["sap/ui/core/Element"], function (Element) {
|
|
2
|
+
return Element.extend("ui5-cc-chart.ChartRecord", {
|
|
3
|
+
metadata: {
|
|
4
|
+
properties: {
|
|
5
|
+
label: "string",
|
|
6
|
+
value: "float",
|
|
7
|
+
},
|
|
8
|
+
},
|
|
9
|
+
});
|
|
12
10
|
});
|
package/README.md
CHANGED
|
@@ -78,6 +78,18 @@ Please use the GitHub bug tracking system to post questions, bug reports or to c
|
|
|
78
78
|
|
|
79
79
|
Any type of contribution (code contributions, pull requests, issues) to this showcase will be equally appreciated.
|
|
80
80
|
|
|
81
|
+
## Releasing
|
|
82
|
+
|
|
83
|
+
To release a new version of the package, you just need to run the following command:
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
# Release a new version of the package
|
|
87
|
+
npm version [major|minor|patch]
|
|
88
|
+
|
|
89
|
+
# Publish the package (push the change and the tag)
|
|
90
|
+
npm run version:publish
|
|
91
|
+
```
|
|
92
|
+
|
|
81
93
|
## License
|
|
82
94
|
|
|
83
95
|
This work is [dual-licensed](../../LICENSE) under Apache 2.0 and the Derived Beer-ware License. The official license will be Apache 2.0 but finally you can choose between one of them if you use this work.
|
package/package.json
CHANGED
|
@@ -1,10 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ui5-cc-chart",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "UI5 Custom Control: Chart.js",
|
|
5
5
|
"author": "UI5 Community",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"prepare": "node ./.husky/skip.js || husky install",
|
|
9
|
+
"lint": "eslint .",
|
|
10
|
+
"lint:staged": "lint-staged",
|
|
11
|
+
"lint:commit": "commitlint -e",
|
|
12
|
+
"prettier": "prettier --write .",
|
|
13
|
+
"prettier:staged": "pretty-quick --staged --verbose",
|
|
14
|
+
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
|
|
15
|
+
"hooks:pre-commit": "npm-run-all --sequential prettier:staged lint:staged",
|
|
16
|
+
"hooks:pre-push": "npm-run-all --sequential lint:commit",
|
|
17
|
+
"version": "npm run changelog && git add --all",
|
|
18
|
+
"version:publish": "git push && git push --tags"
|
|
19
|
+
},
|
|
7
20
|
"dependencies": {
|
|
8
21
|
"chart.js": "^3.7.1"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@commitlint/cli": "^16.2.4",
|
|
25
|
+
"@commitlint/config-conventional": "^16.2.4",
|
|
26
|
+
"@prettier/plugin-xml": "^2.1.0",
|
|
27
|
+
"conventional-changelog-cli": "^2.2.2",
|
|
28
|
+
"eslint": "^8.15.0",
|
|
29
|
+
"husky": "^8.0.1",
|
|
30
|
+
"lint-staged": "^12.4.1",
|
|
31
|
+
"npm-run-all": "^4.1.5",
|
|
32
|
+
"prettier": "^2.6.2",
|
|
33
|
+
"prettier-plugin-properties": "^0.1.0",
|
|
34
|
+
"pretty-quick": "^3.1.3"
|
|
9
35
|
}
|
|
10
36
|
}
|