@abp/ng.components 5.0.0 → 5.1.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/chart.js/package.json +5 -5
- package/{esm2015/abp-ng.components.js → esm2020/abp-ng.components.mjs} +0 -0
- package/{esm2015/chart.js/abp-ng.components-chart.js.js → esm2020/chart.js/abp-ng.components-chart.js.mjs} +0 -0
- package/{esm2015/chart.js/chart.component.js → esm2020/chart.js/chart.component.mjs} +5 -6
- package/{esm2015/chart.js/chart.module.js → esm2020/chart.js/chart.module.mjs} +5 -5
- package/{esm2015/chart.js/public-api.js → esm2020/chart.js/public-api.mjs} +0 -0
- package/{esm2015/chart.js/widget-utils.js → esm2020/chart.js/widget-utils.mjs} +0 -0
- package/{esm2015/page/abp-ng.components-page.js → esm2020/page/abp-ng.components-page.mjs} +0 -0
- package/esm2020/page/page-part.directive.mjs +76 -0
- package/{esm2015/page/page-parts.component.js → esm2020/page/page-parts.component.mjs} +10 -10
- package/esm2020/page/page.component.mjs +57 -0
- package/{esm2015/page/page.module.js → esm2020/page/page.module.mjs} +5 -5
- package/{esm2015/page/public-api.js → esm2020/page/public-api.mjs} +0 -0
- package/{esm2015/public-api.js → esm2020/public-api.mjs} +0 -0
- package/{esm2015/tree/abp-ng.components-tree.js → esm2020/tree/abp-ng.components-tree.mjs} +0 -0
- package/esm2020/tree/lib/components/tree.component.mjs +93 -0
- package/{esm2015/tree/lib/templates/expanded-icon-template.directive.js → esm2020/tree/lib/templates/expanded-icon-template.directive.mjs} +4 -4
- package/{esm2015/tree/lib/templates/tree-node-template.directive.js → esm2020/tree/lib/templates/tree-node-template.directive.mjs} +4 -4
- package/{esm2015/tree/lib/tree.module.js → esm2020/tree/lib/tree.module.mjs} +5 -5
- package/{esm2015/tree/lib/utils/nz-tree-adapter.js → esm2020/tree/lib/utils/nz-tree-adapter.mjs} +2 -2
- package/{esm2015/tree/public-api.js → esm2020/tree/public-api.mjs} +0 -0
- package/fesm2015/{abp-ng.components-chart.js.js → abp-ng.components-chart.js.mjs} +8 -8
- package/fesm2015/abp-ng.components-chart.js.mjs.map +1 -0
- package/fesm2015/abp-ng.components-page.mjs +217 -0
- package/fesm2015/abp-ng.components-page.mjs.map +1 -0
- package/fesm2015/abp-ng.components-tree.mjs +238 -0
- package/fesm2015/abp-ng.components-tree.mjs.map +1 -0
- package/fesm2015/abp-ng.components.mjs +4 -0
- package/fesm2015/abp-ng.components.mjs.map +1 -0
- package/fesm2020/abp-ng.components-chart.js.mjs +174 -0
- package/fesm2020/abp-ng.components-chart.js.mjs.map +1 -0
- package/{fesm2015/abp-ng.components-page.js → fesm2020/abp-ng.components-page.mjs} +24 -31
- package/fesm2020/abp-ng.components-page.mjs.map +1 -0
- package/fesm2020/abp-ng.components-tree.mjs +238 -0
- package/fesm2020/abp-ng.components-tree.mjs.map +1 -0
- package/{fesm2015/abp-ng.components.js → fesm2020/abp-ng.components.mjs} +1 -1
- package/fesm2020/abp-ng.components.mjs.map +1 -0
- package/package.json +46 -9
- package/page/package.json +5 -5
- package/tree/package.json +5 -5
- package/bundles/abp-ng.components-chart.js.umd.js +0 -183
- package/bundles/abp-ng.components-chart.js.umd.js.map +0 -1
- package/bundles/abp-ng.components-page.umd.js +0 -595
- package/bundles/abp-ng.components-page.umd.js.map +0 -1
- package/bundles/abp-ng.components-tree.umd.js +0 -613
- package/bundles/abp-ng.components-tree.umd.js.map +0 -1
- package/bundles/abp-ng.components.umd.js +0 -11
- package/bundles/abp-ng.components.umd.js.map +0 -1
- package/esm2015/page/page-part.directive.js +0 -79
- package/esm2015/page/page.component.js +0 -61
- package/esm2015/tree/lib/components/tree.component.js +0 -101
- package/fesm2015/abp-ng.components-chart.js.js.map +0 -1
- package/fesm2015/abp-ng.components-page.js.map +0 -1
- package/fesm2015/abp-ng.components-tree.js +0 -246
- package/fesm2015/abp-ng.components-tree.js.map +0 -1
- package/fesm2015/abp-ng.components.js.map +0 -1
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import * as i5 from '@abp/ng.core';
|
|
2
|
+
import { CoreModule } from '@abp/ng.core';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { Directive, EventEmitter, Component, ViewEncapsulation, ContentChild, Output, Input, NgModule } from '@angular/core';
|
|
5
|
+
import * as i4 from '@ng-bootstrap/ng-bootstrap';
|
|
6
|
+
import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap';
|
|
7
|
+
import * as i2 from 'ng-zorro-antd/core/no-animation';
|
|
8
|
+
import { NzNoAnimationModule } from 'ng-zorro-antd/core/no-animation';
|
|
9
|
+
import * as i1 from 'ng-zorro-antd/tree';
|
|
10
|
+
import { NzTreeModule } from 'ng-zorro-antd/tree';
|
|
11
|
+
import { of } from 'rxjs';
|
|
12
|
+
import * as i3 from '@angular/common';
|
|
13
|
+
|
|
14
|
+
class TreeNodeTemplateDirective {
|
|
15
|
+
constructor(template) {
|
|
16
|
+
this.template = template;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
TreeNodeTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: TreeNodeTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
20
|
+
TreeNodeTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: TreeNodeTemplateDirective, selector: "[abpTreeNodeTemplate],[abp-tree-node-template]", ngImport: i0 });
|
|
21
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: TreeNodeTemplateDirective, decorators: [{
|
|
22
|
+
type: Directive,
|
|
23
|
+
args: [{
|
|
24
|
+
selector: '[abpTreeNodeTemplate],[abp-tree-node-template]',
|
|
25
|
+
}]
|
|
26
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
|
|
27
|
+
|
|
28
|
+
class ExpandedIconTemplateDirective {
|
|
29
|
+
constructor(template) {
|
|
30
|
+
this.template = template;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
ExpandedIconTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ExpandedIconTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
34
|
+
ExpandedIconTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: ExpandedIconTemplateDirective, selector: "[abpTreeExpandedIconTemplate],[abp-tree-expanded-icon-template]", ngImport: i0 });
|
|
35
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ExpandedIconTemplateDirective, decorators: [{
|
|
36
|
+
type: Directive,
|
|
37
|
+
args: [{
|
|
38
|
+
selector: '[abpTreeExpandedIconTemplate],[abp-tree-expanded-icon-template]',
|
|
39
|
+
}]
|
|
40
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
|
|
41
|
+
|
|
42
|
+
class TreeComponent {
|
|
43
|
+
constructor() {
|
|
44
|
+
this.dropdowns = {};
|
|
45
|
+
this.checkedKeysChange = new EventEmitter();
|
|
46
|
+
this.expandedKeysChange = new EventEmitter();
|
|
47
|
+
this.selectedNodeChange = new EventEmitter();
|
|
48
|
+
this.dropOver = new EventEmitter();
|
|
49
|
+
this.noAnimation = true;
|
|
50
|
+
this.checkedKeys = [];
|
|
51
|
+
this.nodes = [];
|
|
52
|
+
this.expandedKeys = [];
|
|
53
|
+
this.isNodeSelected = node => { var _a; return ((_a = this.selectedNode) === null || _a === void 0 ? void 0 : _a.id) === node.key; };
|
|
54
|
+
this.beforeDrop = (event) => {
|
|
55
|
+
this.dropPosition = event.pos;
|
|
56
|
+
return of(false);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
onSelectedNodeChange(node) {
|
|
60
|
+
this.selectedNode = node.origin.entity;
|
|
61
|
+
this.selectedNodeChange.emit(node.origin.entity);
|
|
62
|
+
}
|
|
63
|
+
onCheckboxChange(event) {
|
|
64
|
+
this.checkedKeys = [...event.keys];
|
|
65
|
+
this.checkedKeysChange.emit(event.keys);
|
|
66
|
+
}
|
|
67
|
+
onExpandedKeysChange(event) {
|
|
68
|
+
this.expandedKeys = [...event.keys];
|
|
69
|
+
this.expandedKeysChange.emit(event.keys);
|
|
70
|
+
}
|
|
71
|
+
onDrop(event) {
|
|
72
|
+
event.event.stopPropagation();
|
|
73
|
+
event.event.preventDefault();
|
|
74
|
+
event.pos = this.dropPosition;
|
|
75
|
+
this.dropOver.emit(event);
|
|
76
|
+
}
|
|
77
|
+
initDropdown(key, dropdown) {
|
|
78
|
+
this.dropdowns[key] = dropdown;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
TreeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: TreeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
82
|
+
TreeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: TreeComponent, selector: "abp-tree", inputs: { noAnimation: "noAnimation", draggable: "draggable", checkable: "checkable", checkStrictly: "checkStrictly", checkedKeys: "checkedKeys", nodes: "nodes", expandedKeys: "expandedKeys", selectedNode: "selectedNode", isNodeSelected: "isNodeSelected", beforeDrop: "beforeDrop" }, outputs: { checkedKeysChange: "checkedKeysChange", expandedKeysChange: "expandedKeysChange", selectedNodeChange: "selectedNodeChange", dropOver: "dropOver" }, queries: [{ propertyName: "menu", first: true, predicate: ["menu"], descendants: true }, { propertyName: "customNodeTemplate", first: true, predicate: TreeNodeTemplateDirective, descendants: true }, { propertyName: "expandedIconTemplate", first: true, predicate: ExpandedIconTemplateDirective, descendants: true }], ngImport: i0, template: "<nz-tree\r\n [nzBeforeDrop]=\"beforeDrop\"\r\n [nzDraggable]=\"draggable\"\r\n [nzCheckStrictly]=\"checkStrictly\"\r\n [nzCheckable]=\"checkable\"\r\n [nzCheckedKeys]=\"checkedKeys\"\r\n [nzData]=\"nodes\"\r\n [nzTreeTemplate]=\"treeTemplate\"\r\n [nzExpandedKeys]=\"expandedKeys\"\r\n [nzExpandedIcon]=\"expandedIconTemplate?.template || defaultIconTemplate\"\r\n (nzExpandChange)=\"onExpandedKeysChange($event)\"\r\n (nzCheckBoxChange)=\"onCheckboxChange($event)\"\r\n (nzOnDrop)=\"onDrop($event)\"\r\n [nzNoAnimation]=\"noAnimation\"\r\n (nzContextMenu)=\"dropdowns[$event.node?.key]?.toggle()\"\r\n></nz-tree>\r\n<ng-template #treeTemplate let-node>\r\n <div\r\n class=\"node-wrapper\"\r\n [class.selected]=\"isNodeSelected(node)\"\r\n [title]=\"node.title\"\r\n (click)=\"onSelectedNodeChange(node)\"\r\n >\r\n <ng-container *ngTemplateOutlet=\"nodeTemplate; context: { $implicit: node }\"></ng-container>\r\n\r\n <ng-template #nodeTemplate let-node>\r\n <div class=\"d-inline-block\">\r\n <ng-container\r\n *ngTemplateOutlet=\"\r\n customNodeTemplate ? customNodeTemplate?.template : defaultNodeTemplate;\r\n context: { $implicit: node }\r\n \"\r\n ></ng-container>\r\n </div>\r\n\r\n <div\r\n #dropdown=\"ngbDropdown\"\r\n *ngIf=\"menu\"\r\n class=\"d-inline-block ms-1\"\r\n ngbDropdown\r\n placement=\"bottom\"\r\n container=\"body\"\r\n (abpInit)=\"initDropdown(node.key, dropdown)\"\r\n >\r\n <i\r\n class=\"fas fa-caret-down text-muted\"\r\n ngbDropdownToggle\r\n [class.dropdown-toggle]=\"false\"\r\n ></i>\r\n <div ngbDropdownMenu>\r\n <ng-template *ngTemplateOutlet=\"menu; context: { $implicit: node }\"></ng-template>\r\n </div>\r\n </div>\r\n </ng-template>\r\n\r\n <ng-template #defaultNodeTemplate let-node>\r\n <span>{{ node.title }}</span>\r\n </ng-template>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #defaultIconTemplate let-node let-origin=\"origin\">\r\n <i style=\"line-height: 28px\" aria-hidden=\"true\">\r\n <ng-container *ngTemplateOutlet=\"node.isExpanded ? minusIcon : plusIcon\"></ng-container\r\n ></i>\r\n</ng-template>\r\n\r\n<ng-template #minusIcon>\r\n <svg\r\n width=\"15\"\r\n height=\"15\"\r\n viewBox=\"0 0 24 24\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n fill-rule=\"evenodd\"\r\n clip-rule=\"evenodd\"\r\n >\r\n <path\r\n d=\"M11.5 0c6.347 0 11.5 5.153 11.5 11.5s-5.153 11.5-11.5 11.5-11.5-5.153-11.5-11.5 5.153-11.5 11.5-11.5zm0 1c5.795 0 10.5 4.705 10.5 10.5s-4.705 10.5-10.5 10.5-10.5-4.705-10.5-10.5 4.705-10.5 10.5-10.5zm-6.5 10h13v1h-13v-1z\"\r\n />\r\n </svg>\r\n</ng-template>\r\n\r\n<ng-template #plusIcon>\r\n <svg\r\n width=\"15\"\r\n height=\"15\"\r\n viewBox=\"0 0 24 24\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n fill-rule=\"evenodd\"\r\n clip-rule=\"evenodd\"\r\n >\r\n <path\r\n d=\"M11.5 0c6.347 0 11.5 5.153 11.5 11.5s-5.153 11.5-11.5 11.5-11.5-5.153-11.5-11.5 5.153-11.5 11.5-11.5zm0 1c5.795 0 10.5 4.705 10.5 10.5s-4.705 10.5-10.5 10.5-10.5-4.705-10.5-10.5 4.705-10.5 10.5-10.5zm.5 10h6v1h-6v6h-1v-6h-6v-1h6v-6h1v6z\"\r\n />\r\n </svg>\r\n</ng-template>\r\n", styles: [".ant-tree-checkbox,.ant-tree-checkbox-wrapper{box-sizing:border-box;padding:0;font-size:14px;font-variant:tabular-nums;list-style:none;font-feature-settings:\"tnum\",\"tnum\"}@keyframes antCheckboxEffect{0%{transform:scale(1);opacity:.5}to{transform:scale(1.6);opacity:0}}@keyframes ant-tree-node-fx-do-not-use{0%{opacity:0}to{opacity:1}}.ant-tree.ant-tree-directory .ant-tree-treenode{position:relative}.ant-tree.ant-tree-directory .ant-tree-treenode:before{position:absolute;top:0;right:0;bottom:4px;left:0;transition:background-color .3s;content:\"\";pointer-events:none}.ant-tree.ant-tree-directory .ant-tree-treenode:hover:before{background:#f5f5f5}.ant-tree.ant-tree-directory .ant-tree-treenode>*{z-index:1}.ant-tree.ant-tree-directory .ant-tree-treenode .ant-tree-switcher{transition:color .3s}.ant-tree.ant-tree-directory .ant-tree-treenode .ant-tree-node-content-wrapper{border-radius:0;-webkit-user-select:none;user-select:none}.ant-tree.ant-tree-directory .ant-tree-treenode .ant-tree-node-content-wrapper:hover{background:0 0}.ant-tree.ant-tree-directory .ant-tree-treenode .ant-tree-node-content-wrapper.ant-tree-node-selected{color:#fff;background:0 0}.ant-tree.ant-tree-directory .ant-tree-treenode-selected:before,.ant-tree.ant-tree-directory .ant-tree-treenode-selected:hover:before{background:#1890ff}.ant-tree.ant-tree-directory .ant-tree-treenode-selected .ant-tree-switcher{color:#fff}.ant-tree.ant-tree-directory .ant-tree-treenode-selected .ant-tree-node-content-wrapper{color:#fff;background:0 0}.ant-tree-checkbox{color:#000000d9;position:relative;line-height:1;white-space:nowrap;outline:0;cursor:pointer}.ant-tree-checkbox-input:focus+.ant-tree-checkbox-inner,.ant-tree-checkbox-wrapper:hover .ant-tree-checkbox-inner,.ant-tree-checkbox:hover .ant-tree-checkbox-inner{border-color:#1890ff}.ant-tree-checkbox-checked:after{position:absolute;top:0;left:0;width:100%;height:100%;border:1px solid #1890ff;border-radius:2px;visibility:hidden;animation:antCheckboxEffect .36s ease-in-out;animation-fill-mode:backwards;content:\"\"}.ant-tree-checkbox-wrapper:hover .ant-tree-checkbox:after,.ant-tree-checkbox:hover:after{visibility:visible}.ant-tree-checkbox-inner{position:relative;top:0;left:0;display:block;width:16px;height:16px;direction:ltr;background-color:#fff;border:1px solid #d9d9d9;border-radius:2px;border-collapse:separate;transition:all .3s}.ant-tree-checkbox-inner:after{position:absolute;top:50%;left:21.5%;display:table;width:5.71px;height:9.14px;border:2px solid #fff;border-top:0;border-left:0;transform:rotate(45deg) scale(0) translate(-50%,-50%);opacity:0;transition:all .1s cubic-bezier(.71,-.46,.88,.6),opacity .1s;content:\" \"}.ant-tree-checkbox-input{position:absolute;top:0;right:0;bottom:0;left:0;z-index:1;width:100%;height:100%;cursor:pointer;opacity:0}.ant-tree-checkbox-disabled,.ant-tree-checkbox-disabled .ant-tree-checkbox-input,.ant-tree-checkbox-disabled+span{cursor:not-allowed}.ant-tree-checkbox-checked .ant-tree-checkbox-inner:after{position:absolute;display:table;border:2px solid #fff;border-top:0;border-left:0;transform:rotate(45deg) scale(1) translate(-50%,-50%);opacity:1;transition:all .2s cubic-bezier(.12,.4,.29,1.46) .1s;content:\" \"}.ant-tree-checkbox-checked .ant-tree-checkbox-inner{background-color:#1890ff;border-color:#1890ff}.ant-tree-checkbox-disabled.ant-tree-checkbox-checked .ant-tree-checkbox-inner:after{border-color:#00000040;animation-name:none}.ant-tree-checkbox-disabled .ant-tree-checkbox-inner{background-color:#f5f5f5;border-color:#d9d9d9!important}.ant-tree-checkbox-disabled .ant-tree-checkbox-inner:after{border-color:#f5f5f5;border-collapse:separate;animation-name:none}.ant-tree-checkbox-disabled+span{color:#00000040}.ant-tree-checkbox-disabled:hover:after,.ant-tree-checkbox-wrapper:hover .ant-tree-checkbox-disabled:after{visibility:hidden}.ant-tree-checkbox-wrapper{margin:0;color:#000000d9;display:inline-flex;align-items:baseline;line-height:unset;cursor:pointer}.ant-tree-checkbox-wrapper:after{display:inline-block;width:0;overflow:hidden;content:\"\\a0\"}.ant-tree-checkbox-wrapper.ant-tree-checkbox-wrapper-disabled{cursor:not-allowed}.ant-tree-checkbox-wrapper+.ant-tree-checkbox-wrapper{margin-left:8px}.ant-tree-checkbox+span{padding-right:8px;padding-left:8px}.ant-tree,.ant-tree-checkbox-group{box-sizing:border-box;padding:0;color:#000000d9;font-size:14px;font-variant:tabular-nums;line-height:1.5715;list-style:none;font-feature-settings:\"tnum\",\"tnum\"}.ant-tree-checkbox-group{margin:0;display:inline-block}.ant-tree-checkbox-group-item{margin-right:8px}.ant-tree-checkbox-group-item:last-child{margin-right:0}.ant-tree-checkbox-group-item+.ant-tree-checkbox-group-item{margin-left:0}.ant-tree-checkbox-indeterminate .ant-tree-checkbox-inner{background-color:#fff;border-color:#d9d9d9}.ant-tree-checkbox-indeterminate .ant-tree-checkbox-inner:after{top:50%;left:50%;width:8px;height:8px;background-color:#1890ff;border:0;transform:translate(-50%,-50%) scale(1);opacity:1;content:\" \"}.ant-tree-checkbox-indeterminate.ant-tree-checkbox-disabled .ant-tree-checkbox-inner:after{background-color:#00000040;border-color:#00000040}.ant-tree{margin:0;background:#fff;border-radius:2px;transition:background-color .3s}.ant-tree-focused:not(:hover):not(.ant-tree-active-focused){background:#e6f7ff}.ant-tree-list-holder-inner{align-items:flex-start}.ant-tree.ant-tree-block-node .ant-tree-list-holder-inner{align-items:stretch}.ant-tree.ant-tree-block-node .ant-tree-list-holder-inner .ant-tree-node-content-wrapper{flex:auto}.ant-tree.ant-tree-block-node .ant-tree-list-holder-inner .ant-tree-treenode.dragging{position:relative}.ant-tree.ant-tree-block-node .ant-tree-list-holder-inner .ant-tree-treenode.dragging:after{position:absolute;top:0;right:0;bottom:4px;left:0;border:1px solid #1890ff;opacity:0;animation:ant-tree-node-fx-do-not-use .3s;animation-play-state:running;animation-fill-mode:forwards;content:\"\";pointer-events:none}.ant-tree .ant-tree-treenode{display:flex;align-items:flex-start;padding:0 0 4px;outline:0}.ant-tree .ant-tree-treenode-disabled .ant-tree-node-content-wrapper{color:#00000040;cursor:not-allowed}.ant-tree .ant-tree-treenode-disabled .ant-tree-node-content-wrapper:hover{background:0 0}.ant-tree .ant-tree-treenode-active .ant-tree-node-content-wrapper{background:#f5f5f5}.ant-tree .ant-tree-treenode:not(.ant-tree .ant-tree-treenode-disabled).filter-node .ant-tree-title{color:inherit;font-weight:500}.ant-tree-indent{align-self:stretch;white-space:nowrap;-webkit-user-select:none;user-select:none}.ant-tree-indent-unit{display:inline-block;width:24px}.ant-tree-draggable-icon{width:24px;line-height:24px;text-align:center;opacity:.2;transition:opacity .3s}.ant-tree-treenode:hover .ant-tree-draggable-icon{opacity:.45}.ant-tree-switcher{position:relative;flex:none;align-self:stretch;width:24px;margin:0;line-height:24px;text-align:center;cursor:pointer;-webkit-user-select:none;user-select:none}.ant-tree-switcher .ant-select-tree-switcher-icon,.ant-tree-switcher .ant-tree-switcher-icon{display:inline-block;font-size:10px;vertical-align:baseline}.ant-tree-switcher .ant-select-tree-switcher-icon svg,.ant-tree-switcher .ant-tree-switcher-icon svg{transition:transform .3s}.ant-tree-switcher-noop{cursor:default}.ant-tree-switcher_close .ant-tree-switcher-icon svg{transform:rotate(-90deg)}.ant-tree-switcher-loading-icon{color:#1890ff}.ant-tree-switcher-leaf-line{position:relative;z-index:1;display:inline-block;width:100%;height:100%}.ant-tree-switcher-leaf-line:before{position:absolute;top:0;right:12px;bottom:-4px;margin-left:-1px;border-right:1px solid #d9d9d9;content:\" \"}.ant-tree-switcher-leaf-line:after{position:absolute;width:10px;height:14px;border-bottom:1px solid #d9d9d9;content:\" \"}.ant-tree-checkbox{top:initial;margin:4px 8px 0 0}.ant-tree .ant-tree-node-content-wrapper{position:relative;z-index:auto;min-height:24px;margin:0;padding:0 4px;color:inherit;line-height:24px;background:0 0;border-radius:2px;cursor:pointer;transition:all .3s,border 0s,line-height 0s,box-shadow 0s}.ant-tree .ant-tree-node-content-wrapper:hover{background-color:#f5f5f5}.ant-tree .ant-tree-node-content-wrapper.ant-tree-node-selected{background-color:#bae7ff}.ant-tree .ant-tree-node-content-wrapper .ant-tree-iconEle{display:inline-block;width:24px;height:24px;line-height:24px;text-align:center;vertical-align:top}.ant-tree .ant-tree-node-content-wrapper .ant-tree-iconEle:empty,.ant-tree-show-line .ant-tree-indent-unit-end:before{display:none}.ant-tree-unselectable .ant-tree-node-content-wrapper:hover{background-color:transparent}.ant-tree-node-content-wrapper{line-height:24px;-webkit-user-select:none;user-select:none}.ant-tree-node-content-wrapper .ant-tree-drop-indicator{position:absolute;z-index:1;height:2px;background-color:#1890ff;border-radius:1px;pointer-events:none}.ant-tree-node-content-wrapper .ant-tree-drop-indicator:after{position:absolute;top:-3px;left:-6px;width:8px;height:8px;background-color:transparent;border:2px solid #1890ff;border-radius:50%;content:\"\"}.ant-tree .ant-tree-treenode.drop-container>[draggable]{box-shadow:0 0 0 2px #1890ff}.ant-tree-show-line .ant-tree-indent-unit{position:relative;height:100%}.ant-tree-show-line .ant-tree-indent-unit:before{position:absolute;top:0;right:12px;bottom:-4px;border-right:1px solid #d9d9d9;content:\"\"}.ant-tree-show-line .ant-tree-switcher{background:#fff}.ant-tree-show-line .ant-tree-switcher-line-icon{vertical-align:-.15em}.ant-tree .ant-tree-treenode-leaf-last .ant-tree-switcher-leaf-line:before{top:auto!important;bottom:auto!important;height:14px!important}.ant-tree-rtl{direction:rtl}.ant-tree-rtl .ant-tree-node-content-wrapper[draggable=true] .ant-tree-drop-indicator:after{right:-6px;left:unset}.ant-tree .ant-tree-treenode-rtl{direction:rtl}.ant-tree-rtl .ant-tree-switcher_close .ant-tree-switcher-icon svg{transform:rotate(90deg)}.ant-tree-rtl.ant-tree-show-line .ant-tree-indent-unit:before{right:auto;left:-13px;border-right:none;border-left:1px solid #d9d9d9}.ant-tree-rtl.ant-tree-checkbox,.ant-tree-select-dropdown-rtl .ant-select-tree-checkbox{margin:4px 0 0 8px}.font-highlight{color:#ff4d4f}.ant-tree-child-tree{overflow:hidden}nz-tree{display:block}\n", ".ant-tree{color:inherit}.ant-tree .ant-tree-node-content-wrapper.ant-tree-node-selected{background-color:transparent}.ant-tree .ant-tree-switcher{line-height:17px}.ant-tree .ant-tree-node-content-wrapper{width:100%;padding:0}.ant-tree .node-wrapper{width:100%;position:relative;display:inline-block;margin:0;line-height:30px;text-decoration:none;vertical-align:top;border-radius:2px;cursor:pointer;padding:0 5px 0 8px;border:1px solid transparent}.ant-tree .ellipsis{position:absolute;right:8px;top:1px;cursor:pointer}\n"], components: [{ type: i1.NzTreeComponent, selector: "nz-tree", inputs: ["nzShowIcon", "nzHideUnMatched", "nzBlockNode", "nzExpandAll", "nzSelectMode", "nzCheckStrictly", "nzShowExpand", "nzShowLine", "nzCheckable", "nzAsyncData", "nzDraggable", "nzMultiple", "nzExpandedIcon", "nzVirtualItemSize", "nzVirtualMaxBufferPx", "nzVirtualMinBufferPx", "nzVirtualHeight", "nzTreeTemplate", "nzBeforeDrop", "nzData", "nzExpandedKeys", "nzSelectedKeys", "nzCheckedKeys", "nzSearchValue", "nzSearchFunc"], outputs: ["nzExpandedKeysChange", "nzSelectedKeysChange", "nzCheckedKeysChange", "nzSearchValueChange", "nzClick", "nzDblClick", "nzContextMenu", "nzCheckBoxChange", "nzExpandChange", "nzOnDragStart", "nzOnDragEnter", "nzOnDragOver", "nzOnDragLeave", "nzOnDrop", "nzOnDragEnd"], exportAs: ["nzTree"] }], directives: [{ type: i2.NzNoAnimationDirective, selector: "[nzNoAnimation]", inputs: ["nzNoAnimation"], exportAs: ["nzNoAnimation"] }, { type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgbDropdown, selector: "[ngbDropdown]", inputs: ["autoClose", "dropdownClass", "open", "placement", "container", "display"], outputs: ["openChange"], exportAs: ["ngbDropdown"] }, { type: i5.InitDirective, selector: "[abpInit]", outputs: ["abpInit"] }, { type: i4.NgbDropdownToggle, selector: "[ngbDropdownToggle]" }, { type: i4.NgbDropdownMenu, selector: "[ngbDropdownMenu]" }], encapsulation: i0.ViewEncapsulation.None });
|
|
83
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: TreeComponent, decorators: [{
|
|
84
|
+
type: Component,
|
|
85
|
+
args: [{ selector: 'abp-tree', encapsulation: ViewEncapsulation.None, template: "<nz-tree\r\n [nzBeforeDrop]=\"beforeDrop\"\r\n [nzDraggable]=\"draggable\"\r\n [nzCheckStrictly]=\"checkStrictly\"\r\n [nzCheckable]=\"checkable\"\r\n [nzCheckedKeys]=\"checkedKeys\"\r\n [nzData]=\"nodes\"\r\n [nzTreeTemplate]=\"treeTemplate\"\r\n [nzExpandedKeys]=\"expandedKeys\"\r\n [nzExpandedIcon]=\"expandedIconTemplate?.template || defaultIconTemplate\"\r\n (nzExpandChange)=\"onExpandedKeysChange($event)\"\r\n (nzCheckBoxChange)=\"onCheckboxChange($event)\"\r\n (nzOnDrop)=\"onDrop($event)\"\r\n [nzNoAnimation]=\"noAnimation\"\r\n (nzContextMenu)=\"dropdowns[$event.node?.key]?.toggle()\"\r\n></nz-tree>\r\n<ng-template #treeTemplate let-node>\r\n <div\r\n class=\"node-wrapper\"\r\n [class.selected]=\"isNodeSelected(node)\"\r\n [title]=\"node.title\"\r\n (click)=\"onSelectedNodeChange(node)\"\r\n >\r\n <ng-container *ngTemplateOutlet=\"nodeTemplate; context: { $implicit: node }\"></ng-container>\r\n\r\n <ng-template #nodeTemplate let-node>\r\n <div class=\"d-inline-block\">\r\n <ng-container\r\n *ngTemplateOutlet=\"\r\n customNodeTemplate ? customNodeTemplate?.template : defaultNodeTemplate;\r\n context: { $implicit: node }\r\n \"\r\n ></ng-container>\r\n </div>\r\n\r\n <div\r\n #dropdown=\"ngbDropdown\"\r\n *ngIf=\"menu\"\r\n class=\"d-inline-block ms-1\"\r\n ngbDropdown\r\n placement=\"bottom\"\r\n container=\"body\"\r\n (abpInit)=\"initDropdown(node.key, dropdown)\"\r\n >\r\n <i\r\n class=\"fas fa-caret-down text-muted\"\r\n ngbDropdownToggle\r\n [class.dropdown-toggle]=\"false\"\r\n ></i>\r\n <div ngbDropdownMenu>\r\n <ng-template *ngTemplateOutlet=\"menu; context: { $implicit: node }\"></ng-template>\r\n </div>\r\n </div>\r\n </ng-template>\r\n\r\n <ng-template #defaultNodeTemplate let-node>\r\n <span>{{ node.title }}</span>\r\n </ng-template>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #defaultIconTemplate let-node let-origin=\"origin\">\r\n <i style=\"line-height: 28px\" aria-hidden=\"true\">\r\n <ng-container *ngTemplateOutlet=\"node.isExpanded ? minusIcon : plusIcon\"></ng-container\r\n ></i>\r\n</ng-template>\r\n\r\n<ng-template #minusIcon>\r\n <svg\r\n width=\"15\"\r\n height=\"15\"\r\n viewBox=\"0 0 24 24\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n fill-rule=\"evenodd\"\r\n clip-rule=\"evenodd\"\r\n >\r\n <path\r\n d=\"M11.5 0c6.347 0 11.5 5.153 11.5 11.5s-5.153 11.5-11.5 11.5-11.5-5.153-11.5-11.5 5.153-11.5 11.5-11.5zm0 1c5.795 0 10.5 4.705 10.5 10.5s-4.705 10.5-10.5 10.5-10.5-4.705-10.5-10.5 4.705-10.5 10.5-10.5zm-6.5 10h13v1h-13v-1z\"\r\n />\r\n </svg>\r\n</ng-template>\r\n\r\n<ng-template #plusIcon>\r\n <svg\r\n width=\"15\"\r\n height=\"15\"\r\n viewBox=\"0 0 24 24\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n fill-rule=\"evenodd\"\r\n clip-rule=\"evenodd\"\r\n >\r\n <path\r\n d=\"M11.5 0c6.347 0 11.5 5.153 11.5 11.5s-5.153 11.5-11.5 11.5-11.5-5.153-11.5-11.5 5.153-11.5 11.5-11.5zm0 1c5.795 0 10.5 4.705 10.5 10.5s-4.705 10.5-10.5 10.5-10.5-4.705-10.5-10.5 4.705-10.5 10.5-10.5zm.5 10h6v1h-6v6h-1v-6h-6v-1h6v-6h1v6z\"\r\n />\r\n </svg>\r\n</ng-template>\r\n", styles: [".ant-tree-checkbox,.ant-tree-checkbox-wrapper{box-sizing:border-box;padding:0;font-size:14px;font-variant:tabular-nums;list-style:none;font-feature-settings:\"tnum\",\"tnum\"}@keyframes antCheckboxEffect{0%{transform:scale(1);opacity:.5}to{transform:scale(1.6);opacity:0}}@keyframes ant-tree-node-fx-do-not-use{0%{opacity:0}to{opacity:1}}.ant-tree.ant-tree-directory .ant-tree-treenode{position:relative}.ant-tree.ant-tree-directory .ant-tree-treenode:before{position:absolute;top:0;right:0;bottom:4px;left:0;transition:background-color .3s;content:\"\";pointer-events:none}.ant-tree.ant-tree-directory .ant-tree-treenode:hover:before{background:#f5f5f5}.ant-tree.ant-tree-directory .ant-tree-treenode>*{z-index:1}.ant-tree.ant-tree-directory .ant-tree-treenode .ant-tree-switcher{transition:color .3s}.ant-tree.ant-tree-directory .ant-tree-treenode .ant-tree-node-content-wrapper{border-radius:0;-webkit-user-select:none;user-select:none}.ant-tree.ant-tree-directory .ant-tree-treenode .ant-tree-node-content-wrapper:hover{background:0 0}.ant-tree.ant-tree-directory .ant-tree-treenode .ant-tree-node-content-wrapper.ant-tree-node-selected{color:#fff;background:0 0}.ant-tree.ant-tree-directory .ant-tree-treenode-selected:before,.ant-tree.ant-tree-directory .ant-tree-treenode-selected:hover:before{background:#1890ff}.ant-tree.ant-tree-directory .ant-tree-treenode-selected .ant-tree-switcher{color:#fff}.ant-tree.ant-tree-directory .ant-tree-treenode-selected .ant-tree-node-content-wrapper{color:#fff;background:0 0}.ant-tree-checkbox{color:#000000d9;position:relative;line-height:1;white-space:nowrap;outline:0;cursor:pointer}.ant-tree-checkbox-input:focus+.ant-tree-checkbox-inner,.ant-tree-checkbox-wrapper:hover .ant-tree-checkbox-inner,.ant-tree-checkbox:hover .ant-tree-checkbox-inner{border-color:#1890ff}.ant-tree-checkbox-checked:after{position:absolute;top:0;left:0;width:100%;height:100%;border:1px solid #1890ff;border-radius:2px;visibility:hidden;animation:antCheckboxEffect .36s ease-in-out;animation-fill-mode:backwards;content:\"\"}.ant-tree-checkbox-wrapper:hover .ant-tree-checkbox:after,.ant-tree-checkbox:hover:after{visibility:visible}.ant-tree-checkbox-inner{position:relative;top:0;left:0;display:block;width:16px;height:16px;direction:ltr;background-color:#fff;border:1px solid #d9d9d9;border-radius:2px;border-collapse:separate;transition:all .3s}.ant-tree-checkbox-inner:after{position:absolute;top:50%;left:21.5%;display:table;width:5.71px;height:9.14px;border:2px solid #fff;border-top:0;border-left:0;transform:rotate(45deg) scale(0) translate(-50%,-50%);opacity:0;transition:all .1s cubic-bezier(.71,-.46,.88,.6),opacity .1s;content:\" \"}.ant-tree-checkbox-input{position:absolute;top:0;right:0;bottom:0;left:0;z-index:1;width:100%;height:100%;cursor:pointer;opacity:0}.ant-tree-checkbox-disabled,.ant-tree-checkbox-disabled .ant-tree-checkbox-input,.ant-tree-checkbox-disabled+span{cursor:not-allowed}.ant-tree-checkbox-checked .ant-tree-checkbox-inner:after{position:absolute;display:table;border:2px solid #fff;border-top:0;border-left:0;transform:rotate(45deg) scale(1) translate(-50%,-50%);opacity:1;transition:all .2s cubic-bezier(.12,.4,.29,1.46) .1s;content:\" \"}.ant-tree-checkbox-checked .ant-tree-checkbox-inner{background-color:#1890ff;border-color:#1890ff}.ant-tree-checkbox-disabled.ant-tree-checkbox-checked .ant-tree-checkbox-inner:after{border-color:#00000040;animation-name:none}.ant-tree-checkbox-disabled .ant-tree-checkbox-inner{background-color:#f5f5f5;border-color:#d9d9d9!important}.ant-tree-checkbox-disabled .ant-tree-checkbox-inner:after{border-color:#f5f5f5;border-collapse:separate;animation-name:none}.ant-tree-checkbox-disabled+span{color:#00000040}.ant-tree-checkbox-disabled:hover:after,.ant-tree-checkbox-wrapper:hover .ant-tree-checkbox-disabled:after{visibility:hidden}.ant-tree-checkbox-wrapper{margin:0;color:#000000d9;display:inline-flex;align-items:baseline;line-height:unset;cursor:pointer}.ant-tree-checkbox-wrapper:after{display:inline-block;width:0;overflow:hidden;content:\"\\a0\"}.ant-tree-checkbox-wrapper.ant-tree-checkbox-wrapper-disabled{cursor:not-allowed}.ant-tree-checkbox-wrapper+.ant-tree-checkbox-wrapper{margin-left:8px}.ant-tree-checkbox+span{padding-right:8px;padding-left:8px}.ant-tree,.ant-tree-checkbox-group{box-sizing:border-box;padding:0;color:#000000d9;font-size:14px;font-variant:tabular-nums;line-height:1.5715;list-style:none;font-feature-settings:\"tnum\",\"tnum\"}.ant-tree-checkbox-group{margin:0;display:inline-block}.ant-tree-checkbox-group-item{margin-right:8px}.ant-tree-checkbox-group-item:last-child{margin-right:0}.ant-tree-checkbox-group-item+.ant-tree-checkbox-group-item{margin-left:0}.ant-tree-checkbox-indeterminate .ant-tree-checkbox-inner{background-color:#fff;border-color:#d9d9d9}.ant-tree-checkbox-indeterminate .ant-tree-checkbox-inner:after{top:50%;left:50%;width:8px;height:8px;background-color:#1890ff;border:0;transform:translate(-50%,-50%) scale(1);opacity:1;content:\" \"}.ant-tree-checkbox-indeterminate.ant-tree-checkbox-disabled .ant-tree-checkbox-inner:after{background-color:#00000040;border-color:#00000040}.ant-tree{margin:0;background:#fff;border-radius:2px;transition:background-color .3s}.ant-tree-focused:not(:hover):not(.ant-tree-active-focused){background:#e6f7ff}.ant-tree-list-holder-inner{align-items:flex-start}.ant-tree.ant-tree-block-node .ant-tree-list-holder-inner{align-items:stretch}.ant-tree.ant-tree-block-node .ant-tree-list-holder-inner .ant-tree-node-content-wrapper{flex:auto}.ant-tree.ant-tree-block-node .ant-tree-list-holder-inner .ant-tree-treenode.dragging{position:relative}.ant-tree.ant-tree-block-node .ant-tree-list-holder-inner .ant-tree-treenode.dragging:after{position:absolute;top:0;right:0;bottom:4px;left:0;border:1px solid #1890ff;opacity:0;animation:ant-tree-node-fx-do-not-use .3s;animation-play-state:running;animation-fill-mode:forwards;content:\"\";pointer-events:none}.ant-tree .ant-tree-treenode{display:flex;align-items:flex-start;padding:0 0 4px;outline:0}.ant-tree .ant-tree-treenode-disabled .ant-tree-node-content-wrapper{color:#00000040;cursor:not-allowed}.ant-tree .ant-tree-treenode-disabled .ant-tree-node-content-wrapper:hover{background:0 0}.ant-tree .ant-tree-treenode-active .ant-tree-node-content-wrapper{background:#f5f5f5}.ant-tree .ant-tree-treenode:not(.ant-tree .ant-tree-treenode-disabled).filter-node .ant-tree-title{color:inherit;font-weight:500}.ant-tree-indent{align-self:stretch;white-space:nowrap;-webkit-user-select:none;user-select:none}.ant-tree-indent-unit{display:inline-block;width:24px}.ant-tree-draggable-icon{width:24px;line-height:24px;text-align:center;opacity:.2;transition:opacity .3s}.ant-tree-treenode:hover .ant-tree-draggable-icon{opacity:.45}.ant-tree-switcher{position:relative;flex:none;align-self:stretch;width:24px;margin:0;line-height:24px;text-align:center;cursor:pointer;-webkit-user-select:none;user-select:none}.ant-tree-switcher .ant-select-tree-switcher-icon,.ant-tree-switcher .ant-tree-switcher-icon{display:inline-block;font-size:10px;vertical-align:baseline}.ant-tree-switcher .ant-select-tree-switcher-icon svg,.ant-tree-switcher .ant-tree-switcher-icon svg{transition:transform .3s}.ant-tree-switcher-noop{cursor:default}.ant-tree-switcher_close .ant-tree-switcher-icon svg{transform:rotate(-90deg)}.ant-tree-switcher-loading-icon{color:#1890ff}.ant-tree-switcher-leaf-line{position:relative;z-index:1;display:inline-block;width:100%;height:100%}.ant-tree-switcher-leaf-line:before{position:absolute;top:0;right:12px;bottom:-4px;margin-left:-1px;border-right:1px solid #d9d9d9;content:\" \"}.ant-tree-switcher-leaf-line:after{position:absolute;width:10px;height:14px;border-bottom:1px solid #d9d9d9;content:\" \"}.ant-tree-checkbox{top:initial;margin:4px 8px 0 0}.ant-tree .ant-tree-node-content-wrapper{position:relative;z-index:auto;min-height:24px;margin:0;padding:0 4px;color:inherit;line-height:24px;background:0 0;border-radius:2px;cursor:pointer;transition:all .3s,border 0s,line-height 0s,box-shadow 0s}.ant-tree .ant-tree-node-content-wrapper:hover{background-color:#f5f5f5}.ant-tree .ant-tree-node-content-wrapper.ant-tree-node-selected{background-color:#bae7ff}.ant-tree .ant-tree-node-content-wrapper .ant-tree-iconEle{display:inline-block;width:24px;height:24px;line-height:24px;text-align:center;vertical-align:top}.ant-tree .ant-tree-node-content-wrapper .ant-tree-iconEle:empty,.ant-tree-show-line .ant-tree-indent-unit-end:before{display:none}.ant-tree-unselectable .ant-tree-node-content-wrapper:hover{background-color:transparent}.ant-tree-node-content-wrapper{line-height:24px;-webkit-user-select:none;user-select:none}.ant-tree-node-content-wrapper .ant-tree-drop-indicator{position:absolute;z-index:1;height:2px;background-color:#1890ff;border-radius:1px;pointer-events:none}.ant-tree-node-content-wrapper .ant-tree-drop-indicator:after{position:absolute;top:-3px;left:-6px;width:8px;height:8px;background-color:transparent;border:2px solid #1890ff;border-radius:50%;content:\"\"}.ant-tree .ant-tree-treenode.drop-container>[draggable]{box-shadow:0 0 0 2px #1890ff}.ant-tree-show-line .ant-tree-indent-unit{position:relative;height:100%}.ant-tree-show-line .ant-tree-indent-unit:before{position:absolute;top:0;right:12px;bottom:-4px;border-right:1px solid #d9d9d9;content:\"\"}.ant-tree-show-line .ant-tree-switcher{background:#fff}.ant-tree-show-line .ant-tree-switcher-line-icon{vertical-align:-.15em}.ant-tree .ant-tree-treenode-leaf-last .ant-tree-switcher-leaf-line:before{top:auto!important;bottom:auto!important;height:14px!important}.ant-tree-rtl{direction:rtl}.ant-tree-rtl .ant-tree-node-content-wrapper[draggable=true] .ant-tree-drop-indicator:after{right:-6px;left:unset}.ant-tree .ant-tree-treenode-rtl{direction:rtl}.ant-tree-rtl .ant-tree-switcher_close .ant-tree-switcher-icon svg{transform:rotate(90deg)}.ant-tree-rtl.ant-tree-show-line .ant-tree-indent-unit:before{right:auto;left:-13px;border-right:none;border-left:1px solid #d9d9d9}.ant-tree-rtl.ant-tree-checkbox,.ant-tree-select-dropdown-rtl .ant-select-tree-checkbox{margin:4px 0 0 8px}.font-highlight{color:#ff4d4f}.ant-tree-child-tree{overflow:hidden}nz-tree{display:block}\n", ".ant-tree{color:inherit}.ant-tree .ant-tree-node-content-wrapper.ant-tree-node-selected{background-color:transparent}.ant-tree .ant-tree-switcher{line-height:17px}.ant-tree .ant-tree-node-content-wrapper{width:100%;padding:0}.ant-tree .node-wrapper{width:100%;position:relative;display:inline-block;margin:0;line-height:30px;text-decoration:none;vertical-align:top;border-radius:2px;cursor:pointer;padding:0 5px 0 8px;border:1px solid transparent}.ant-tree .ellipsis{position:absolute;right:8px;top:1px;cursor:pointer}\n"] }]
|
|
86
|
+
}], propDecorators: { menu: [{
|
|
87
|
+
type: ContentChild,
|
|
88
|
+
args: ['menu']
|
|
89
|
+
}], customNodeTemplate: [{
|
|
90
|
+
type: ContentChild,
|
|
91
|
+
args: [TreeNodeTemplateDirective]
|
|
92
|
+
}], expandedIconTemplate: [{
|
|
93
|
+
type: ContentChild,
|
|
94
|
+
args: [ExpandedIconTemplateDirective]
|
|
95
|
+
}], checkedKeysChange: [{
|
|
96
|
+
type: Output
|
|
97
|
+
}], expandedKeysChange: [{
|
|
98
|
+
type: Output
|
|
99
|
+
}], selectedNodeChange: [{
|
|
100
|
+
type: Output
|
|
101
|
+
}], dropOver: [{
|
|
102
|
+
type: Output
|
|
103
|
+
}], noAnimation: [{
|
|
104
|
+
type: Input
|
|
105
|
+
}], draggable: [{
|
|
106
|
+
type: Input
|
|
107
|
+
}], checkable: [{
|
|
108
|
+
type: Input
|
|
109
|
+
}], checkStrictly: [{
|
|
110
|
+
type: Input
|
|
111
|
+
}], checkedKeys: [{
|
|
112
|
+
type: Input
|
|
113
|
+
}], nodes: [{
|
|
114
|
+
type: Input
|
|
115
|
+
}], expandedKeys: [{
|
|
116
|
+
type: Input
|
|
117
|
+
}], selectedNode: [{
|
|
118
|
+
type: Input
|
|
119
|
+
}], isNodeSelected: [{
|
|
120
|
+
type: Input
|
|
121
|
+
}], beforeDrop: [{
|
|
122
|
+
type: Input
|
|
123
|
+
}] } });
|
|
124
|
+
|
|
125
|
+
const templates = [TreeNodeTemplateDirective, ExpandedIconTemplateDirective];
|
|
126
|
+
const exported = [...templates, TreeComponent];
|
|
127
|
+
class TreeModule {
|
|
128
|
+
}
|
|
129
|
+
TreeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: TreeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
130
|
+
TreeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: TreeModule, declarations: [TreeNodeTemplateDirective, ExpandedIconTemplateDirective, TreeComponent], imports: [CoreModule, NzTreeModule, NgbDropdownModule, NzNoAnimationModule], exports: [TreeNodeTemplateDirective, ExpandedIconTemplateDirective, TreeComponent] });
|
|
131
|
+
TreeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: TreeModule, imports: [[CoreModule, NzTreeModule, NgbDropdownModule, NzNoAnimationModule]] });
|
|
132
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: TreeModule, decorators: [{
|
|
133
|
+
type: NgModule,
|
|
134
|
+
args: [{
|
|
135
|
+
imports: [CoreModule, NzTreeModule, NgbDropdownModule, NzNoAnimationModule],
|
|
136
|
+
exports: [...exported],
|
|
137
|
+
declarations: [...exported],
|
|
138
|
+
}]
|
|
139
|
+
}] });
|
|
140
|
+
|
|
141
|
+
class BaseNode {
|
|
142
|
+
constructor(id, parentId) {
|
|
143
|
+
this.id = id;
|
|
144
|
+
this.parentId = parentId;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
class TreeNode extends BaseNode {
|
|
148
|
+
constructor(entity, nameResolver = ent => ent.displayName || ent.name) {
|
|
149
|
+
super(entity.id, entity.parentId);
|
|
150
|
+
this.entity = entity;
|
|
151
|
+
this.nameResolver = nameResolver;
|
|
152
|
+
this.icon = null;
|
|
153
|
+
this.children = [];
|
|
154
|
+
this.isLeaf = true;
|
|
155
|
+
this.checked = false;
|
|
156
|
+
this.selected = false;
|
|
157
|
+
this.expanded = false;
|
|
158
|
+
this.selectable = true;
|
|
159
|
+
this.disabled = false;
|
|
160
|
+
this.disableCheckbox = false;
|
|
161
|
+
this.key = entity.id;
|
|
162
|
+
this.title = nameResolver(entity);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
class TreeAdapter {
|
|
166
|
+
constructor(list = []) {
|
|
167
|
+
this.list = list;
|
|
168
|
+
this.tree = createTreeFromList(this.list);
|
|
169
|
+
}
|
|
170
|
+
getList() {
|
|
171
|
+
return this.list;
|
|
172
|
+
}
|
|
173
|
+
getTree() {
|
|
174
|
+
return this.tree;
|
|
175
|
+
}
|
|
176
|
+
handleDrop({ key, parentNode }) {
|
|
177
|
+
const index = this.list.findIndex(({ id }) => id === key);
|
|
178
|
+
this.list[index].parentId = parentNode ? parentNode.key : null;
|
|
179
|
+
this.tree = createTreeFromList(this.list);
|
|
180
|
+
}
|
|
181
|
+
handleRemove({ key }) {
|
|
182
|
+
this.updateTreeFromList(this.list.filter(item => item.id !== key));
|
|
183
|
+
}
|
|
184
|
+
handleUpdate({ key, children }) {
|
|
185
|
+
/**
|
|
186
|
+
* When we need to update a node with new children, first we need to remove any descendant nodes.
|
|
187
|
+
* If we remove immediate children and create a new tree, any other descendant nodes will be removed
|
|
188
|
+
* and we won't need to recursively remove sub children.
|
|
189
|
+
* Then, you simply add back the new children and create a new tree.
|
|
190
|
+
*/
|
|
191
|
+
const listWithDescendantNodesRemoved = this.updateTreeFromList(this.list.filter(item => item.parentId !== key));
|
|
192
|
+
this.updateTreeFromList(listWithDescendantNodesRemoved.concat(children));
|
|
193
|
+
}
|
|
194
|
+
updateTreeFromList(list) {
|
|
195
|
+
this.tree = createTreeFromList(list);
|
|
196
|
+
this.list = createListFromTree(this.tree);
|
|
197
|
+
return this.list;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
// UTILITY FUNCTIONS
|
|
201
|
+
function createTreeFromList(list) {
|
|
202
|
+
const map = createMapFromList(list);
|
|
203
|
+
const tree = [];
|
|
204
|
+
list.forEach(row => {
|
|
205
|
+
const parentId = row.parentId;
|
|
206
|
+
const node = map.get(row.id);
|
|
207
|
+
if (parentId) {
|
|
208
|
+
const parent = map.get(parentId);
|
|
209
|
+
if (!parent)
|
|
210
|
+
return;
|
|
211
|
+
parent.children.push(node);
|
|
212
|
+
parent.isLeaf = false;
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
tree.push(node);
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
return tree;
|
|
219
|
+
}
|
|
220
|
+
function createListFromTree(tree, list = []) {
|
|
221
|
+
tree.forEach(node => {
|
|
222
|
+
list.push(Object.assign(Object.assign({}, node.entity), { parentId: node.parentId }));
|
|
223
|
+
if (node.children)
|
|
224
|
+
createListFromTree(node.children, list);
|
|
225
|
+
});
|
|
226
|
+
return list;
|
|
227
|
+
}
|
|
228
|
+
function createMapFromList(list, map = new Map()) {
|
|
229
|
+
list.forEach(row => map.set(row.id, new TreeNode(row)));
|
|
230
|
+
return map;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Generated bundle index. Do not edit.
|
|
235
|
+
*/
|
|
236
|
+
|
|
237
|
+
export { BaseNode, ExpandedIconTemplateDirective, TreeAdapter, TreeComponent, TreeModule, TreeNodeTemplateDirective };
|
|
238
|
+
//# sourceMappingURL=abp-ng.components-tree.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abp-ng.components-tree.mjs","sources":["../../../../packages/components/tree/src/lib/templates/tree-node-template.directive.ts","../../../../packages/components/tree/src/lib/templates/expanded-icon-template.directive.ts","../../../../packages/components/tree/src/lib/components/tree.component.ts","../../../../packages/components/tree/src/lib/components/tree.component.html","../../../../packages/components/tree/src/lib/tree.module.ts","../../../../packages/components/tree/src/lib/utils/nz-tree-adapter.ts","../../../../packages/components/tree/src/abp-ng.components-tree.ts"],"sourcesContent":["import { Directive, TemplateRef } from '@angular/core';\r\n\r\n@Directive({\r\n selector: '[abpTreeNodeTemplate],[abp-tree-node-template]',\r\n})\r\nexport class TreeNodeTemplateDirective {\r\n constructor(public template: TemplateRef<any>) {}\r\n}\r\n","import { Directive, TemplateRef } from '@angular/core';\r\n\r\n@Directive({\r\n selector: '[abpTreeExpandedIconTemplate],[abp-tree-expanded-icon-template]',\r\n})\r\nexport class ExpandedIconTemplateDirective {\r\n constructor(public template: TemplateRef<any>) {}\r\n}\r\n","import {\r\n Component,\r\n ContentChild,\r\n EventEmitter,\r\n Input,\r\n Output,\r\n TemplateRef,\r\n ViewEncapsulation,\r\n} from '@angular/core';\r\nimport { NzFormatEmitEvent, NzFormatBeforeDropEvent } from 'ng-zorro-antd/tree';\r\nimport { of } from 'rxjs';\r\nimport { TreeNodeTemplateDirective } from '../templates/tree-node-template.directive';\r\nimport { ExpandedIconTemplateDirective } from '../templates/expanded-icon-template.directive';\r\nimport { NgbDropdown } from '@ng-bootstrap/ng-bootstrap';\r\n\r\nexport type DropEvent = NzFormatEmitEvent & { pos: number };\r\n\r\n@Component({\r\n selector: 'abp-tree',\r\n templateUrl: 'tree.component.html',\r\n styleUrls: [\r\n '../../../../../../node_modules/ng-zorro-antd/tree/style/index.min.css',\r\n 'tree.component.scss',\r\n ],\r\n encapsulation: ViewEncapsulation.None,\r\n})\r\nexport class TreeComponent {\r\n dropPosition: number;\r\n\r\n dropdowns = {} as { [key: string]: NgbDropdown };\r\n\r\n @ContentChild('menu') menu: TemplateRef<any>;\r\n @ContentChild(TreeNodeTemplateDirective) customNodeTemplate: TreeNodeTemplateDirective;\r\n @ContentChild(ExpandedIconTemplateDirective) expandedIconTemplate: ExpandedIconTemplateDirective;\r\n @Output() readonly checkedKeysChange = new EventEmitter();\r\n @Output() readonly expandedKeysChange = new EventEmitter<string[]>();\r\n @Output() readonly selectedNodeChange = new EventEmitter();\r\n @Output() readonly dropOver = new EventEmitter<DropEvent>();\r\n @Input() noAnimation = true;\r\n @Input() draggable: boolean;\r\n @Input() checkable: boolean;\r\n @Input() checkStrictly: boolean;\r\n @Input() checkedKeys = [];\r\n @Input() nodes = [];\r\n @Input() expandedKeys: string[] = [];\r\n @Input() selectedNode: any;\r\n @Input() isNodeSelected = node => this.selectedNode?.id === node.key;\r\n @Input() beforeDrop = (event: NzFormatBeforeDropEvent) => {\r\n this.dropPosition = event.pos;\r\n return of(false);\r\n };\r\n\r\n onSelectedNodeChange(node) {\r\n this.selectedNode = node.origin.entity;\r\n this.selectedNodeChange.emit(node.origin.entity);\r\n }\r\n\r\n onCheckboxChange(event) {\r\n this.checkedKeys = [...event.keys];\r\n this.checkedKeysChange.emit(event.keys);\r\n }\r\n\r\n onExpandedKeysChange(event) {\r\n this.expandedKeys = [...event.keys];\r\n this.expandedKeysChange.emit(event.keys);\r\n }\r\n\r\n onDrop(event: DropEvent) {\r\n event.event.stopPropagation();\r\n event.event.preventDefault();\r\n event.pos = this.dropPosition;\r\n\r\n this.dropOver.emit(event);\r\n }\r\n\r\n initDropdown(key: string, dropdown: NgbDropdown) {\r\n this.dropdowns[key] = dropdown;\r\n }\r\n}\r\n","<nz-tree\r\n [nzBeforeDrop]=\"beforeDrop\"\r\n [nzDraggable]=\"draggable\"\r\n [nzCheckStrictly]=\"checkStrictly\"\r\n [nzCheckable]=\"checkable\"\r\n [nzCheckedKeys]=\"checkedKeys\"\r\n [nzData]=\"nodes\"\r\n [nzTreeTemplate]=\"treeTemplate\"\r\n [nzExpandedKeys]=\"expandedKeys\"\r\n [nzExpandedIcon]=\"expandedIconTemplate?.template || defaultIconTemplate\"\r\n (nzExpandChange)=\"onExpandedKeysChange($event)\"\r\n (nzCheckBoxChange)=\"onCheckboxChange($event)\"\r\n (nzOnDrop)=\"onDrop($event)\"\r\n [nzNoAnimation]=\"noAnimation\"\r\n (nzContextMenu)=\"dropdowns[$event.node?.key]?.toggle()\"\r\n></nz-tree>\r\n<ng-template #treeTemplate let-node>\r\n <div\r\n class=\"node-wrapper\"\r\n [class.selected]=\"isNodeSelected(node)\"\r\n [title]=\"node.title\"\r\n (click)=\"onSelectedNodeChange(node)\"\r\n >\r\n <ng-container *ngTemplateOutlet=\"nodeTemplate; context: { $implicit: node }\"></ng-container>\r\n\r\n <ng-template #nodeTemplate let-node>\r\n <div class=\"d-inline-block\">\r\n <ng-container\r\n *ngTemplateOutlet=\"\r\n customNodeTemplate ? customNodeTemplate?.template : defaultNodeTemplate;\r\n context: { $implicit: node }\r\n \"\r\n ></ng-container>\r\n </div>\r\n\r\n <div\r\n #dropdown=\"ngbDropdown\"\r\n *ngIf=\"menu\"\r\n class=\"d-inline-block ms-1\"\r\n ngbDropdown\r\n placement=\"bottom\"\r\n container=\"body\"\r\n (abpInit)=\"initDropdown(node.key, dropdown)\"\r\n >\r\n <i\r\n class=\"fas fa-caret-down text-muted\"\r\n ngbDropdownToggle\r\n [class.dropdown-toggle]=\"false\"\r\n ></i>\r\n <div ngbDropdownMenu>\r\n <ng-template *ngTemplateOutlet=\"menu; context: { $implicit: node }\"></ng-template>\r\n </div>\r\n </div>\r\n </ng-template>\r\n\r\n <ng-template #defaultNodeTemplate let-node>\r\n <span>{{ node.title }}</span>\r\n </ng-template>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #defaultIconTemplate let-node let-origin=\"origin\">\r\n <i style=\"line-height: 28px\" aria-hidden=\"true\">\r\n <ng-container *ngTemplateOutlet=\"node.isExpanded ? minusIcon : plusIcon\"></ng-container\r\n ></i>\r\n</ng-template>\r\n\r\n<ng-template #minusIcon>\r\n <svg\r\n width=\"15\"\r\n height=\"15\"\r\n viewBox=\"0 0 24 24\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n fill-rule=\"evenodd\"\r\n clip-rule=\"evenodd\"\r\n >\r\n <path\r\n d=\"M11.5 0c6.347 0 11.5 5.153 11.5 11.5s-5.153 11.5-11.5 11.5-11.5-5.153-11.5-11.5 5.153-11.5 11.5-11.5zm0 1c5.795 0 10.5 4.705 10.5 10.5s-4.705 10.5-10.5 10.5-10.5-4.705-10.5-10.5 4.705-10.5 10.5-10.5zm-6.5 10h13v1h-13v-1z\"\r\n />\r\n </svg>\r\n</ng-template>\r\n\r\n<ng-template #plusIcon>\r\n <svg\r\n width=\"15\"\r\n height=\"15\"\r\n viewBox=\"0 0 24 24\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n fill-rule=\"evenodd\"\r\n clip-rule=\"evenodd\"\r\n >\r\n <path\r\n d=\"M11.5 0c6.347 0 11.5 5.153 11.5 11.5s-5.153 11.5-11.5 11.5-11.5-5.153-11.5-11.5 5.153-11.5 11.5-11.5zm0 1c5.795 0 10.5 4.705 10.5 10.5s-4.705 10.5-10.5 10.5-10.5-4.705-10.5-10.5 4.705-10.5 10.5-10.5zm.5 10h6v1h-6v6h-1v-6h-6v-1h6v-6h1v6z\"\r\n />\r\n </svg>\r\n</ng-template>\r\n","import { CoreModule } from '@abp/ng.core';\r\nimport { NgModule } from '@angular/core';\r\nimport { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap';\r\nimport { NzNoAnimationModule } from 'ng-zorro-antd/core/no-animation';\r\nimport { NzTreeModule } from 'ng-zorro-antd/tree';\r\nimport { TreeComponent } from './components/tree.component';\r\nimport { ExpandedIconTemplateDirective } from './templates/expanded-icon-template.directive';\r\nimport { TreeNodeTemplateDirective } from './templates/tree-node-template.directive';\r\n\r\nconst templates = [TreeNodeTemplateDirective, ExpandedIconTemplateDirective];\r\n\r\nconst exported = [...templates, TreeComponent];\r\n\r\n@NgModule({\r\n imports: [CoreModule, NzTreeModule, NgbDropdownModule, NzNoAnimationModule],\r\n exports: [...exported],\r\n declarations: [...exported],\r\n})\r\nexport class TreeModule {}\r\n","export abstract class BaseNode {\r\n name?: string;\r\n displayName?: string;\r\n\r\n constructor(public id: string, public parentId: string | null) {}\r\n}\r\n\r\nclass TreeNode<T extends BaseNode> extends BaseNode {\r\n title: string | undefined;\r\n key: string;\r\n icon: string | null = null;\r\n children: TreeNode<T>[] = [];\r\n isLeaf = true;\r\n checked = false;\r\n selected = false;\r\n expanded = false;\r\n selectable = true;\r\n disabled = false;\r\n disableCheckbox = false;\r\n parentNode?: TreeNode<T> | null;\r\n\r\n constructor(public entity: T, private nameResolver = ent => ent.displayName || ent.name) {\r\n super(entity.id, entity.parentId);\r\n this.key = entity.id;\r\n this.title = nameResolver(entity);\r\n }\r\n}\r\n\r\nexport class TreeAdapter<T extends BaseNode = BaseNode> {\r\n private tree: TreeNode<T>[];\r\n\r\n constructor(private list: T[] = []) {\r\n this.tree = createTreeFromList(this.list);\r\n }\r\n\r\n getList() {\r\n return this.list;\r\n }\r\n\r\n getTree() {\r\n return this.tree;\r\n }\r\n\r\n handleDrop({ key, parentNode }: TreeNode<T>) {\r\n const index = this.list.findIndex(({ id }) => id === key);\r\n this.list[index].parentId = parentNode ? parentNode.key : null;\r\n this.tree = createTreeFromList(this.list);\r\n }\r\n\r\n handleRemove({ key }: TreeNode<T>) {\r\n this.updateTreeFromList(this.list.filter(item => item.id !== key));\r\n }\r\n\r\n handleUpdate({ key, children }: { key: string; children: T[] }) {\r\n /**\r\n * When we need to update a node with new children, first we need to remove any descendant nodes.\r\n * If we remove immediate children and create a new tree, any other descendant nodes will be removed\r\n * and we won't need to recursively remove sub children.\r\n * Then, you simply add back the new children and create a new tree.\r\n */\r\n const listWithDescendantNodesRemoved = this.updateTreeFromList(\r\n this.list.filter(item => item.parentId !== key),\r\n );\r\n this.updateTreeFromList(listWithDescendantNodesRemoved.concat(children));\r\n }\r\n\r\n updateTreeFromList(list: T[]) {\r\n this.tree = createTreeFromList(list);\r\n this.list = createListFromTree(this.tree);\r\n return this.list;\r\n }\r\n}\r\n\r\n// UTILITY FUNCTIONS\r\n\r\nfunction createTreeFromList<T extends BaseNode>(list: T[]): TreeNode<T>[] {\r\n const map = createMapFromList(list);\r\n const tree: TreeNode<T>[] = [];\r\n\r\n list.forEach(row => {\r\n const parentId = row.parentId;\r\n const node = map.get(row.id);\r\n if (parentId) {\r\n const parent = map.get(parentId);\r\n if (!parent) return;\r\n parent.children.push(node);\r\n parent.isLeaf = false;\r\n } else {\r\n tree.push(node);\r\n }\r\n });\r\n\r\n return tree;\r\n}\r\n\r\nfunction createListFromTree<T extends BaseNode>(tree: TreeNode<T>[], list: T[] = []): T[] {\r\n tree.forEach(node => {\r\n list.push({ ...node.entity, parentId: node.parentId });\r\n if (node.children) createListFromTree(node.children, list);\r\n });\r\n\r\n return list;\r\n}\r\n\r\nfunction createMapFromList<T extends BaseNode>(\r\n list: T[],\r\n map = new Map<string, TreeNode<T>>(),\r\n): Map<string, TreeNode<T>> {\r\n list.forEach(row => map.set(row.id, new TreeNode(row)));\r\n\r\n return map;\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;MAKa,yBAAyB;IACpC,YAAmB,QAA0B;QAA1B,aAAQ,GAAR,QAAQ,CAAkB;KAAI;;sHADtC,yBAAyB;0GAAzB,yBAAyB;2FAAzB,yBAAyB;kBAHrC,SAAS;mBAAC;oBACT,QAAQ,EAAE,gDAAgD;iBAC3D;;;MCCY,6BAA6B;IACxC,YAAmB,QAA0B;QAA1B,aAAQ,GAAR,QAAQ,CAAkB;KAAI;;0HADtC,6BAA6B;8GAA7B,6BAA6B;2FAA7B,6BAA6B;kBAHzC,SAAS;mBAAC;oBACT,QAAQ,EAAE,iEAAiE;iBAC5E;;;MCsBY,aAAa;IAT1B;QAYE,cAAS,GAAG,EAAoC,CAAC;QAK9B,sBAAiB,GAAG,IAAI,YAAY,EAAE,CAAC;QACvC,uBAAkB,GAAG,IAAI,YAAY,EAAY,CAAC;QAClD,uBAAkB,GAAG,IAAI,YAAY,EAAE,CAAC;QACxC,aAAQ,GAAG,IAAI,YAAY,EAAa,CAAC;QACnD,gBAAW,GAAG,IAAI,CAAC;QAInB,gBAAW,GAAG,EAAE,CAAC;QACjB,UAAK,GAAG,EAAE,CAAC;QACX,iBAAY,GAAa,EAAE,CAAC;QAE5B,mBAAc,GAAG,IAAI,cAAI,OAAA,CAAA,MAAA,I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,CAAC,IAAI,CAAC,CAAC;YAC3B,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC;SACvB;aAAM;YACL,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACjB;KACF,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,kBAAkB,CAAqB,IAAmB,EAAE,OAAY,EAAE;IACjF,IAAI,CAAC,OAAO,CAAC,IAAI;QACf,IAAI,CAAC,IAAI,iCAAM,IAAI,CAAC,MAAM,KAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAG,CAAC;QACvD,IAAI,IAAI,CAAC,QAAQ;YAAE,kBAAkB,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;KAC5D,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,iBAAiB,CACxB,IAAS,EACT,MAAM,IAAI,GAAG,EAAuB;IAEpC,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAExD,OAAO,GAAG,CAAC;AACb;;AC/GA;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abp-ng.components.mjs","sources":["../../../../packages/components/src/abp-ng.components.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"AAAA;;"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { EventEmitter, Component, ChangeDetectionStrategy, Input, Output, ViewChild, NgModule } from '@angular/core';
|
|
3
|
+
import { CommonModule } from '@angular/common';
|
|
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
|
+
if (!this.chart)
|
|
77
|
+
return;
|
|
78
|
+
if (changes.data?.currentValue || changes.options?.currentValue) {
|
|
79
|
+
this.chart.destroy();
|
|
80
|
+
this.initChart();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
ChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ChartComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
85
|
+
ChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", 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: `
|
|
86
|
+
<div
|
|
87
|
+
style="position:relative"
|
|
88
|
+
[style.width]="responsive && !width ? null : width"
|
|
89
|
+
[style.height]="responsive && !height ? null : height"
|
|
90
|
+
>
|
|
91
|
+
<canvas
|
|
92
|
+
#canvas
|
|
93
|
+
[attr.width]="responsive && !width ? null : width"
|
|
94
|
+
[attr.height]="responsive && !height ? null : height"
|
|
95
|
+
(click)="onCanvasClick($event)"
|
|
96
|
+
></canvas>
|
|
97
|
+
</div>
|
|
98
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
99
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ChartComponent, decorators: [{
|
|
100
|
+
type: Component,
|
|
101
|
+
args: [{
|
|
102
|
+
selector: 'abp-chart',
|
|
103
|
+
template: `
|
|
104
|
+
<div
|
|
105
|
+
style="position:relative"
|
|
106
|
+
[style.width]="responsive && !width ? null : width"
|
|
107
|
+
[style.height]="responsive && !height ? null : height"
|
|
108
|
+
>
|
|
109
|
+
<canvas
|
|
110
|
+
#canvas
|
|
111
|
+
[attr.width]="responsive && !width ? null : width"
|
|
112
|
+
[attr.height]="responsive && !height ? null : height"
|
|
113
|
+
(click)="onCanvasClick($event)"
|
|
114
|
+
></canvas>
|
|
115
|
+
</div>
|
|
116
|
+
`,
|
|
117
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
118
|
+
exportAs: 'abpChart',
|
|
119
|
+
}]
|
|
120
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { type: [{
|
|
121
|
+
type: Input
|
|
122
|
+
}], data: [{
|
|
123
|
+
type: Input
|
|
124
|
+
}], options: [{
|
|
125
|
+
type: Input
|
|
126
|
+
}], plugins: [{
|
|
127
|
+
type: Input
|
|
128
|
+
}], width: [{
|
|
129
|
+
type: Input
|
|
130
|
+
}], height: [{
|
|
131
|
+
type: Input
|
|
132
|
+
}], responsive: [{
|
|
133
|
+
type: Input
|
|
134
|
+
}], dataSelect: [{
|
|
135
|
+
type: Output
|
|
136
|
+
}], initialized: [{
|
|
137
|
+
type: Output
|
|
138
|
+
}], canvas: [{
|
|
139
|
+
type: ViewChild,
|
|
140
|
+
args: ['canvas']
|
|
141
|
+
}] } });
|
|
142
|
+
|
|
143
|
+
class ChartModule {
|
|
144
|
+
}
|
|
145
|
+
ChartModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ChartModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
146
|
+
ChartModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ChartModule, declarations: [ChartComponent], imports: [CommonModule], exports: [ChartComponent] });
|
|
147
|
+
ChartModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ChartModule, providers: [], imports: [[CommonModule]] });
|
|
148
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ChartModule, decorators: [{
|
|
149
|
+
type: NgModule,
|
|
150
|
+
args: [{
|
|
151
|
+
imports: [CommonModule],
|
|
152
|
+
exports: [ChartComponent],
|
|
153
|
+
declarations: [ChartComponent],
|
|
154
|
+
providers: [],
|
|
155
|
+
}]
|
|
156
|
+
}] });
|
|
157
|
+
|
|
158
|
+
function getRandomBackgroundColor(count) {
|
|
159
|
+
const colors = [];
|
|
160
|
+
for (let i = 0; i < count; i++) {
|
|
161
|
+
const r = ((i + 5) * (i + 5) * 474) % 255;
|
|
162
|
+
const g = ((i + 5) * (i + 5) * 1600) % 255;
|
|
163
|
+
const b = ((i + 5) * (i + 5) * 84065) % 255;
|
|
164
|
+
colors.push('rgba(' + r + ', ' + g + ', ' + b + ', 0.7)');
|
|
165
|
+
}
|
|
166
|
+
return colors;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Generated bundle index. Do not edit.
|
|
171
|
+
*/
|
|
172
|
+
|
|
173
|
+
export { ChartComponent, ChartModule, getRandomBackgroundColor };
|
|
174
|
+
//# sourceMappingURL=abp-ng.components-chart.js.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abp-ng.components-chart.js.mjs","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 {\r\n AfterViewInit,\r\n ChangeDetectionStrategy,\r\n ChangeDetectorRef,\r\n Component,\r\n ElementRef,\r\n EventEmitter,\r\n Input,\r\n OnChanges,\r\n OnDestroy,\r\n Output,\r\n SimpleChanges,\r\n ViewChild,\r\n} from '@angular/core';\r\n\r\nlet Chart: any;\r\n\r\n@Component({\r\n selector: 'abp-chart',\r\n template: `\r\n <div\r\n style=\"position:relative\"\r\n [style.width]=\"responsive && !width ? null : width\"\r\n [style.height]=\"responsive && !height ? null : height\"\r\n >\r\n <canvas\r\n #canvas\r\n [attr.width]=\"responsive && !width ? null : width\"\r\n [attr.height]=\"responsive && !height ? null : height\"\r\n (click)=\"onCanvasClick($event)\"\r\n ></canvas>\r\n </div>\r\n `,\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n exportAs: 'abpChart',\r\n})\r\nexport class ChartComponent implements AfterViewInit, OnDestroy, OnChanges {\r\n @Input() type: string;\r\n\r\n @Input() data: any = {};\r\n\r\n @Input() options: any = {};\r\n\r\n @Input() plugins: any[] = [];\r\n\r\n @Input() width: string;\r\n\r\n @Input() height: string;\r\n\r\n @Input() responsive = true;\r\n\r\n @Output() dataSelect = new EventEmitter();\r\n\r\n @Output() initialized = new EventEmitter<boolean>();\r\n\r\n @ViewChild('canvas') canvas: ElementRef<HTMLCanvasElement>;\r\n\r\n chart: any;\r\n\r\n constructor(public el: ElementRef, private cdr: ChangeDetectorRef) {}\r\n\r\n ngAfterViewInit() {\r\n import('chart.js/auto').then(module => {\r\n Chart = module.default;\r\n this.initChart();\r\n this.initialized.emit(true);\r\n });\r\n }\r\n\r\n onCanvasClick(event) {\r\n if (this.chart) {\r\n const element = this.chart.getElementsAtEventForMode(\r\n event,\r\n 'nearest',\r\n { intersect: true },\r\n false,\r\n );\r\n const dataset = this.chart.getElementsAtEventForMode(\r\n event,\r\n 'dataset',\r\n { intersect: true },\r\n false,\r\n );\r\n\r\n if (element && element[0] && dataset) {\r\n this.dataSelect.emit({ originalEvent: event, element: element[0], dataset: dataset });\r\n }\r\n }\r\n }\r\n\r\n private initChart = () => {\r\n const opts = this.options || {};\r\n opts.responsive = this.responsive;\r\n\r\n // allows chart to resize in responsive mode\r\n if (opts.responsive && (this.height || this.width)) {\r\n opts.maintainAspectRatio = false;\r\n }\r\n\r\n this.chart = new Chart(this.canvas.nativeElement, {\r\n type: this.type as any,\r\n data: this.data,\r\n options: this.options,\r\n });\r\n };\r\n\r\n getCanvas = () => {\r\n return this.canvas.nativeElement;\r\n };\r\n\r\n getBase64Image = () => {\r\n return this.chart.toBase64Image();\r\n };\r\n\r\n generateLegend = () => {\r\n if (this.chart) {\r\n return this.chart.generateLegend();\r\n }\r\n };\r\n\r\n refresh = () => {\r\n if (this.chart) {\r\n this.chart.update();\r\n this.cdr.detectChanges();\r\n }\r\n };\r\n\r\n reinit = () => {\r\n if (!this.chart) return;\r\n this.chart.destroy();\r\n this.initChart();\r\n };\r\n\r\n ngOnDestroy() {\r\n if (this.chart) {\r\n this.chart.destroy();\r\n this.chart = null;\r\n }\r\n }\r\n\r\n ngOnChanges(changes: SimpleChanges) {\r\n if (!this.chart) return;\r\n\r\n if (changes.data?.currentValue || changes.options?.currentValue) {\r\n this.chart.destroy();\r\n this.initChart();\r\n }\r\n }\r\n}\r\n","import { CommonModule } from '@angular/common';\r\nimport { NgModule } from '@angular/core';\r\nimport { ChartComponent } from './chart.component';\r\n\r\n@NgModule({\r\n imports: [CommonModule],\r\n exports: [ChartComponent],\r\n declarations: [ChartComponent],\r\n providers: [],\r\n})\r\nexport class ChartModule {}\r\n","export function getRandomBackgroundColor(count) {\r\n const colors = [];\r\n\r\n for (let i = 0; i < count; i++) {\r\n const r = ((i + 5) * (i + 5) * 474) % 255;\r\n const g = ((i + 5) * (i + 5) * 1600) % 255;\r\n const b = ((i + 5) * (i + 5) * 84065) % 255;\r\n colors.push('rgba(' + r + ', ' + g + ', ' + b + ', 0.7)');\r\n }\r\n\r\n return colors;\r\n}\r\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,EAAE,IAAI,CAAC,IAAI;gBACf,OAAO,EAAE,IAAI,CAAC,OAAO;aACtB,CAAC,CAAC;SACJ,CAAC;QAEF,cAAS,GAAG;YACV,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC;SAClC,CAAC;QAEF,mBAAc,GAAG;YACf,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;SACnC,CAAC;QAEF,mBAAc,GAAG;YACf,IAAI,IAAI,CAAC,KAAK,E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