@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
|
@@ -1,246 +0,0 @@
|
|
|
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: "12.2.13", ngImport: i0, type: TreeNodeTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
20
|
-
TreeNodeTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.13", type: TreeNodeTemplateDirective, selector: "[abpTreeNodeTemplate],[abp-tree-node-template]", ngImport: i0 });
|
|
21
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", 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: "12.2.13", ngImport: i0, type: ExpandedIconTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
34
|
-
ExpandedIconTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.13", type: ExpandedIconTemplateDirective, selector: "[abpTreeExpandedIconTemplate],[abp-tree-expanded-icon-template]", ngImport: i0 });
|
|
35
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", 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: "12.2.13", ngImport: i0, type: TreeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
82
|
-
TreeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.13", 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{font-size:14px;font-variant:tabular-nums;list-style:none;font-feature-settings:\"tnum\",\"tnum\"}@-webkit-keyframes antCheckboxEffect{0%{transform:scale(1);opacity:.5}to{transform:scale(1.6);opacity:0}}@keyframes antCheckboxEffect{0%{transform:scale(1);opacity:.5}to{transform:scale(1.6);opacity:0}}.ant-tree-treenode-leaf-last .ant-tree-switcher-leaf-line:before{top:auto!important;bottom:auto!important;height:14px!important}.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;-moz-user-select:none;-ms-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{box-sizing:border-box;padding:0;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;-webkit-animation:antCheckboxEffect .36s ease-in-out;animation:antCheckboxEffect .36s ease-in-out;-webkit-animation-fill-mode:backwards;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;-webkit-animation-name:none;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;-webkit-animation-name:none;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{box-sizing:border-box;margin:0;padding: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-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;-moz-user-select:none;-ms-user-select:none;user-select:none}.ant-tree-indent-unit{display:inline-block;width:24px}.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;-moz-user-select:none;-ms-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:after,.ant-tree-switcher-leaf-line:before{position:absolute;margin-left:-1px;content:\" \"}.ant-tree-switcher-leaf-line:before{top:0;bottom:-4px;border-left:1px solid #d9d9d9}.ant-tree-switcher-leaf-line:after{width:10px;height:14px;border-bottom:1px solid #d9d9d9}.ant-tree-checkbox{top:auto;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[draggable=true]{line-height:24px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ant-tree-node-content-wrapper[draggable=true] .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[draggable=true] .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:-.225em}.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", "nzVirtualItemSize", "nzVirtualMaxBufferPx", "nzVirtualMinBufferPx", "nzVirtualHeight", "nzData", "nzExpandedKeys", "nzSelectedKeys", "nzCheckedKeys", "nzSearchValue", "nzExpandedIcon", "nzTreeTemplate", "nzBeforeDrop", "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: ["open", "placement", "container", "autoClose", "display", "dropdownClass"], 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: "12.2.13", ngImport: i0, type: TreeComponent, decorators: [{
|
|
84
|
-
type: Component,
|
|
85
|
-
args: [{
|
|
86
|
-
selector: 'abp-tree',
|
|
87
|
-
templateUrl: 'tree.component.html',
|
|
88
|
-
styleUrls: [
|
|
89
|
-
'../../../../../../node_modules/ng-zorro-antd/tree/style/index.min.css',
|
|
90
|
-
'tree.component.scss',
|
|
91
|
-
],
|
|
92
|
-
encapsulation: ViewEncapsulation.None,
|
|
93
|
-
}]
|
|
94
|
-
}], propDecorators: { menu: [{
|
|
95
|
-
type: ContentChild,
|
|
96
|
-
args: ['menu']
|
|
97
|
-
}], customNodeTemplate: [{
|
|
98
|
-
type: ContentChild,
|
|
99
|
-
args: [TreeNodeTemplateDirective]
|
|
100
|
-
}], expandedIconTemplate: [{
|
|
101
|
-
type: ContentChild,
|
|
102
|
-
args: [ExpandedIconTemplateDirective]
|
|
103
|
-
}], checkedKeysChange: [{
|
|
104
|
-
type: Output
|
|
105
|
-
}], expandedKeysChange: [{
|
|
106
|
-
type: Output
|
|
107
|
-
}], selectedNodeChange: [{
|
|
108
|
-
type: Output
|
|
109
|
-
}], dropOver: [{
|
|
110
|
-
type: Output
|
|
111
|
-
}], noAnimation: [{
|
|
112
|
-
type: Input
|
|
113
|
-
}], draggable: [{
|
|
114
|
-
type: Input
|
|
115
|
-
}], checkable: [{
|
|
116
|
-
type: Input
|
|
117
|
-
}], checkStrictly: [{
|
|
118
|
-
type: Input
|
|
119
|
-
}], checkedKeys: [{
|
|
120
|
-
type: Input
|
|
121
|
-
}], nodes: [{
|
|
122
|
-
type: Input
|
|
123
|
-
}], expandedKeys: [{
|
|
124
|
-
type: Input
|
|
125
|
-
}], selectedNode: [{
|
|
126
|
-
type: Input
|
|
127
|
-
}], isNodeSelected: [{
|
|
128
|
-
type: Input
|
|
129
|
-
}], beforeDrop: [{
|
|
130
|
-
type: Input
|
|
131
|
-
}] } });
|
|
132
|
-
|
|
133
|
-
const templates = [TreeNodeTemplateDirective, ExpandedIconTemplateDirective];
|
|
134
|
-
const exported = [...templates, TreeComponent];
|
|
135
|
-
class TreeModule {
|
|
136
|
-
}
|
|
137
|
-
TreeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: TreeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
138
|
-
TreeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: TreeModule, declarations: [TreeNodeTemplateDirective, ExpandedIconTemplateDirective, TreeComponent], imports: [CoreModule, NzTreeModule, NgbDropdownModule, NzNoAnimationModule], exports: [TreeNodeTemplateDirective, ExpandedIconTemplateDirective, TreeComponent] });
|
|
139
|
-
TreeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: TreeModule, imports: [[CoreModule, NzTreeModule, NgbDropdownModule, NzNoAnimationModule]] });
|
|
140
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: TreeModule, decorators: [{
|
|
141
|
-
type: NgModule,
|
|
142
|
-
args: [{
|
|
143
|
-
imports: [CoreModule, NzTreeModule, NgbDropdownModule, NzNoAnimationModule],
|
|
144
|
-
exports: [...exported],
|
|
145
|
-
declarations: [...exported],
|
|
146
|
-
}]
|
|
147
|
-
}] });
|
|
148
|
-
|
|
149
|
-
class BaseNode {
|
|
150
|
-
constructor(id, parentId) {
|
|
151
|
-
this.id = id;
|
|
152
|
-
this.parentId = parentId;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
class TreeNode extends BaseNode {
|
|
156
|
-
constructor(entity, nameResolver = ent => ent.displayName || ent.name) {
|
|
157
|
-
super(entity.id, entity.parentId);
|
|
158
|
-
this.entity = entity;
|
|
159
|
-
this.nameResolver = nameResolver;
|
|
160
|
-
this.icon = null;
|
|
161
|
-
this.children = [];
|
|
162
|
-
this.isLeaf = true;
|
|
163
|
-
this.checked = false;
|
|
164
|
-
this.selected = false;
|
|
165
|
-
this.expanded = false;
|
|
166
|
-
this.selectable = true;
|
|
167
|
-
this.disabled = false;
|
|
168
|
-
this.disableCheckbox = false;
|
|
169
|
-
this.key = entity.id;
|
|
170
|
-
this.title = nameResolver(entity);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
class TreeAdapter {
|
|
174
|
-
constructor(list = []) {
|
|
175
|
-
this.list = list;
|
|
176
|
-
this.tree = createTreeFromList(this.list);
|
|
177
|
-
}
|
|
178
|
-
getList() {
|
|
179
|
-
return this.list;
|
|
180
|
-
}
|
|
181
|
-
getTree() {
|
|
182
|
-
return this.tree;
|
|
183
|
-
}
|
|
184
|
-
handleDrop({ key, parentNode }) {
|
|
185
|
-
const index = this.list.findIndex(({ id }) => id === key);
|
|
186
|
-
this.list[index].parentId = parentNode ? parentNode.key : null;
|
|
187
|
-
this.tree = createTreeFromList(this.list);
|
|
188
|
-
}
|
|
189
|
-
handleRemove({ key }) {
|
|
190
|
-
this.updateTreeFromList(this.list.filter(item => item.id !== key));
|
|
191
|
-
}
|
|
192
|
-
handleUpdate({ key, children }) {
|
|
193
|
-
/**
|
|
194
|
-
* When we need to update a node with new children, first we need to remove any descendant nodes.
|
|
195
|
-
* If we remove immediate children and create a new tree, any other descendant nodes will be removed
|
|
196
|
-
* and we won't need to recursively remove sub children.
|
|
197
|
-
* Then, you simply add back the new children and create a new tree.
|
|
198
|
-
*/
|
|
199
|
-
const listWithDescendantNodesRemoved = this.updateTreeFromList(this.list.filter(item => item.parentId !== key));
|
|
200
|
-
this.updateTreeFromList(listWithDescendantNodesRemoved.concat(children));
|
|
201
|
-
}
|
|
202
|
-
updateTreeFromList(list) {
|
|
203
|
-
this.tree = createTreeFromList(list);
|
|
204
|
-
this.list = createListFromTree(this.tree);
|
|
205
|
-
return this.list;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
// UTILITY FUNCTIONS
|
|
209
|
-
function createTreeFromList(list) {
|
|
210
|
-
const map = createMapFromList(list);
|
|
211
|
-
const tree = [];
|
|
212
|
-
list.forEach(row => {
|
|
213
|
-
const parentId = row.parentId;
|
|
214
|
-
const node = map.get(row.id);
|
|
215
|
-
if (parentId) {
|
|
216
|
-
const parent = map.get(parentId);
|
|
217
|
-
if (!parent)
|
|
218
|
-
return;
|
|
219
|
-
parent.children.push(node);
|
|
220
|
-
parent.isLeaf = false;
|
|
221
|
-
}
|
|
222
|
-
else {
|
|
223
|
-
tree.push(node);
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
return tree;
|
|
227
|
-
}
|
|
228
|
-
function createListFromTree(tree, list = []) {
|
|
229
|
-
tree.forEach(node => {
|
|
230
|
-
list.push(Object.assign(Object.assign({}, node.entity), { parentId: node.parentId }));
|
|
231
|
-
if (node.children)
|
|
232
|
-
createListFromTree(node.children, list);
|
|
233
|
-
});
|
|
234
|
-
return list;
|
|
235
|
-
}
|
|
236
|
-
function createMapFromList(list, map = new Map()) {
|
|
237
|
-
list.forEach(row => map.set(row.id, new TreeNode(row)));
|
|
238
|
-
return map;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Generated bundle index. Do not edit.
|
|
243
|
-
*/
|
|
244
|
-
|
|
245
|
-
export { BaseNode, ExpandedIconTemplateDirective, TreeAdapter, TreeComponent, TreeModule, TreeNodeTemplateDirective };
|
|
246
|
-
//# sourceMappingURL=abp-ng.components-tree.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"abp-ng.components-tree.js","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;;uHADtC,yBAAyB;2GAAzB,yBAAyB;4FAAzB,yBAAyB;kBAHrC,SAAS;mBAAC;oBACT,QAAQ,EAAE,gDAAgD;iBAC3D;;;MCCY,6BAA6B;IACxC,YAAmB,QAA0B;QAA1B,aAAQ,GAAR,QAAQ,CAAkB;KAAI;;2HADtC,6BAA6B;+GAA7B,6BAA6B;4FAA7B,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,IAAI,CAAC,YAAY,0CAAE,EAAE,MAA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AAC,QAAQ,CAAC,CAAC;YACjC,IAAI,CAAC,MAAM;gBAAE,OAAO;YACpB,MAAM,CAAC,QAAQ,CAAC,IAAI,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;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"abp-ng.components.js","sources":["../../../../packages/components/src/public-api.ts","../../../../packages/components/src/abp-ng.components.ts"],"sourcesContent":["/*\r\n * Public API Surface of components\r\n */\r\n\r\nexport {};\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"AAAA;;;;ACAA;;"}
|