@abp/ng.components 5.0.1 → 5.0.2
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/README.md +3 -3
- package/abp-ng.components.d.ts +5 -5
- package/bundles/abp-ng.components-chart.js.umd.js +141 -141
- package/bundles/abp-ng.components-chart.js.umd.js.map +1 -1
- package/bundles/abp-ng.components-page.umd.js +542 -542
- package/bundles/abp-ng.components-page.umd.js.map +1 -1
- package/bundles/abp-ng.components-tree.umd.js +557 -557
- package/bundles/abp-ng.components-tree.umd.js.map +1 -1
- package/bundles/abp-ng.components.umd.js +2 -2
- package/chart.js/abp-ng.components-chart.js.d.ts +5 -5
- package/chart.js/chart.component.d.ts +30 -30
- package/chart.js/chart.module.d.ts +8 -8
- package/chart.js/public-api.d.ts +3 -3
- package/chart.js/widget-utils.d.ts +1 -1
- package/esm2015/abp-ng.components.js +4 -4
- package/esm2015/chart.js/abp-ng.components-chart.js.js +4 -4
- package/esm2015/chart.js/chart.component.js +141 -141
- package/esm2015/chart.js/chart.module.js +19 -19
- package/esm2015/chart.js/public-api.js +4 -4
- package/esm2015/chart.js/widget-utils.js +11 -11
- package/esm2015/page/abp-ng.components-page.js +4 -4
- package/esm2015/page/page-part.directive.js +79 -79
- package/esm2015/page/page-parts.component.js +45 -45
- package/esm2015/page/page.component.js +61 -61
- package/esm2015/page/page.module.js +38 -38
- package/esm2015/page/public-api.js +5 -5
- package/esm2015/public-api.js +5 -5
- package/esm2015/tree/abp-ng.components-tree.js +4 -4
- package/esm2015/tree/lib/components/tree.component.js +101 -101
- package/esm2015/tree/lib/templates/expanded-icon-template.directive.js +16 -16
- package/esm2015/tree/lib/templates/tree-node-template.directive.js +16 -16
- package/esm2015/tree/lib/tree.module.js +25 -25
- package/esm2015/tree/lib/utils/nz-tree-adapter.js +92 -92
- package/esm2015/tree/public-api.js +6 -6
- package/fesm2015/abp-ng.components-chart.js.js +161 -161
- package/fesm2015/abp-ng.components-chart.js.js.map +1 -1
- package/fesm2015/abp-ng.components-page.js +196 -196
- package/fesm2015/abp-ng.components-page.js.map +1 -1
- package/fesm2015/abp-ng.components-tree.js +219 -219
- package/fesm2015/abp-ng.components-tree.js.map +1 -1
- package/fesm2015/abp-ng.components.js +4 -4
- package/fesm2015/abp-ng.components.js.map +1 -1
- package/package.json +3 -3
- package/page/abp-ng.components-page.d.ts +5 -5
- package/page/page-part.directive.d.ts +31 -31
- package/page/page-parts.component.d.ts +18 -18
- package/page/page.component.d.ts +21 -21
- package/page/page.module.d.ts +13 -13
- package/page/public-api.d.ts +4 -4
- package/public-api.d.ts +1 -1
- package/tree/abp-ng.components-tree.d.ts +5 -5
- package/tree/lib/components/tree.component.d.ts +39 -39
- package/tree/lib/templates/expanded-icon-template.directive.d.ts +8 -8
- package/tree/lib/templates/tree-node-template.directive.d.ts +8 -8
- package/tree/lib/tree.module.d.ts +13 -13
- package/tree/lib/utils/nz-tree-adapter.d.ts +39 -39
- package/tree/public-api.d.ts +5 -5
|
@@ -1,92 +1,92 @@
|
|
|
1
|
-
export class BaseNode {
|
|
2
|
-
constructor(id, parentId) {
|
|
3
|
-
this.id = id;
|
|
4
|
-
this.parentId = parentId;
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
class TreeNode extends BaseNode {
|
|
8
|
-
constructor(entity, nameResolver = ent => ent.displayName || ent.name) {
|
|
9
|
-
super(entity.id, entity.parentId);
|
|
10
|
-
this.entity = entity;
|
|
11
|
-
this.nameResolver = nameResolver;
|
|
12
|
-
this.icon = null;
|
|
13
|
-
this.children = [];
|
|
14
|
-
this.isLeaf = true;
|
|
15
|
-
this.checked = false;
|
|
16
|
-
this.selected = false;
|
|
17
|
-
this.expanded = false;
|
|
18
|
-
this.selectable = true;
|
|
19
|
-
this.disabled = false;
|
|
20
|
-
this.disableCheckbox = false;
|
|
21
|
-
this.key = entity.id;
|
|
22
|
-
this.title = nameResolver(entity);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
export class TreeAdapter {
|
|
26
|
-
constructor(list = []) {
|
|
27
|
-
this.list = list;
|
|
28
|
-
this.tree = createTreeFromList(this.list);
|
|
29
|
-
}
|
|
30
|
-
getList() {
|
|
31
|
-
return this.list;
|
|
32
|
-
}
|
|
33
|
-
getTree() {
|
|
34
|
-
return this.tree;
|
|
35
|
-
}
|
|
36
|
-
handleDrop({ key, parentNode }) {
|
|
37
|
-
const index = this.list.findIndex(({ id }) => id === key);
|
|
38
|
-
this.list[index].parentId = parentNode ? parentNode.key : null;
|
|
39
|
-
this.tree = createTreeFromList(this.list);
|
|
40
|
-
}
|
|
41
|
-
handleRemove({ key }) {
|
|
42
|
-
this.updateTreeFromList(this.list.filter(item => item.id !== key));
|
|
43
|
-
}
|
|
44
|
-
handleUpdate({ key, children }) {
|
|
45
|
-
/**
|
|
46
|
-
* When we need to update a node with new children, first we need to remove any descendant nodes.
|
|
47
|
-
* If we remove immediate children and create a new tree, any other descendant nodes will be removed
|
|
48
|
-
* and we won't need to recursively remove sub children.
|
|
49
|
-
* Then, you simply add back the new children and create a new tree.
|
|
50
|
-
*/
|
|
51
|
-
const listWithDescendantNodesRemoved = this.updateTreeFromList(this.list.filter(item => item.parentId !== key));
|
|
52
|
-
this.updateTreeFromList(listWithDescendantNodesRemoved.concat(children));
|
|
53
|
-
}
|
|
54
|
-
updateTreeFromList(list) {
|
|
55
|
-
this.tree = createTreeFromList(list);
|
|
56
|
-
this.list = createListFromTree(this.tree);
|
|
57
|
-
return this.list;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
// UTILITY FUNCTIONS
|
|
61
|
-
function createTreeFromList(list) {
|
|
62
|
-
const map = createMapFromList(list);
|
|
63
|
-
const tree = [];
|
|
64
|
-
list.forEach(row => {
|
|
65
|
-
const parentId = row.parentId;
|
|
66
|
-
const node = map.get(row.id);
|
|
67
|
-
if (parentId) {
|
|
68
|
-
const parent = map.get(parentId);
|
|
69
|
-
if (!parent)
|
|
70
|
-
return;
|
|
71
|
-
parent.children.push(node);
|
|
72
|
-
parent.isLeaf = false;
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
tree.push(node);
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
return tree;
|
|
79
|
-
}
|
|
80
|
-
function createListFromTree(tree, list = []) {
|
|
81
|
-
tree.forEach(node => {
|
|
82
|
-
list.push(Object.assign(Object.assign({}, node.entity), { parentId: node.parentId }));
|
|
83
|
-
if (node.children)
|
|
84
|
-
createListFromTree(node.children, list);
|
|
85
|
-
});
|
|
86
|
-
return list;
|
|
87
|
-
}
|
|
88
|
-
function createMapFromList(list, map = new Map()) {
|
|
89
|
-
list.forEach(row => map.set(row.id, new TreeNode(row)));
|
|
90
|
-
return map;
|
|
91
|
-
}
|
|
92
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
1
|
+
export class BaseNode {
|
|
2
|
+
constructor(id, parentId) {
|
|
3
|
+
this.id = id;
|
|
4
|
+
this.parentId = parentId;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
class TreeNode extends BaseNode {
|
|
8
|
+
constructor(entity, nameResolver = ent => ent.displayName || ent.name) {
|
|
9
|
+
super(entity.id, entity.parentId);
|
|
10
|
+
this.entity = entity;
|
|
11
|
+
this.nameResolver = nameResolver;
|
|
12
|
+
this.icon = null;
|
|
13
|
+
this.children = [];
|
|
14
|
+
this.isLeaf = true;
|
|
15
|
+
this.checked = false;
|
|
16
|
+
this.selected = false;
|
|
17
|
+
this.expanded = false;
|
|
18
|
+
this.selectable = true;
|
|
19
|
+
this.disabled = false;
|
|
20
|
+
this.disableCheckbox = false;
|
|
21
|
+
this.key = entity.id;
|
|
22
|
+
this.title = nameResolver(entity);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export class TreeAdapter {
|
|
26
|
+
constructor(list = []) {
|
|
27
|
+
this.list = list;
|
|
28
|
+
this.tree = createTreeFromList(this.list);
|
|
29
|
+
}
|
|
30
|
+
getList() {
|
|
31
|
+
return this.list;
|
|
32
|
+
}
|
|
33
|
+
getTree() {
|
|
34
|
+
return this.tree;
|
|
35
|
+
}
|
|
36
|
+
handleDrop({ key, parentNode }) {
|
|
37
|
+
const index = this.list.findIndex(({ id }) => id === key);
|
|
38
|
+
this.list[index].parentId = parentNode ? parentNode.key : null;
|
|
39
|
+
this.tree = createTreeFromList(this.list);
|
|
40
|
+
}
|
|
41
|
+
handleRemove({ key }) {
|
|
42
|
+
this.updateTreeFromList(this.list.filter(item => item.id !== key));
|
|
43
|
+
}
|
|
44
|
+
handleUpdate({ key, children }) {
|
|
45
|
+
/**
|
|
46
|
+
* When we need to update a node with new children, first we need to remove any descendant nodes.
|
|
47
|
+
* If we remove immediate children and create a new tree, any other descendant nodes will be removed
|
|
48
|
+
* and we won't need to recursively remove sub children.
|
|
49
|
+
* Then, you simply add back the new children and create a new tree.
|
|
50
|
+
*/
|
|
51
|
+
const listWithDescendantNodesRemoved = this.updateTreeFromList(this.list.filter(item => item.parentId !== key));
|
|
52
|
+
this.updateTreeFromList(listWithDescendantNodesRemoved.concat(children));
|
|
53
|
+
}
|
|
54
|
+
updateTreeFromList(list) {
|
|
55
|
+
this.tree = createTreeFromList(list);
|
|
56
|
+
this.list = createListFromTree(this.tree);
|
|
57
|
+
return this.list;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// UTILITY FUNCTIONS
|
|
61
|
+
function createTreeFromList(list) {
|
|
62
|
+
const map = createMapFromList(list);
|
|
63
|
+
const tree = [];
|
|
64
|
+
list.forEach(row => {
|
|
65
|
+
const parentId = row.parentId;
|
|
66
|
+
const node = map.get(row.id);
|
|
67
|
+
if (parentId) {
|
|
68
|
+
const parent = map.get(parentId);
|
|
69
|
+
if (!parent)
|
|
70
|
+
return;
|
|
71
|
+
parent.children.push(node);
|
|
72
|
+
parent.isLeaf = false;
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
tree.push(node);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return tree;
|
|
79
|
+
}
|
|
80
|
+
function createListFromTree(tree, list = []) {
|
|
81
|
+
tree.forEach(node => {
|
|
82
|
+
list.push(Object.assign(Object.assign({}, node.entity), { parentId: node.parentId }));
|
|
83
|
+
if (node.children)
|
|
84
|
+
createListFromTree(node.children, list);
|
|
85
|
+
});
|
|
86
|
+
return list;
|
|
87
|
+
}
|
|
88
|
+
function createMapFromList(list, map = new Map()) {
|
|
89
|
+
list.forEach(row => map.set(row.id, new TreeNode(row)));
|
|
90
|
+
return map;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnotdHJlZS1hZGFwdGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvY29tcG9uZW50cy90cmVlL3NyYy9saWIvdXRpbHMvbnotdHJlZS1hZGFwdGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE1BQU0sT0FBZ0IsUUFBUTtJQUk1QixZQUFtQixFQUFVLEVBQVMsUUFBdUI7UUFBMUMsT0FBRSxHQUFGLEVBQUUsQ0FBUTtRQUFTLGFBQVEsR0FBUixRQUFRLENBQWU7SUFBRyxDQUFDO0NBQ2xFO0FBRUQsTUFBTSxRQUE2QixTQUFRLFFBQVE7SUFjakQsWUFBbUIsTUFBUyxFQUFVLGVBQWUsR0FBRyxDQUFDLEVBQUUsQ0FBQyxHQUFHLENBQUMsV0FBVyxJQUFJLEdBQUcsQ0FBQyxJQUFJO1FBQ3JGLEtBQUssQ0FBQyxNQUFNLENBQUMsRUFBRSxFQUFFLE1BQU0sQ0FBQyxRQUFRLENBQUMsQ0FBQztRQURqQixXQUFNLEdBQU4sTUFBTSxDQUFHO1FBQVUsaUJBQVksR0FBWixZQUFZLENBQXFDO1FBWHZGLFNBQUksR0FBa0IsSUFBSSxDQUFDO1FBQzNCLGFBQVEs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kZT4oXG4gIGxpc3Q6IFRbXSxcbiAgbWFwID0gbmV3IE1hcDxzdHJpbmcsIFRyZWVOb2RlPFQ+PigpLFxuKTogTWFwPHN0cmluZywgVHJlZU5vZGU8VD4+IHtcbiAgbGlzdC5mb3JFYWNoKHJvdyA9PiBtYXAuc2V0KHJvdy5pZCwgbmV3IFRyZWVOb2RlKHJvdykpKTtcblxuICByZXR1cm4gbWFwO1xufVxuIl19
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './lib/tree.module';
|
|
2
|
-
export * from './lib/components/tree.component';
|
|
3
|
-
export * from './lib/utils/nz-tree-adapter';
|
|
4
|
-
export * from './lib/templates/tree-node-template.directive';
|
|
5
|
-
export * from './lib/templates/expanded-icon-template.directive';
|
|
6
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
1
|
+
export * from './lib/tree.module';
|
|
2
|
+
export * from './lib/components/tree.component';
|
|
3
|
+
export * from './lib/utils/nz-tree-adapter';
|
|
4
|
+
export * from './lib/templates/tree-node-template.directive';
|
|
5
|
+
export * from './lib/templates/expanded-icon-template.directive';
|
|
6
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvbXBvbmVudHMvdHJlZS9zcmMvcHVibGljLWFwaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLG1CQUFtQixDQUFDO0FBQ2xDLGNBQWMsaUNBQWlDLENBQUM7QUFDaEQsY0FBYyw2QkFBNkIsQ0FBQztBQUM1QyxjQUFjLDhDQUE4QyxDQUFDO0FBQzdELGNBQWMsa0RBQWtELENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL2xpYi90cmVlLm1vZHVsZSc7XG5leHBvcnQgKiBmcm9tICcuL2xpYi9jb21wb25lbnRzL3RyZWUuY29tcG9uZW50JztcbmV4cG9ydCAqIGZyb20gJy4vbGliL3V0aWxzL256LXRyZWUtYWRhcHRlcic7XG5leHBvcnQgKiBmcm9tICcuL2xpYi90ZW1wbGF0ZXMvdHJlZS1ub2RlLXRlbXBsYXRlLmRpcmVjdGl2ZSc7XG5leHBvcnQgKiBmcm9tICcuL2xpYi90ZW1wbGF0ZXMvZXhwYW5kZWQtaWNvbi10ZW1wbGF0ZS5kaXJlY3RpdmUnO1xuIl19
|
|
@@ -2,173 +2,173 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { EventEmitter, Component, ChangeDetectionStrategy, Input, Output, ViewChild, NgModule } from '@angular/core';
|
|
3
3
|
import { CommonModule } from '@angular/common';
|
|
4
4
|
|
|
5
|
-
let Chart;
|
|
6
|
-
class ChartComponent {
|
|
7
|
-
constructor(el, cdr) {
|
|
8
|
-
this.el = el;
|
|
9
|
-
this.cdr = cdr;
|
|
10
|
-
this.data = {};
|
|
11
|
-
this.options = {};
|
|
12
|
-
this.plugins = [];
|
|
13
|
-
this.responsive = true;
|
|
14
|
-
this.dataSelect = new EventEmitter();
|
|
15
|
-
this.initialized = new EventEmitter();
|
|
16
|
-
this.initChart = () => {
|
|
17
|
-
const opts = this.options || {};
|
|
18
|
-
opts.responsive = this.responsive;
|
|
19
|
-
// allows chart to resize in responsive mode
|
|
20
|
-
if (opts.responsive && (this.height || this.width)) {
|
|
21
|
-
opts.maintainAspectRatio = false;
|
|
22
|
-
}
|
|
23
|
-
this.chart = new Chart(this.canvas.nativeElement, {
|
|
24
|
-
type: this.type,
|
|
25
|
-
data: this.data,
|
|
26
|
-
options: this.options,
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
this.getCanvas = () => {
|
|
30
|
-
return this.canvas.nativeElement;
|
|
31
|
-
};
|
|
32
|
-
this.getBase64Image = () => {
|
|
33
|
-
return this.chart.toBase64Image();
|
|
34
|
-
};
|
|
35
|
-
this.generateLegend = () => {
|
|
36
|
-
if (this.chart) {
|
|
37
|
-
return this.chart.generateLegend();
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
this.refresh = () => {
|
|
41
|
-
if (this.chart) {
|
|
42
|
-
this.chart.update();
|
|
43
|
-
this.cdr.detectChanges();
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
this.reinit = () => {
|
|
47
|
-
if (!this.chart)
|
|
48
|
-
return;
|
|
49
|
-
this.chart.destroy();
|
|
50
|
-
this.initChart();
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
ngAfterViewInit() {
|
|
54
|
-
import('chart.js/auto').then(module => {
|
|
55
|
-
Chart = module.default;
|
|
56
|
-
this.initChart();
|
|
57
|
-
this.initialized.emit(true);
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
onCanvasClick(event) {
|
|
61
|
-
if (this.chart) {
|
|
62
|
-
const element = this.chart.getElementsAtEventForMode(event, 'nearest', { intersect: true }, false);
|
|
63
|
-
const dataset = this.chart.getElementsAtEventForMode(event, 'dataset', { intersect: true }, false);
|
|
64
|
-
if (element && element[0] && dataset) {
|
|
65
|
-
this.dataSelect.emit({ originalEvent: event, element: element[0], dataset: dataset });
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
ngOnDestroy() {
|
|
70
|
-
if (this.chart) {
|
|
71
|
-
this.chart.destroy();
|
|
72
|
-
this.chart = null;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
ngOnChanges(changes) {
|
|
76
|
-
var _a, _b;
|
|
77
|
-
if (!this.chart)
|
|
78
|
-
return;
|
|
79
|
-
if (((_a = changes.data) === null || _a === void 0 ? void 0 : _a.currentValue) || ((_b = changes.options) === null || _b === void 0 ? void 0 : _b.currentValue)) {
|
|
80
|
-
this.chart.destroy();
|
|
81
|
-
this.initChart();
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
ChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: ChartComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
86
|
-
ChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.13", type: ChartComponent, selector: "abp-chart", inputs: { type: "type", data: "data", options: "options", plugins: "plugins", width: "width", height: "height", responsive: "responsive" }, outputs: { dataSelect: "dataSelect", initialized: "initialized" }, viewQueries: [{ propertyName: "canvas", first: true, predicate: ["canvas"], descendants: true }], exportAs: ["abpChart"], usesOnChanges: true, ngImport: i0, template: `
|
|
87
|
-
<div
|
|
88
|
-
style="position:relative"
|
|
89
|
-
[style.width]="responsive && !width ? null : width"
|
|
90
|
-
[style.height]="responsive && !height ? null : height"
|
|
91
|
-
>
|
|
92
|
-
<canvas
|
|
93
|
-
#canvas
|
|
94
|
-
[attr.width]="responsive && !width ? null : width"
|
|
95
|
-
[attr.height]="responsive && !height ? null : height"
|
|
96
|
-
(click)="onCanvasClick($event)"
|
|
97
|
-
></canvas>
|
|
98
|
-
</div>
|
|
99
|
-
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
100
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: ChartComponent, decorators: [{
|
|
101
|
-
type: Component,
|
|
102
|
-
args: [{
|
|
103
|
-
selector: 'abp-chart',
|
|
104
|
-
template: `
|
|
105
|
-
<div
|
|
106
|
-
style="position:relative"
|
|
107
|
-
[style.width]="responsive && !width ? null : width"
|
|
108
|
-
[style.height]="responsive && !height ? null : height"
|
|
109
|
-
>
|
|
110
|
-
<canvas
|
|
111
|
-
#canvas
|
|
112
|
-
[attr.width]="responsive && !width ? null : width"
|
|
113
|
-
[attr.height]="responsive && !height ? null : height"
|
|
114
|
-
(click)="onCanvasClick($event)"
|
|
115
|
-
></canvas>
|
|
116
|
-
</div>
|
|
117
|
-
`,
|
|
118
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
119
|
-
exportAs: 'abpChart',
|
|
120
|
-
}]
|
|
121
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { type: [{
|
|
122
|
-
type: Input
|
|
123
|
-
}], data: [{
|
|
124
|
-
type: Input
|
|
125
|
-
}], options: [{
|
|
126
|
-
type: Input
|
|
127
|
-
}], plugins: [{
|
|
128
|
-
type: Input
|
|
129
|
-
}], width: [{
|
|
130
|
-
type: Input
|
|
131
|
-
}], height: [{
|
|
132
|
-
type: Input
|
|
133
|
-
}], responsive: [{
|
|
134
|
-
type: Input
|
|
135
|
-
}], dataSelect: [{
|
|
136
|
-
type: Output
|
|
137
|
-
}], initialized: [{
|
|
138
|
-
type: Output
|
|
139
|
-
}], canvas: [{
|
|
140
|
-
type: ViewChild,
|
|
141
|
-
args: ['canvas']
|
|
5
|
+
let Chart;
|
|
6
|
+
class ChartComponent {
|
|
7
|
+
constructor(el, cdr) {
|
|
8
|
+
this.el = el;
|
|
9
|
+
this.cdr = cdr;
|
|
10
|
+
this.data = {};
|
|
11
|
+
this.options = {};
|
|
12
|
+
this.plugins = [];
|
|
13
|
+
this.responsive = true;
|
|
14
|
+
this.dataSelect = new EventEmitter();
|
|
15
|
+
this.initialized = new EventEmitter();
|
|
16
|
+
this.initChart = () => {
|
|
17
|
+
const opts = this.options || {};
|
|
18
|
+
opts.responsive = this.responsive;
|
|
19
|
+
// allows chart to resize in responsive mode
|
|
20
|
+
if (opts.responsive && (this.height || this.width)) {
|
|
21
|
+
opts.maintainAspectRatio = false;
|
|
22
|
+
}
|
|
23
|
+
this.chart = new Chart(this.canvas.nativeElement, {
|
|
24
|
+
type: this.type,
|
|
25
|
+
data: this.data,
|
|
26
|
+
options: this.options,
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
this.getCanvas = () => {
|
|
30
|
+
return this.canvas.nativeElement;
|
|
31
|
+
};
|
|
32
|
+
this.getBase64Image = () => {
|
|
33
|
+
return this.chart.toBase64Image();
|
|
34
|
+
};
|
|
35
|
+
this.generateLegend = () => {
|
|
36
|
+
if (this.chart) {
|
|
37
|
+
return this.chart.generateLegend();
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
this.refresh = () => {
|
|
41
|
+
if (this.chart) {
|
|
42
|
+
this.chart.update();
|
|
43
|
+
this.cdr.detectChanges();
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
this.reinit = () => {
|
|
47
|
+
if (!this.chart)
|
|
48
|
+
return;
|
|
49
|
+
this.chart.destroy();
|
|
50
|
+
this.initChart();
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
ngAfterViewInit() {
|
|
54
|
+
import('chart.js/auto').then(module => {
|
|
55
|
+
Chart = module.default;
|
|
56
|
+
this.initChart();
|
|
57
|
+
this.initialized.emit(true);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
onCanvasClick(event) {
|
|
61
|
+
if (this.chart) {
|
|
62
|
+
const element = this.chart.getElementsAtEventForMode(event, 'nearest', { intersect: true }, false);
|
|
63
|
+
const dataset = this.chart.getElementsAtEventForMode(event, 'dataset', { intersect: true }, false);
|
|
64
|
+
if (element && element[0] && dataset) {
|
|
65
|
+
this.dataSelect.emit({ originalEvent: event, element: element[0], dataset: dataset });
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
ngOnDestroy() {
|
|
70
|
+
if (this.chart) {
|
|
71
|
+
this.chart.destroy();
|
|
72
|
+
this.chart = null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
ngOnChanges(changes) {
|
|
76
|
+
var _a, _b;
|
|
77
|
+
if (!this.chart)
|
|
78
|
+
return;
|
|
79
|
+
if (((_a = changes.data) === null || _a === void 0 ? void 0 : _a.currentValue) || ((_b = changes.options) === null || _b === void 0 ? void 0 : _b.currentValue)) {
|
|
80
|
+
this.chart.destroy();
|
|
81
|
+
this.initChart();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
ChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: ChartComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
86
|
+
ChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.13", type: ChartComponent, selector: "abp-chart", inputs: { type: "type", data: "data", options: "options", plugins: "plugins", width: "width", height: "height", responsive: "responsive" }, outputs: { dataSelect: "dataSelect", initialized: "initialized" }, viewQueries: [{ propertyName: "canvas", first: true, predicate: ["canvas"], descendants: true }], exportAs: ["abpChart"], usesOnChanges: true, ngImport: i0, template: `
|
|
87
|
+
<div
|
|
88
|
+
style="position:relative"
|
|
89
|
+
[style.width]="responsive && !width ? null : width"
|
|
90
|
+
[style.height]="responsive && !height ? null : height"
|
|
91
|
+
>
|
|
92
|
+
<canvas
|
|
93
|
+
#canvas
|
|
94
|
+
[attr.width]="responsive && !width ? null : width"
|
|
95
|
+
[attr.height]="responsive && !height ? null : height"
|
|
96
|
+
(click)="onCanvasClick($event)"
|
|
97
|
+
></canvas>
|
|
98
|
+
</div>
|
|
99
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
100
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: ChartComponent, decorators: [{
|
|
101
|
+
type: Component,
|
|
102
|
+
args: [{
|
|
103
|
+
selector: 'abp-chart',
|
|
104
|
+
template: `
|
|
105
|
+
<div
|
|
106
|
+
style="position:relative"
|
|
107
|
+
[style.width]="responsive && !width ? null : width"
|
|
108
|
+
[style.height]="responsive && !height ? null : height"
|
|
109
|
+
>
|
|
110
|
+
<canvas
|
|
111
|
+
#canvas
|
|
112
|
+
[attr.width]="responsive && !width ? null : width"
|
|
113
|
+
[attr.height]="responsive && !height ? null : height"
|
|
114
|
+
(click)="onCanvasClick($event)"
|
|
115
|
+
></canvas>
|
|
116
|
+
</div>
|
|
117
|
+
`,
|
|
118
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
119
|
+
exportAs: 'abpChart',
|
|
120
|
+
}]
|
|
121
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { type: [{
|
|
122
|
+
type: Input
|
|
123
|
+
}], data: [{
|
|
124
|
+
type: Input
|
|
125
|
+
}], options: [{
|
|
126
|
+
type: Input
|
|
127
|
+
}], plugins: [{
|
|
128
|
+
type: Input
|
|
129
|
+
}], width: [{
|
|
130
|
+
type: Input
|
|
131
|
+
}], height: [{
|
|
132
|
+
type: Input
|
|
133
|
+
}], responsive: [{
|
|
134
|
+
type: Input
|
|
135
|
+
}], dataSelect: [{
|
|
136
|
+
type: Output
|
|
137
|
+
}], initialized: [{
|
|
138
|
+
type: Output
|
|
139
|
+
}], canvas: [{
|
|
140
|
+
type: ViewChild,
|
|
141
|
+
args: ['canvas']
|
|
142
142
|
}] } });
|
|
143
143
|
|
|
144
|
-
class ChartModule {
|
|
145
|
-
}
|
|
146
|
-
ChartModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: ChartModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
147
|
-
ChartModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: ChartModule, declarations: [ChartComponent], imports: [CommonModule], exports: [ChartComponent] });
|
|
148
|
-
ChartModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: ChartModule, providers: [], imports: [[CommonModule]] });
|
|
149
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: ChartModule, decorators: [{
|
|
150
|
-
type: NgModule,
|
|
151
|
-
args: [{
|
|
152
|
-
imports: [CommonModule],
|
|
153
|
-
exports: [ChartComponent],
|
|
154
|
-
declarations: [ChartComponent],
|
|
155
|
-
providers: [],
|
|
156
|
-
}]
|
|
144
|
+
class ChartModule {
|
|
145
|
+
}
|
|
146
|
+
ChartModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: ChartModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
147
|
+
ChartModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: ChartModule, declarations: [ChartComponent], imports: [CommonModule], exports: [ChartComponent] });
|
|
148
|
+
ChartModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: ChartModule, providers: [], imports: [[CommonModule]] });
|
|
149
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: ChartModule, decorators: [{
|
|
150
|
+
type: NgModule,
|
|
151
|
+
args: [{
|
|
152
|
+
imports: [CommonModule],
|
|
153
|
+
exports: [ChartComponent],
|
|
154
|
+
declarations: [ChartComponent],
|
|
155
|
+
providers: [],
|
|
156
|
+
}]
|
|
157
157
|
}] });
|
|
158
158
|
|
|
159
|
-
function getRandomBackgroundColor(count) {
|
|
160
|
-
const colors = [];
|
|
161
|
-
for (let i = 0; i < count; i++) {
|
|
162
|
-
const r = ((i + 5) * (i + 5) * 474) % 255;
|
|
163
|
-
const g = ((i + 5) * (i + 5) * 1600) % 255;
|
|
164
|
-
const b = ((i + 5) * (i + 5) * 84065) % 255;
|
|
165
|
-
colors.push('rgba(' + r + ', ' + g + ', ' + b + ', 0.7)');
|
|
166
|
-
}
|
|
167
|
-
return colors;
|
|
159
|
+
function getRandomBackgroundColor(count) {
|
|
160
|
+
const colors = [];
|
|
161
|
+
for (let i = 0; i < count; i++) {
|
|
162
|
+
const r = ((i + 5) * (i + 5) * 474) % 255;
|
|
163
|
+
const g = ((i + 5) * (i + 5) * 1600) % 255;
|
|
164
|
+
const b = ((i + 5) * (i + 5) * 84065) % 255;
|
|
165
|
+
colors.push('rgba(' + r + ', ' + g + ', ' + b + ', 0.7)');
|
|
166
|
+
}
|
|
167
|
+
return colors;
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
/**
|
|
171
|
-
* Generated bundle index. Do not edit.
|
|
170
|
+
/**
|
|
171
|
+
* Generated bundle index. Do not edit.
|
|
172
172
|
*/
|
|
173
173
|
|
|
174
174
|
export { ChartComponent, ChartModule, getRandomBackgroundColor };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abp-ng.components-chart.js.js","sources":["../../../../packages/components/chart.js/src/chart.component.ts","../../../../packages/components/chart.js/src/chart.module.ts","../../../../packages/components/chart.js/src/widget-utils.ts","../../../../packages/components/chart.js/src/abp-ng.components-chart.js.ts"],"sourcesContent":["import {\
|
|
1
|
+
{"version":3,"file":"abp-ng.components-chart.js.js","sources":["../../../../packages/components/chart.js/src/chart.component.ts","../../../../packages/components/chart.js/src/chart.module.ts","../../../../packages/components/chart.js/src/widget-utils.ts","../../../../packages/components/chart.js/src/abp-ng.components-chart.js.ts"],"sourcesContent":["import {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n EventEmitter,\n Input,\n OnChanges,\n OnDestroy,\n Output,\n SimpleChanges,\n ViewChild,\n} from '@angular/core';\n\nlet Chart: any;\n\n@Component({\n selector: 'abp-chart',\n template: `\n <div\n style=\"position:relative\"\n [style.width]=\"responsive && !width ? null : width\"\n [style.height]=\"responsive && !height ? null : height\"\n >\n <canvas\n #canvas\n [attr.width]=\"responsive && !width ? null : width\"\n [attr.height]=\"responsive && !height ? null : height\"\n (click)=\"onCanvasClick($event)\"\n ></canvas>\n </div>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n exportAs: 'abpChart',\n})\nexport class ChartComponent implements AfterViewInit, OnDestroy, OnChanges {\n @Input() type: string;\n\n @Input() data: any = {};\n\n @Input() options: any = {};\n\n @Input() plugins: any[] = [];\n\n @Input() width: string;\n\n @Input() height: string;\n\n @Input() responsive = true;\n\n @Output() dataSelect = new EventEmitter();\n\n @Output() initialized = new EventEmitter<boolean>();\n\n @ViewChild('canvas') canvas: ElementRef<HTMLCanvasElement>;\n\n chart: any;\n\n constructor(public el: ElementRef, private cdr: ChangeDetectorRef) {}\n\n ngAfterViewInit() {\n import('chart.js/auto').then(module => {\n Chart = module.default;\n this.initChart();\n this.initialized.emit(true);\n });\n }\n\n onCanvasClick(event) {\n if (this.chart) {\n const element = this.chart.getElementsAtEventForMode(\n event,\n 'nearest',\n { intersect: true },\n false,\n );\n const dataset = this.chart.getElementsAtEventForMode(\n event,\n 'dataset',\n { intersect: true },\n false,\n );\n\n if (element && element[0] && dataset) {\n this.dataSelect.emit({ originalEvent: event, element: element[0], dataset: dataset });\n }\n }\n }\n\n private initChart = () => {\n const opts = this.options || {};\n opts.responsive = this.responsive;\n\n // allows chart to resize in responsive mode\n if (opts.responsive && (this.height || this.width)) {\n opts.maintainAspectRatio = false;\n }\n\n this.chart = new Chart(this.canvas.nativeElement, {\n type: this.type as any,\n data: this.data,\n options: this.options,\n });\n };\n\n getCanvas = () => {\n return this.canvas.nativeElement;\n };\n\n getBase64Image = () => {\n return this.chart.toBase64Image();\n };\n\n generateLegend = () => {\n if (this.chart) {\n return this.chart.generateLegend();\n }\n };\n\n refresh = () => {\n if (this.chart) {\n this.chart.update();\n this.cdr.detectChanges();\n }\n };\n\n reinit = () => {\n if (!this.chart) return;\n this.chart.destroy();\n this.initChart();\n };\n\n ngOnDestroy() {\n if (this.chart) {\n this.chart.destroy();\n this.chart = null;\n }\n }\n\n ngOnChanges(changes: SimpleChanges) {\n if (!this.chart) return;\n\n if (changes.data?.currentValue || changes.options?.currentValue) {\n this.chart.destroy();\n this.initChart();\n }\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { ChartComponent } from './chart.component';\n\n@NgModule({\n imports: [CommonModule],\n exports: [ChartComponent],\n declarations: [ChartComponent],\n providers: [],\n})\nexport class ChartModule {}\n","export function getRandomBackgroundColor(count) {\n const colors = [];\n\n for (let i = 0; i < count; i++) {\n const r = ((i + 5) * (i + 5) * 474) % 255;\n const g = ((i + 5) * (i + 5) * 1600) % 255;\n const b = ((i + 5) * (i + 5) * 84065) % 255;\n colors.push('rgba(' + r + ', ' + g + ', ' + b + ', 0.7)');\n }\n\n return colors;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAeA,IAAI,KAAU,CAAC;MAqBF,cAAc;IAuBzB,YAAmB,EAAc,EAAU,GAAsB;QAA9C,OAAE,GAAF,EAAE,CAAY;QAAU,QAAG,GAAH,GAAG,CAAmB;QApBxD,SAAI,GAAQ,EAAE,CAAC;QAEf,YAAO,GAAQ,EAAE,CAAC;QAElB,YAAO,GAAU,EAAE,CAAC;QAMpB,eAAU,GAAG,IAAI,CAAC;QAEjB,eAAU,GAAG,IAAI,YAAY,EAAE,CAAC;QAEhC,gBAAW,GAAG,IAAI,YAAY,EAAW,CAAC;QAqC5C,cAAS,GAAG;YAClB,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;YAChC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;;YAGlC,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE;gBAClD,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC;aAClC;YAED,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE;gBAChD,IAAI,EAAE,IAAI,CAAC,IAAW;gBACtB,IAAI,EAA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