@rxap/tree 12.2.0-next.0 → 12.3.0
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/bundles/rxap-tree.umd.js +115 -68
- package/bundles/rxap-tree.umd.js.map +1 -1
- package/esm2015/lib/tree.component.js +16 -10
- package/esm2015/lib/tree.component.js.map +1 -1
- package/esm2015/lib/tree.component.module.js +7 -3
- package/esm2015/lib/tree.component.module.js.map +1 -1
- package/esm2015/lib/tree.data-source.js +38 -28
- package/esm2015/lib/tree.data-source.js.map +1 -1
- package/fesm2015/rxap-tree.js +61 -41
- package/fesm2015/rxap-tree.js.map +1 -1
- package/lib/tree.component.d.ts +2 -1
- package/lib/tree.component.module.d.ts +2 -1
- package/lib/tree.data-source.d.ts +8 -7
- package/package.json +5 -5
|
@@ -42,10 +42,10 @@ export class TreeDataSource extends BaseDataSource {
|
|
|
42
42
|
const root = yield this.getRoot();
|
|
43
43
|
let rootNodes;
|
|
44
44
|
if (Array.isArray(root)) {
|
|
45
|
-
rootNodes = root.map((node) => this._toNode(node));
|
|
45
|
+
rootNodes = yield Promise.all(root.map((node) => this._toNode(node)));
|
|
46
46
|
}
|
|
47
47
|
else {
|
|
48
|
-
rootNodes = [this._toNode(root)];
|
|
48
|
+
rootNodes = [yield this._toNode(root)];
|
|
49
49
|
}
|
|
50
50
|
this.tree$.next(rootNodes);
|
|
51
51
|
return rootNodes;
|
|
@@ -79,29 +79,31 @@ export class TreeDataSource extends BaseDataSource {
|
|
|
79
79
|
}
|
|
80
80
|
// - the SelectModel that stores the selection into the local storage?
|
|
81
81
|
_toNode(item, depth = 0, onExpand = this.expandNode.bind(this), onCollapse = this.collapseNode.bind(this), onSelect = this.selectNode.bind(this), onDeselect = this.deselectNode.bind(this)) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
node
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
node
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
82
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
+
const node = yield this.toNode(item, depth, onExpand, onCollapse, onSelect, onDeselect);
|
|
84
|
+
if (this.expanded.isSelected(node.id)) {
|
|
85
|
+
yield node
|
|
86
|
+
.expand()
|
|
87
|
+
.then(() => {
|
|
88
|
+
// TODO : remove redundant this.expanded SelectionModel. Only store expanded nodes in this.treeControl.expansionModel
|
|
89
|
+
// das problem ist das ich beim speicher in localStorage nur die id speicher.
|
|
90
|
+
// Des wegen kann ich beim laden aus dem localStorage this.treeControl.expansionModel
|
|
91
|
+
// nicht einfach mit den expanend nodes fullen. Da dort das node object benötigt wird
|
|
92
|
+
// möglich lösungen:
|
|
93
|
+
// - das node object läde die entity mithilfe der id automatisch nach
|
|
94
|
+
this.treeControl.expansionModel.select(node);
|
|
95
|
+
console.debug(`Restore expand for node '${node.id}' SUCCESSFULLY`);
|
|
96
|
+
})
|
|
97
|
+
.catch(() => console.debug(`Restore expand for node '${node.id}' FAILED`));
|
|
98
|
+
}
|
|
99
|
+
if (this._preSelected.includes(node.id)) {
|
|
100
|
+
yield node
|
|
101
|
+
.select()
|
|
102
|
+
.then(() => console.debug(`Restore select for node '${node.id}' SUCCESSFULLY`))
|
|
103
|
+
.catch(() => console.debug(`Restore select for node '${node.id}' FAILED`));
|
|
104
|
+
}
|
|
105
|
+
return node;
|
|
106
|
+
});
|
|
105
107
|
}
|
|
106
108
|
expandNode(node) {
|
|
107
109
|
var _a;
|
|
@@ -111,7 +113,7 @@ export class TreeDataSource extends BaseDataSource {
|
|
|
111
113
|
const children = yield this.getChildren(node);
|
|
112
114
|
// add the loaded children to the item object
|
|
113
115
|
node.item.children = children;
|
|
114
|
-
node.addChildren(children.map((child) => this._toNode(child, node.depth + 1, node.onExpand, node.onCollapse)));
|
|
116
|
+
node.addChildren(yield Promise.all(children.map((child) => this._toNode(child, node.depth + 1, node.onExpand, node.onCollapse))));
|
|
115
117
|
node.isLoading$.disable();
|
|
116
118
|
}
|
|
117
119
|
this.expanded.select(node.id);
|
|
@@ -125,7 +127,13 @@ export class TreeDataSource extends BaseDataSource {
|
|
|
125
127
|
}
|
|
126
128
|
getRoot() {
|
|
127
129
|
return __awaiter(this, void 0, void 0, function* () {
|
|
128
|
-
|
|
130
|
+
const rootParameters = yield this.getRootParameters();
|
|
131
|
+
return this.rootRemoteMethod.call(rootParameters);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
getRootParameters() {
|
|
135
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
136
|
+
return undefined;
|
|
129
137
|
});
|
|
130
138
|
}
|
|
131
139
|
// TODO : find better solution to allow the overwrite of the toNode method
|
|
@@ -181,7 +189,9 @@ export class TreeDataSource extends BaseDataSource {
|
|
|
181
189
|
}), switchMap(() => merge(collectionViewer.viewChange, this._data$).pipe(map(() => this._data$.value))));
|
|
182
190
|
}
|
|
183
191
|
toNode(item, depth = 0, onExpand = this.expandNode.bind(this), onCollapse = this.collapseNode.bind(this), onSelect = this.selectNode.bind(this), onDeselect = this.deselectNode.bind(this)) {
|
|
184
|
-
return
|
|
192
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
193
|
+
return Node.ToNode(item, depth, onExpand, onCollapse, this.toDisplay, this.getIcon, onSelect, onDeselect, this.hasDetails);
|
|
194
|
+
});
|
|
185
195
|
}
|
|
186
196
|
collapseNode(node) {
|
|
187
197
|
this.expanded.deselect(node.id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree.data-source.js","sourceRoot":"","sources":["../../../../../libs/tree/src/lib/tree.data-source.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,eAAe,EACf,IAAI,EACJ,KAAK,EAGN,MAAM,MAAM,CAAC;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AAC,GAAG,CAAC,EAAE;YAC7B,IAAI;gBACF,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAE,CAAC,CAAC;aACnD;YAAC,OAAO,CAAC,EAAE;gBACV,OAAO,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;aAC/D;SACF;QAED,IAAI,CAAC,QAAQ,GAAG,IAAI,cAAc,CAChC,IAAI,CAAC,QAAQ,CAAC,cAAc,KAAK,KAAK,EACtC,QAAQ,CACT,CAAC;QACF,IAAI,CAAC,iCAAiC,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO;aAC3D,IAAI,CACH,GAAG,CAAC,GAAG,EAAE,CACP,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAClE,CACF;aACA,SAAS,EAAE,CAAC;IACjB,CAAC;;2GAlaU,cAAc,kBAwBf,wCAAwC,aAExC,4CAA4C,aAE5C,yBAAyB;+GA5BxB,cAAc;AAIf;IAAT,QAAQ;8BAAsB,eAAe;mDAAa;2FAJhD,cAAc;kBAD1B,UAAU;;0BAyBN,MAAM;2BAAC,wCAAwC;;0BAE/C,MAAM;2BAAC,4CAA4C;;0BAEnD,MAAM;2BAAC,yBAAyB;4CAxBlB,WAAW","sourcesContent":["import {\n BehaviorSubject,\n from,\n merge,\n Observable,\n Subscription\n} from 'rxjs';\nimport { FlatTreeControl } from '@angular/cdk/tree';\nimport {\n SelectionChange,\n SelectionModel\n} from '@angular/cdk/collections';\nimport {\n map,\n switchMap,\n tap\n} from 'rxjs/operators';\nimport {\n BaseDataSource,\n BaseDataSourceMetadata,\n BaseDataSourceViewer,\n RXAP_DATA_SOURCE_METADATA\n} from '@rxap/data-source';\nimport {\n joinPath,\n Required,\n WithChildren,\n WithIdentifier\n} from '@rxap/utilities';\nimport {\n Inject,\n Injectable,\n InjectionToken\n} from '@angular/core';\nimport {\n ExpandNodeFunction,\n Node,\n NodeGetIconFunction,\n NodeHasDetailsFunction,\n NodeToDisplayFunction,\n Method\n} from '@rxap/utilities/rxjs';\n\nexport function isSelectionChange<T>(obj: any): obj is SelectionChange<T> {\n return !!obj && obj.hasOwnProperty('added') && obj.hasOwnProperty('removed');\n}\n\nexport interface TreeDataSourceMetadata extends BaseDataSourceMetadata {\n selectMultiple?: boolean;\n expandMultiple?: boolean;\n}\n\nexport const RXAP_TREE_DATA_SOURCE_ROOT_REMOTE_METHOD = new InjectionToken(\n 'rxap/tree/data-source/root-remote-method'\n);\nexport const RXAP_TREE_DATA_SOURCE_CHILDREN_REMOTE_METHOD = new InjectionToken(\n 'rxap/tree/data-source/children-remote-method'\n);\n\n@Injectable()\nexport class TreeDataSource<\n Data extends WithIdentifier & WithChildren = any\n> extends BaseDataSource<Array<Node<Data>>> {\n public tree$ = new BehaviorSubject<Array<Node<Data>>>([]);\n @Required public treeControl!: FlatTreeControl<Node<Data>>;\n public selected!: SelectionModel<Node<Data>>;\n public expanded!: SelectionModel<string>;\n\n private _expandedLocalStorageSubscription: Subscription | null = null;\n private _selectedLocalStorageSubscription: Subscription | null = null;\n\n // TODO : änlich problem wie bei der redundaten expand SelectionModel.\n // im localStorage wird nur die id gespeichert.\n private _preSelected: string[] = [];\n\n protected _data$ = new BehaviorSubject<Array<Node<Data>>>([]);\n public metadata!: TreeDataSourceMetadata;\n\n public toDisplay: NodeToDisplayFunction<Data> = () =>\n 'to display function not defined';\n public getIcon: NodeGetIconFunction<Data> = () => null;\n public hasDetails: NodeHasDetailsFunction<Data> = () => true;\n\n constructor(\n @Inject(RXAP_TREE_DATA_SOURCE_ROOT_REMOTE_METHOD)\n public readonly rootRemoteMethod: Method<Data | Data[], void>,\n @Inject(RXAP_TREE_DATA_SOURCE_CHILDREN_REMOTE_METHOD)\n public readonly childrenRemoteMethod: Method<Data[], Node<Data>>,\n @Inject(RXAP_DATA_SOURCE_METADATA)\n metadata: TreeDataSourceMetadata | null = null\n ) {\n super(metadata);\n this.tree$\n .pipe(\n map((tree) =>\n tree\n .map((child) => this.flatTree(child))\n .reduce((acc, nodes) => [...acc, ...nodes], [])\n )\n )\n .subscribe(this._data$);\n\n // TODO add new SelectModel class that saves the select model to the localStorage\n this.initSelected();\n this.initExpanded();\n }\n\n public async getTreeRoot(): Promise<Array<Node<Data>>> {\n const root: Data | Data[] = await this.getRoot();\n\n let rootNodes: Array<Node<Data>>;\n\n if (Array.isArray(root)) {\n rootNodes = root.map((node) => this._toNode(node));\n } else {\n rootNodes = [this._toNode(root)];\n }\n\n this.tree$.next(rootNodes);\n\n return rootNodes;\n }\n\n public selectNode(node: Node<Data>): Promise<void> {\n if (!this.selected.isMultipleSelection()) {\n if (this.selected.hasValue()) {\n const currentSelectedNode = this.selected.selected[0];\n currentSelectedNode.deselect();\n }\n }\n this.selected.select(node);\n return Promise.resolve();\n }\n\n public setTreeControl(treeControl: FlatTreeControl<Node<Data>>): void {\n this.treeControl = treeControl;\n }\n\n public setToDisplay(\n toDisplay: NodeToDisplayFunction<Data> = this.toDisplay\n ): void {\n this.toDisplay = toDisplay;\n }\n\n public setGetIcon(getIcon: NodeGetIconFunction<Data> = this.getIcon): void {\n this.getIcon = getIcon;\n }\n\n public setHasDetails(\n hasDetails: NodeHasDetailsFunction<Data> = this.hasDetails\n ): void {\n this.hasDetails = hasDetails;\n }\n\n public deselectNode(node: Node<Data>): Promise<void> {\n this.selected.deselect(node);\n return Promise.resolve();\n }\n\n // - the SelectModel that stores the selection into the local storage?\n public _toNode(\n item: Data,\n depth: number = 0,\n onExpand: ExpandNodeFunction<Data> = this.expandNode.bind(this),\n onCollapse: ExpandNodeFunction<Data> = this.collapseNode.bind(this),\n onSelect: ExpandNodeFunction<Data> = this.selectNode.bind(this),\n onDeselect: ExpandNodeFunction<Data> = this.deselectNode.bind(this)\n ): Node<Data> {\n const node = this.toNode(\n item,\n depth,\n onExpand,\n onCollapse,\n onSelect,\n onDeselect\n );\n\n if (this.expanded.isSelected(node.id)) {\n node\n .expand()\n .then(() => {\n // TODO : remove redundant this.expanded SelectionModel. Only store expanded nodes in this.treeControl.expansionModel\n // das problem ist das ich beim speicher in localStorage nur die id speicher.\n // Des wegen kann ich beim laden aus dem localStorage this.treeControl.expansionModel\n // nicht einfach mit den expanend nodes fullen. Da dort das node object benötigt wird\n // möglich lösungen:\n // - das node object läde die entity mithilfe der id automatisch nach\n this.treeControl.expansionModel.select(node);\n console.debug(`Restore expand for node '${node.id}' SUCCESSFULLY`);\n })\n .catch(() =>\n console.debug(`Restore expand for node '${node.id}' FAILED`)\n );\n }\n\n if (this._preSelected.includes(node.id)) {\n node\n .select()\n .then(() =>\n console.debug(`Restore select for node '${node.id}' SUCCESSFULLY`)\n )\n .catch(() =>\n console.debug(`Restore select for node '${node.id}' FAILED`)\n );\n }\n\n return node;\n }\n\n public async expandNode(node: Node<Data>): Promise<void> {\n if (node.item.hasChildren && !node.item.children?.length) {\n node.isLoading$.enable();\n\n const children = await this.getChildren(node);\n\n // add the loaded children to the item object\n node.item.children = children;\n\n node.addChildren(\n children.map((child) =>\n this._toNode(child, node.depth + 1, node.onExpand, node.onCollapse)\n )\n );\n\n node.isLoading$.disable();\n }\n\n this.expanded.select(node.id);\n\n this.tree$.next(this.tree$.value);\n }\n\n public async getChildren(node: Node<Data>): Promise<Data[]> {\n return this.childrenRemoteMethod.call(node);\n }\n\n public async getRoot(): Promise<Data | Data[]> {\n return this.rootRemoteMethod.call();\n }\n\n // TODO : find better solution to allow the overwrite of the toNode method\n // without losing the custom preselect and preexpand function\n\n protected _connect(\n collectionViewer: Required<BaseDataSourceViewer>\n ): Observable<Array<Node<Data>>> {\n this.treeControl.expansionModel.changed.subscribe((change: any) => {\n if (isSelectionChange<Node<Data>>(change)) {\n if (change.added) {\n change.added.forEach((node) => node.expand());\n }\n if (change.removed) {\n change.removed\n .slice()\n .reverse()\n .forEach((node) => node.collapse());\n }\n }\n });\n\n let loadRoot: Promise<Array<Node<Data>> | void> = Promise.resolve();\n\n if (this.tree$.value.length === 0) {\n loadRoot = this.getTreeRoot();\n }\n\n return from(loadRoot).pipe(\n tap((rootNodes) => {\n if (rootNodes) {\n const promises: Promise<any>[] = [];\n if (this.metadata.selectMultiple) {\n if (!this.selected.hasValue()) {\n promises.push(\n ...rootNodes\n .filter((node) => node.hasDetails)\n .map((node) => node.select())\n );\n }\n if (!this.expanded.hasValue()) {\n promises.push(\n ...rootNodes\n .filter((node) => node.hasChildren)\n .map((node) => node.expand())\n );\n }\n } else if (rootNodes.length) {\n const rootNode = rootNodes[0];\n if (!this.selected.hasValue()) {\n // TODO : rename hasDetails to isSelectable\n if (rootNode.hasDetails) {\n promises.push(rootNode.select());\n }\n }\n if (!this.expanded.hasValue()) {\n promises.push(rootNode.expand());\n }\n }\n return Promise.all(promises);\n }\n return Promise.resolve();\n }),\n switchMap(() =>\n merge(collectionViewer.viewChange, this._data$).pipe(\n map(() => this._data$.value)\n )\n )\n );\n }\n\n public toNode(\n item: Data,\n depth: number = 0,\n onExpand: ExpandNodeFunction<Data> = this.expandNode.bind(this),\n onCollapse: ExpandNodeFunction<Data> = this.collapseNode.bind(this),\n onSelect: ExpandNodeFunction<Data> = this.selectNode.bind(this),\n onDeselect: ExpandNodeFunction<Data> = this.deselectNode.bind(this)\n ): Node<Data> {\n return Node.ToNode(\n item,\n depth,\n onExpand,\n onCollapse,\n this.toDisplay,\n this.getIcon,\n onSelect,\n onDeselect,\n this.hasDetails\n );\n }\n\n public collapseNode(node: Node<Data>): Promise<void> {\n this.expanded.deselect(node.id);\n\n this.tree$.next(this.tree$.value);\n\n return Promise.resolve();\n }\n\n public flatTree(tree: Node<Data>): Array<Node<Data>> {\n function flat(acc: any[], list: any[]) {\n return [...acc, ...list];\n }\n\n const flatTree = (node: Node<Data>): Array<Node<Data>> => {\n if (!Array.isArray(node.children)) {\n console.log(node);\n throw new Error('Node has not defined children');\n }\n\n if (node.expanded || this.expanded.isSelected(node.id)) {\n return [\n node,\n ...node.children.map((child) => flatTree(child)).reduce(flat, []),\n ];\n } else {\n return [node];\n }\n };\n\n return flatTree(tree);\n }\n\n public destroy(): void {\n super.destroy();\n // TODO : add subscription handler to BaseDataSource\n if (this._expandedLocalStorageSubscription) {\n this._expandedLocalStorageSubscription.unsubscribe();\n }\n if (this._selectedLocalStorageSubscription) {\n this._selectedLocalStorageSubscription.unsubscribe();\n }\n }\n\n public getNodeById(id: string): Node<Data> | null {\n function getNodeById(node: Node<Data>, nodeId: string) {\n if (node.id === nodeId) {\n return node;\n }\n if (node.hasNode(nodeId)) {\n return node.getNode(nodeId);\n } else {\n return null;\n }\n }\n\n return (\n this.tree$.value\n .map((node) => getNodeById(node, id))\n .filter(Boolean)[0] || null\n );\n }\n\n private initSelected(): void {\n const key = joinPath('rxap/tree', this.id, 'selected');\n if (localStorage.getItem(key)) {\n try {\n this._preSelected = JSON.parse(localStorage.getItem(key)!);\n } catch (e) {\n console.debug('parse expanded tree data source nodes failed');\n }\n }\n\n this.selected = new SelectionModel<Node<Data>>(\n !!this.metadata.selectMultiple,\n []\n );\n this._selectedLocalStorageSubscription = this.selected.changed\n .pipe(\n tap(() =>\n localStorage.setItem(\n key,\n JSON.stringify(this.selected.selected.map((s) => s.id))\n )\n )\n )\n .subscribe();\n }\n\n public async refresh(): Promise<any> {\n const rootNodes = await this.getTreeRoot();\n\n // refresh all expanded nodes;\n\n const loadExpandedNodes = async (children: ReadonlyArray<Node<Data>>) => {\n for (const child of children) {\n if (this.expanded.isSelected(child.id)) {\n // call the node method to ensure that the expanded property of\n // Node is set.\n await child.expand();\n }\n\n if (child.hasChildren) {\n await loadExpandedNodes(child.children);\n }\n }\n };\n\n await Promise.all(\n rootNodes\n .filter((node) => node.hasChildren)\n .map((node) => loadExpandedNodes(node.children))\n );\n\n const selected: Array<Node<Data>> = this.selected.selected\n .map((node) => this.getNodeById(node.id))\n .filter(Boolean) as any;\n this.selected.clear();\n this.selected.select(...selected);\n }\n\n public reset(): any {\n this.selected.clear();\n this.expanded.clear();\n return this.getTreeRoot();\n }\n\n private initExpanded(): void {\n const key = joinPath('rxap/tree', this.id, 'expanded');\n let expanded = [];\n if (localStorage.getItem(key)) {\n try {\n expanded = JSON.parse(localStorage.getItem(key)!);\n } catch (e) {\n console.debug('parse expanded tree data source nodes failed');\n }\n }\n\n this.expanded = new SelectionModel<string>(\n this.metadata.expandMultiple !== false,\n expanded\n );\n this._expandedLocalStorageSubscription = this.expanded.changed\n .pipe(\n tap(() =>\n localStorage.setItem(key, JSON.stringify(this.expanded.selected))\n )\n )\n .subscribe();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tree.data-source.js","sourceRoot":"","sources":["../../../../../libs/tree/src/lib/tree.data-source.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,eAAe,EACf,IAAI,EACJ,KAAK,EAGN,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAEL,cAAc,EACf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,GAAG,EACH,SAAS,EACT,GAAG,EACJ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,cAAc,EAGd,yBAAyB,EAC1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,QAAQ,EACR,QAAQ,EAGT,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,MAAM,EACN,UAAU,EACV,cAAc,EACf,MAAM,eAAe,CAAC;AACvB,OAAO,EAEL,IAAI,EAKL,MAAM,sBAAsB,CAAC;;AAE9B,MAAM,UAAU,iBAAiB,CAAI,GAAQ;IAC3C,OAAO,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;AAC/E,CAAC;AAOD,MAAM,CAAC,MAAM,wCAAwC,GAAG,IAAI,cAAc,CACxE,0CAA0C,CAC3C,CAAC;AACF,MAAM,CAAC,MAAM,4C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YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAClE,CACF;aACA,SAAS,EAAE,CAAC;IACjB,CAAC;;2GAxaU,cAAc,kBAyBf,wCAAwC,aAExC,4CAA4C,aAE5C,yBAAyB;+GA7BxB,cAAc;AAKf;IAAT,QAAQ;8BAAsB,eAAe;mDAAa;2FALhD,cAAc;kBAD1B,UAAU;;0BA0BN,MAAM;2BAAC,wCAAwC;;0BAE/C,MAAM;2BAAC,4CAA4C;;0BAEnD,MAAM;2BAAC,yBAAyB;4CAxBlB,WAAW","sourcesContent":["import {\n BehaviorSubject,\n from,\n merge,\n Observable,\n Subscription\n} from 'rxjs';\nimport { FlatTreeControl } from '@angular/cdk/tree';\nimport {\n SelectionChange,\n SelectionModel\n} from '@angular/cdk/collections';\nimport {\n map,\n switchMap,\n tap\n} from 'rxjs/operators';\nimport {\n BaseDataSource,\n BaseDataSourceMetadata,\n BaseDataSourceViewer,\n RXAP_DATA_SOURCE_METADATA\n} from '@rxap/data-source';\nimport {\n joinPath,\n Required,\n WithChildren,\n WithIdentifier\n} from '@rxap/utilities';\nimport {\n Inject,\n Injectable,\n InjectionToken\n} from '@angular/core';\nimport {\n ExpandNodeFunction,\n Node,\n NodeGetIconFunction,\n NodeHasDetailsFunction,\n NodeToDisplayFunction,\n Method\n} from '@rxap/utilities/rxjs';\n\nexport function isSelectionChange<T>(obj: any): obj is SelectionChange<T> {\n return !!obj && obj.hasOwnProperty('added') && obj.hasOwnProperty('removed');\n}\n\nexport interface TreeDataSourceMetadata extends BaseDataSourceMetadata {\n selectMultiple?: boolean;\n expandMultiple?: boolean;\n}\n\nexport const RXAP_TREE_DATA_SOURCE_ROOT_REMOTE_METHOD = new InjectionToken(\n 'rxap/tree/data-source/root-remote-method'\n);\nexport const RXAP_TREE_DATA_SOURCE_CHILDREN_REMOTE_METHOD = new InjectionToken(\n 'rxap/tree/data-source/children-remote-method'\n);\n\n@Injectable()\nexport class TreeDataSource<\n Data extends WithIdentifier & WithChildren = any,\n RootParameters = any\n> extends BaseDataSource<Array<Node<Data>>> {\n public tree$ = new BehaviorSubject<Array<Node<Data>>>([]);\n @Required public treeControl!: FlatTreeControl<Node<Data>>;\n public selected!: SelectionModel<Node<Data>>;\n public expanded!: SelectionModel<string>;\n\n private _expandedLocalStorageSubscription: Subscription | null = null;\n private _selectedLocalStorageSubscription: Subscription | null = null;\n\n // TODO : änlich problem wie bei der redundaten expand SelectionModel.\n // im localStorage wird nur die id gespeichert.\n private _preSelected: string[] = [];\n\n protected _data$ = new BehaviorSubject<Array<Node<Data>>>([]);\n public metadata!: TreeDataSourceMetadata;\n\n public toDisplay: NodeToDisplayFunction<Data> = () =>\n 'to display function not defined';\n public getIcon: NodeGetIconFunction<Data> = () => null;\n public hasDetails: NodeHasDetailsFunction<Data> = () => true;\n\n constructor(\n @Inject(RXAP_TREE_DATA_SOURCE_ROOT_REMOTE_METHOD)\n public readonly rootRemoteMethod: Method<Data | Data[], RootParameters>,\n @Inject(RXAP_TREE_DATA_SOURCE_CHILDREN_REMOTE_METHOD)\n public readonly childrenRemoteMethod: Method<Data[], Node<Data>>,\n @Inject(RXAP_DATA_SOURCE_METADATA)\n metadata: TreeDataSourceMetadata | null = null\n ) {\n super(metadata);\n this.tree$\n .pipe(\n map((tree) =>\n tree\n .map((child) => this.flatTree(child))\n .reduce((acc, nodes) => [...acc, ...nodes], [])\n )\n )\n .subscribe(this._data$);\n\n // TODO add new SelectModel class that saves the select model to the localStorage\n this.initSelected();\n this.initExpanded();\n }\n\n public async getTreeRoot(): Promise<Array<Node<Data>>> {\n const root: Data | Data[] = await this.getRoot();\n\n let rootNodes: Array<Node<Data>>;\n\n if (Array.isArray(root)) {\n rootNodes = await Promise.all(root.map((node) => this._toNode(node)));\n } else {\n rootNodes = [await this._toNode(root)];\n }\n\n this.tree$.next(rootNodes);\n\n return rootNodes;\n }\n\n public selectNode(node: Node<Data>): Promise<void> {\n if (!this.selected.isMultipleSelection()) {\n if (this.selected.hasValue()) {\n const currentSelectedNode = this.selected.selected[0];\n currentSelectedNode.deselect();\n }\n }\n this.selected.select(node);\n return Promise.resolve();\n }\n\n public setTreeControl(treeControl: FlatTreeControl<Node<Data>>): void {\n this.treeControl = treeControl;\n }\n\n public setToDisplay(\n toDisplay: NodeToDisplayFunction<Data> = this.toDisplay\n ): void {\n this.toDisplay = toDisplay;\n }\n\n public setGetIcon(getIcon: NodeGetIconFunction<Data> = this.getIcon): void {\n this.getIcon = getIcon;\n }\n\n public setHasDetails(\n hasDetails: NodeHasDetailsFunction<Data> = this.hasDetails\n ): void {\n this.hasDetails = hasDetails;\n }\n\n public deselectNode(node: Node<Data>): Promise<void> {\n this.selected.deselect(node);\n return Promise.resolve();\n }\n\n // - the SelectModel that stores the selection into the local storage?\n public async _toNode(\n item: Data,\n depth: number = 0,\n onExpand: ExpandNodeFunction<Data> = this.expandNode.bind(this),\n onCollapse: ExpandNodeFunction<Data> = this.collapseNode.bind(this),\n onSelect: ExpandNodeFunction<Data> = this.selectNode.bind(this),\n onDeselect: ExpandNodeFunction<Data> = this.deselectNode.bind(this)\n ): Promise<Node<Data>> {\n const node = await this.toNode(\n item,\n depth,\n onExpand,\n onCollapse,\n onSelect,\n onDeselect\n );\n\n if (this.expanded.isSelected(node.id)) {\n await node\n .expand()\n .then(() => {\n // TODO : remove redundant this.expanded SelectionModel. Only store expanded nodes in this.treeControl.expansionModel\n // das problem ist das ich beim speicher in localStorage nur die id speicher.\n // Des wegen kann ich beim laden aus dem localStorage this.treeControl.expansionModel\n // nicht einfach mit den expanend nodes fullen. Da dort das node object benötigt wird\n // möglich lösungen:\n // - das node object läde die entity mithilfe der id automatisch nach\n this.treeControl.expansionModel.select(node);\n console.debug(`Restore expand for node '${node.id}' SUCCESSFULLY`);\n })\n .catch(() =>\n console.debug(`Restore expand for node '${node.id}' FAILED`)\n );\n }\n\n if (this._preSelected.includes(node.id)) {\n await node\n .select()\n .then(() =>\n console.debug(`Restore select for node '${node.id}' SUCCESSFULLY`)\n )\n .catch(() =>\n console.debug(`Restore select for node '${node.id}' FAILED`)\n );\n }\n\n return node;\n }\n\n public async expandNode(node: Node<Data>): Promise<void> {\n if (node.item.hasChildren && !node.item.children?.length) {\n node.isLoading$.enable();\n\n const children = await this.getChildren(node);\n\n // add the loaded children to the item object\n node.item.children = children;\n\n node.addChildren(\n await Promise.all(children.map((child) =>\n this._toNode(child, node.depth + 1, node.onExpand, node.onCollapse)\n ))\n );\n\n node.isLoading$.disable();\n }\n\n this.expanded.select(node.id);\n\n this.tree$.next(this.tree$.value);\n }\n\n public async getChildren(node: Node<Data>): Promise<Data[]> {\n return this.childrenRemoteMethod.call(node);\n }\n\n public async getRoot(): Promise<Data | Data[]> {\n const rootParameters = await this.getRootParameters();\n return this.rootRemoteMethod.call(rootParameters);\n }\n\n public async getRootParameters(): Promise<RootParameters> {\n return undefined as any;\n }\n\n // TODO : find better solution to allow the overwrite of the toNode method\n // without losing the custom preselect and preexpand function\n\n protected _connect(\n collectionViewer: Required<BaseDataSourceViewer>\n ): Observable<Array<Node<Data>>> {\n this.treeControl.expansionModel.changed.subscribe((change: any) => {\n if (isSelectionChange<Node<Data>>(change)) {\n if (change.added) {\n change.added.forEach((node) => node.expand());\n }\n if (change.removed) {\n change.removed\n .slice()\n .reverse()\n .forEach((node) => node.collapse());\n }\n }\n });\n\n let loadRoot: Promise<Array<Node<Data>> | void> = Promise.resolve();\n\n if (this.tree$.value.length === 0) {\n loadRoot = this.getTreeRoot();\n }\n\n return from(loadRoot).pipe(\n tap((rootNodes) => {\n if (rootNodes) {\n const promises: Promise<any>[] = [];\n if (this.metadata.selectMultiple) {\n if (!this.selected.hasValue()) {\n promises.push(\n ...rootNodes\n .filter((node) => node.hasDetails)\n .map((node) => node.select())\n );\n }\n if (!this.expanded.hasValue()) {\n promises.push(\n ...rootNodes\n .filter((node) => node.hasChildren)\n .map((node) => node.expand())\n );\n }\n } else if (rootNodes.length) {\n const rootNode = rootNodes[0];\n if (!this.selected.hasValue()) {\n // TODO : rename hasDetails to isSelectable\n if (rootNode.hasDetails) {\n promises.push(rootNode.select());\n }\n }\n if (!this.expanded.hasValue()) {\n promises.push(rootNode.expand());\n }\n }\n return Promise.all(promises);\n }\n return Promise.resolve();\n }),\n switchMap(() =>\n merge(collectionViewer.viewChange, this._data$).pipe(\n map(() => this._data$.value)\n )\n )\n );\n }\n\n public async toNode(\n item: Data,\n depth: number = 0,\n onExpand: ExpandNodeFunction<Data> = this.expandNode.bind(this),\n onCollapse: ExpandNodeFunction<Data> = this.collapseNode.bind(this),\n onSelect: ExpandNodeFunction<Data> = this.selectNode.bind(this),\n onDeselect: ExpandNodeFunction<Data> = this.deselectNode.bind(this)\n ): Promise<Node<Data>> {\n return Node.ToNode(\n item,\n depth,\n onExpand,\n onCollapse,\n this.toDisplay,\n this.getIcon,\n onSelect,\n onDeselect,\n this.hasDetails\n );\n }\n\n public collapseNode(node: Node<Data>): Promise<void> {\n this.expanded.deselect(node.id);\n\n this.tree$.next(this.tree$.value);\n\n return Promise.resolve();\n }\n\n public flatTree(tree: Node<Data>): Array<Node<Data>> {\n function flat(acc: any[], list: any[]) {\n return [...acc, ...list];\n }\n\n const flatTree = (node: Node<Data>): Array<Node<Data>> => {\n if (!Array.isArray(node.children)) {\n console.log(node);\n throw new Error('Node has not defined children');\n }\n\n if (node.expanded || this.expanded.isSelected(node.id)) {\n return [\n node,\n ...node.children.map((child) => flatTree(child)).reduce(flat, []),\n ];\n } else {\n return [node];\n }\n };\n\n return flatTree(tree);\n }\n\n public destroy(): void {\n super.destroy();\n // TODO : add subscription handler to BaseDataSource\n if (this._expandedLocalStorageSubscription) {\n this._expandedLocalStorageSubscription.unsubscribe();\n }\n if (this._selectedLocalStorageSubscription) {\n this._selectedLocalStorageSubscription.unsubscribe();\n }\n }\n\n public getNodeById(id: string): Node<Data> | null {\n function getNodeById(node: Node<Data>, nodeId: string) {\n if (node.id === nodeId) {\n return node;\n }\n if (node.hasNode(nodeId)) {\n return node.getNode(nodeId);\n } else {\n return null;\n }\n }\n\n return (\n this.tree$.value\n .map((node) => getNodeById(node, id))\n .filter(Boolean)[0] || null\n );\n }\n\n private initSelected(): void {\n const key = joinPath('rxap/tree', this.id, 'selected');\n if (localStorage.getItem(key)) {\n try {\n this._preSelected = JSON.parse(localStorage.getItem(key)!);\n } catch (e) {\n console.debug('parse expanded tree data source nodes failed');\n }\n }\n\n this.selected = new SelectionModel<Node<Data>>(\n !!this.metadata.selectMultiple,\n []\n );\n this._selectedLocalStorageSubscription = this.selected.changed\n .pipe(\n tap(() =>\n localStorage.setItem(\n key,\n JSON.stringify(this.selected.selected.map((s) => s.id))\n )\n )\n )\n .subscribe();\n }\n\n public async refresh(): Promise<any> {\n const rootNodes = await this.getTreeRoot();\n\n // refresh all expanded nodes;\n\n const loadExpandedNodes = async (children: ReadonlyArray<Node<Data>>) => {\n for (const child of children) {\n if (this.expanded.isSelected(child.id)) {\n // call the node method to ensure that the expanded property of\n // Node is set.\n await child.expand();\n }\n\n if (child.hasChildren) {\n await loadExpandedNodes(child.children);\n }\n }\n };\n\n await Promise.all(\n rootNodes\n .filter((node) => node.hasChildren)\n .map((node) => loadExpandedNodes(node.children))\n );\n\n const selected: Array<Node<Data>> = this.selected.selected\n .map((node) => this.getNodeById(node.id))\n .filter(Boolean) as any;\n this.selected.clear();\n this.selected.select(...selected);\n }\n\n public reset(): any {\n this.selected.clear();\n this.expanded.clear();\n return this.getTreeRoot();\n }\n\n private initExpanded(): void {\n const key = joinPath('rxap/tree', this.id, 'expanded');\n let expanded = [];\n if (localStorage.getItem(key)) {\n try {\n expanded = JSON.parse(localStorage.getItem(key)!);\n } catch (e) {\n console.debug('parse expanded tree data source nodes failed');\n }\n }\n\n this.expanded = new SelectionModel<string>(\n this.metadata.expandMultiple !== false,\n expanded\n );\n this._expandedLocalStorageSubscription = this.expanded.changed\n .pipe(\n tap(() =>\n localStorage.setItem(key, JSON.stringify(this.expanded.selected))\n )\n )\n .subscribe();\n }\n}\n"]}
|
package/fesm2015/rxap-tree.js
CHANGED
|
@@ -8,25 +8,27 @@ import { joinPath, Required, DebounceCall } from '@rxap/utilities';
|
|
|
8
8
|
import * as i0 from '@angular/core';
|
|
9
9
|
import { InjectionToken, Injectable, Inject, TemplateRef, Directive, EventEmitter, ViewContainerRef, ChangeDetectorRef, Component, ChangeDetectionStrategy, Optional, Input, ContentChild, Output, ViewChild, HostListener, NgModule } from '@angular/core';
|
|
10
10
|
import { Node } from '@rxap/utilities/rxjs';
|
|
11
|
-
import * as
|
|
11
|
+
import * as i12 from '@angular/cdk/portal';
|
|
12
12
|
import { TemplatePortal, PortalModule } from '@angular/cdk/portal';
|
|
13
13
|
import * as i1 from '@angular/material/tree';
|
|
14
14
|
import { MatTreeModule } from '@angular/material/tree';
|
|
15
15
|
import * as i2 from '@angular/material/icon';
|
|
16
16
|
import { MatIconModule } from '@angular/material/icon';
|
|
17
|
-
import * as i3 from '@angular/material/
|
|
17
|
+
import * as i3 from '@angular/material/checkbox';
|
|
18
|
+
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
19
|
+
import * as i4 from '@angular/material/button';
|
|
18
20
|
import { MatButtonModule } from '@angular/material/button';
|
|
19
|
-
import * as
|
|
21
|
+
import * as i5 from '@angular/material/progress-spinner';
|
|
20
22
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
21
|
-
import * as
|
|
23
|
+
import * as i6 from '@angular/material/divider';
|
|
22
24
|
import { MatDividerModule } from '@angular/material/divider';
|
|
23
|
-
import * as
|
|
24
|
-
import * as
|
|
25
|
+
import * as i7 from '@angular/flex-layout/flex';
|
|
26
|
+
import * as i8 from '@angular/common';
|
|
25
27
|
import { CommonModule } from '@angular/common';
|
|
26
|
-
import * as
|
|
27
|
-
import * as
|
|
28
|
+
import * as i9 from '@angular/flex-layout/extended';
|
|
29
|
+
import * as i10 from '@rxap/material-directives/icon';
|
|
28
30
|
import { IconDirectiveModule } from '@rxap/material-directives/icon';
|
|
29
|
-
import * as
|
|
31
|
+
import * as i11 from '@rxap/contenteditable';
|
|
30
32
|
import { ContenteditableDirectiveModule } from '@rxap/contenteditable';
|
|
31
33
|
import { FlexLayoutModule } from '@angular/flex-layout';
|
|
32
34
|
|
|
@@ -64,10 +66,10 @@ class TreeDataSource extends BaseDataSource {
|
|
|
64
66
|
const root = yield this.getRoot();
|
|
65
67
|
let rootNodes;
|
|
66
68
|
if (Array.isArray(root)) {
|
|
67
|
-
rootNodes = root.map((node) => this._toNode(node));
|
|
69
|
+
rootNodes = yield Promise.all(root.map((node) => this._toNode(node)));
|
|
68
70
|
}
|
|
69
71
|
else {
|
|
70
|
-
rootNodes = [this._toNode(root)];
|
|
72
|
+
rootNodes = [yield this._toNode(root)];
|
|
71
73
|
}
|
|
72
74
|
this.tree$.next(rootNodes);
|
|
73
75
|
return rootNodes;
|
|
@@ -101,29 +103,31 @@ class TreeDataSource extends BaseDataSource {
|
|
|
101
103
|
}
|
|
102
104
|
// - the SelectModel that stores the selection into the local storage?
|
|
103
105
|
_toNode(item, depth = 0, onExpand = this.expandNode.bind(this), onCollapse = this.collapseNode.bind(this), onSelect = this.selectNode.bind(this), onDeselect = this.deselectNode.bind(this)) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
node
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
node
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
106
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
+
const node = yield this.toNode(item, depth, onExpand, onCollapse, onSelect, onDeselect);
|
|
108
|
+
if (this.expanded.isSelected(node.id)) {
|
|
109
|
+
yield node
|
|
110
|
+
.expand()
|
|
111
|
+
.then(() => {
|
|
112
|
+
// TODO : remove redundant this.expanded SelectionModel. Only store expanded nodes in this.treeControl.expansionModel
|
|
113
|
+
// das problem ist das ich beim speicher in localStorage nur die id speicher.
|
|
114
|
+
// Des wegen kann ich beim laden aus dem localStorage this.treeControl.expansionModel
|
|
115
|
+
// nicht einfach mit den expanend nodes fullen. Da dort das node object benötigt wird
|
|
116
|
+
// möglich lösungen:
|
|
117
|
+
// - das node object läde die entity mithilfe der id automatisch nach
|
|
118
|
+
this.treeControl.expansionModel.select(node);
|
|
119
|
+
console.debug(`Restore expand for node '${node.id}' SUCCESSFULLY`);
|
|
120
|
+
})
|
|
121
|
+
.catch(() => console.debug(`Restore expand for node '${node.id}' FAILED`));
|
|
122
|
+
}
|
|
123
|
+
if (this._preSelected.includes(node.id)) {
|
|
124
|
+
yield node
|
|
125
|
+
.select()
|
|
126
|
+
.then(() => console.debug(`Restore select for node '${node.id}' SUCCESSFULLY`))
|
|
127
|
+
.catch(() => console.debug(`Restore select for node '${node.id}' FAILED`));
|
|
128
|
+
}
|
|
129
|
+
return node;
|
|
130
|
+
});
|
|
127
131
|
}
|
|
128
132
|
expandNode(node) {
|
|
129
133
|
var _a;
|
|
@@ -133,7 +137,7 @@ class TreeDataSource extends BaseDataSource {
|
|
|
133
137
|
const children = yield this.getChildren(node);
|
|
134
138
|
// add the loaded children to the item object
|
|
135
139
|
node.item.children = children;
|
|
136
|
-
node.addChildren(children.map((child) => this._toNode(child, node.depth + 1, node.onExpand, node.onCollapse)));
|
|
140
|
+
node.addChildren(yield Promise.all(children.map((child) => this._toNode(child, node.depth + 1, node.onExpand, node.onCollapse))));
|
|
137
141
|
node.isLoading$.disable();
|
|
138
142
|
}
|
|
139
143
|
this.expanded.select(node.id);
|
|
@@ -147,7 +151,13 @@ class TreeDataSource extends BaseDataSource {
|
|
|
147
151
|
}
|
|
148
152
|
getRoot() {
|
|
149
153
|
return __awaiter(this, void 0, void 0, function* () {
|
|
150
|
-
|
|
154
|
+
const rootParameters = yield this.getRootParameters();
|
|
155
|
+
return this.rootRemoteMethod.call(rootParameters);
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
getRootParameters() {
|
|
159
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
160
|
+
return undefined;
|
|
151
161
|
});
|
|
152
162
|
}
|
|
153
163
|
// TODO : find better solution to allow the overwrite of the toNode method
|
|
@@ -203,7 +213,9 @@ class TreeDataSource extends BaseDataSource {
|
|
|
203
213
|
}), switchMap(() => merge(collectionViewer.viewChange, this._data$).pipe(map(() => this._data$.value))));
|
|
204
214
|
}
|
|
205
215
|
toNode(item, depth = 0, onExpand = this.expandNode.bind(this), onCollapse = this.collapseNode.bind(this), onSelect = this.selectNode.bind(this), onDeselect = this.deselectNode.bind(this)) {
|
|
206
|
-
return
|
|
216
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
217
|
+
return Node.ToNode(item, depth, onExpand, onCollapse, this.toDisplay, this.getIcon, onSelect, onDeselect, this.hasDetails);
|
|
218
|
+
});
|
|
207
219
|
}
|
|
208
220
|
collapseNode(node) {
|
|
209
221
|
this.expanded.deselect(node.id);
|
|
@@ -364,6 +376,7 @@ class TreeComponent {
|
|
|
364
376
|
this.viewContainerRef = viewContainerRef;
|
|
365
377
|
this.cdr = cdr;
|
|
366
378
|
this.renderer = renderer;
|
|
379
|
+
this.multiple = false;
|
|
367
380
|
this.hideLeafIcon = false;
|
|
368
381
|
this.details = new EventEmitter();
|
|
369
382
|
this.portal = null;
|
|
@@ -389,10 +402,12 @@ class TreeComponent {
|
|
|
389
402
|
return !!this.contentEditableMethod;
|
|
390
403
|
}
|
|
391
404
|
ngOnInit() {
|
|
405
|
+
var _a;
|
|
392
406
|
this.dataSource.setTreeControl(this.treeControl);
|
|
393
407
|
this.dataSource.setToDisplay(this.toDisplay);
|
|
394
408
|
this.dataSource.setGetIcon(this.getIcon);
|
|
395
409
|
this.dataSource.setHasDetails(this.hasDetails);
|
|
410
|
+
this.multiple = (_a = this.dataSource.metadata.selectMultiple) !== null && _a !== void 0 ? _a : this.multiple;
|
|
396
411
|
if (this.dataSource.selected.hasValue()) {
|
|
397
412
|
this.dataSource.selected.selected.forEach((node) => this.openDetails(node));
|
|
398
413
|
}
|
|
@@ -436,7 +451,7 @@ class TreeComponent {
|
|
|
436
451
|
}
|
|
437
452
|
}
|
|
438
453
|
TreeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: TreeComponent, deps: [{ token: ViewContainerRef }, { token: ChangeDetectorRef }, { token: RXAP_TREE_CONTENT_EDITABLE_METHOD, optional: true }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
|
|
439
|
-
TreeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.0.1", type: TreeComponent, selector: "rxap-tree", inputs: { dataSource: "dataSource", contentEditableMethod: "contentEditableMethod", toDisplay: "toDisplay", getIcon: "getIcon", hasDetails: "hasDetails", hideLeafIcon: "hideLeafIcon" }, outputs: { details: "details" }, host: { listeners: { "mouseup": "onMouseup()", "mousemove": "onMousemove($event)" } }, queries: [{ propertyName: "content", first: true, predicate: TreeContentDirective, descendants: true, static: true }], viewQueries: [{ propertyName: "treeContainer", first: true, predicate: ["treeContainer"], descendants: true, static: true }], ngImport: i0, template: "<div fxLayout=\"row\">\n <div #treeContainer class=\"tree-container\" fxFlex=\"nogrow\">\n <mat-tree *ngIf=\"dataSource; else loading\" [dataSource]=\"dataSource\" [treeControl]=\"treeControl\" class=\"tree-view\">\n\n <!-- Node without children -->\n <mat-tree-node *matTreeNodeDef=\"let node\" matTreeNodePadding>\n <div fxLayout=\"row\" fxLayoutAlign=\"start center\">\n <mat-icon [fxHide]=\"hideLeafIcon\" fxFlex=\"40px\">subdirectory_arrow_right</mat-icon>\n <mat-icon *ngIf=\"node.icon\" [rxapIcon]=\"node.icon\" fxFlex=\"40px\"></mat-icon>\n <
|
|
454
|
+
TreeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.0.1", type: TreeComponent, selector: "rxap-tree", inputs: { dataSource: "dataSource", contentEditableMethod: "contentEditableMethod", toDisplay: "toDisplay", getIcon: "getIcon", multiple: "multiple", hasDetails: "hasDetails", hideLeafIcon: "hideLeafIcon" }, outputs: { details: "details" }, host: { listeners: { "mouseup": "onMouseup()", "mousemove": "onMousemove($event)" } }, queries: [{ propertyName: "content", first: true, predicate: TreeContentDirective, descendants: true, static: true }], viewQueries: [{ propertyName: "treeContainer", first: true, predicate: ["treeContainer"], descendants: true, static: true }], ngImport: i0, template: "<div class=\"container\" fxLayout=\"row\">\n <div #treeContainer class=\"tree-container\" fxFlex=\"nogrow\">\n <mat-tree *ngIf=\"dataSource; else loading\" [dataSource]=\"dataSource\" [treeControl]=\"treeControl\" class=\"tree-view\">\n\n <!-- Node without children -->\n <mat-tree-node *matTreeNodeDef=\"let node\" matTreeNodePadding>\n <div fxLayout=\"row\" fxLayoutAlign=\"start center\">\n <mat-icon [fxHide]=\"hideLeafIcon\" fxFlex=\"40px\">subdirectory_arrow_right</mat-icon>\n <mat-icon *ngIf=\"node.icon\" [rxapIcon]=\"node.icon\" fxFlex=\"40px\"></mat-icon>\n <ng-template [ngIf]=\"multiple\">\n <mat-checkbox (change)=\"node.toggleSelect()\" [checked]=\"node.selected\" [disabled]=\"!node.hasDetails\" fxFlex=\"nogrow\">{{ node.display }}</mat-checkbox>\n </ng-template>\n <ng-template [ngIf]=\"!multiple\">\n <button\n (click)=\"node.select()\"\n [color]=\"node.selected ? 'primary' : null\"\n [disabled]=\"!node.hasDetails\"\n fxFlex=\"nogrow\"\n mat-button\n >\n {{ node.display }}\n </button>\n </ng-template>\n </div>\n </mat-tree-node>\n\n <!-- Node with children -->\n <mat-tree-node *matTreeNodeDef=\"let node; when: hasChild\" matTreeNodePadding>\n <button [attr.aria-label]=\"'toggle ' + node.filename\" mat-icon-button matTreeNodeToggle>\n <mat-icon class=\"mat-icon-rtl-mirror\">\n {{ treeControl.isExpanded(node) ? 'expand_more' : 'chevron_right' }}\n </mat-icon>\n </button>\n <div fxLayout=\"row\" fxLayoutAlign=\"start center\">\n <mat-icon *ngIf=\"node.icon; else withoutIcon\" [rxapIcon]=\"node.icon\" fxFlex=\"40px\"></mat-icon>\n <ng-template #withoutIcon>\n <div fxFlex=\"0\"></div>\n </ng-template>\n <ng-template [ngIfElse]=\"withoutDetails\" [ngIf]=\"node.hasDetails\">\n <button\n (click)=\"node.select()\"\n [color]=\"node.selected ? 'primary' : null\"\n fxFlex=\"nogrow\"\n mat-button\n >\n {{ node.display }}\n </button>\n </ng-template>\n <ng-template #withoutDetails>\n <span\n (change)=\"onContentEditableChange($event, node)\"\n [disabled]=\"!nodeDisplayEditable\"\n fxFlex=\"nogrow\"\n rxapContenteditable>\n {{ node.display }}\n </span>\n </ng-template>\n <mat-progress-spinner\n *ngIf=\"node.isLoading$ | async\"\n [diameter]=\"16\"\n fxFlex=\"nogrow\"\n fxFlexOffset=\"16px\"\n mode=\"indeterminate\"\n ></mat-progress-spinner>\n </div>\n </mat-tree-node>\n\n </mat-tree>\n </div>\n\n <div (mousedown)=\"onMousedown()\"\n class=\"divider\"\n fxFlex=\"nogrow\">\n <mat-divider\n [vertical]=\"true\"\n >\n </mat-divider>\n </div>\n\n <div class=\"details\" fxFlex=\"grow\">\n <ng-template [cdkPortalOutlet]=\"portal\"></ng-template>\n <ng-content></ng-content>\n </div>\n</div>\n\n<ng-template #loading>Load data source</ng-template>\n", styles: [".container{height:100%}.tree-view{background-color:transparent;background-color:initial}.details,.tree-container{max-height:calc(100vh - 64px - 32px);overflow-y:auto}.tree-container{min-width:-webkit-fit-content;min-width:-moz-fit-content;min-width:fit-content}.divider{cursor:ew-resize;padding:12px}.divider ::ng-deep .mat-divider{height:100%}"], components: [{ type: i1.MatTree, selector: "mat-tree", exportAs: ["matTree"] }, { type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i3.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "id", "labelPosition", "name", "required", "checked", "disabled", "indeterminate", "aria-describedby", "value"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { type: i4.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i5.MatProgressSpinner, selector: "mat-progress-spinner", inputs: ["color", "mode", "diameter", "strokeWidth", "value"], exportAs: ["matProgressSpinner"] }, { type: i6.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }], directives: [{ type: i7.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { type: i7.DefaultFlexDirective, selector: " [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md], [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md], [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm], [fxFlex.gt-md], [fxFlex.gt-lg]", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }, { type: i8.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.MatTreeNodeDef, selector: "[matTreeNodeDef]", inputs: ["matTreeNodeDefWhen", "matTreeNode"] }, { type: i1.MatTreeNode, selector: "mat-tree-node", inputs: ["role", "disabled", "tabIndex"], exportAs: ["matTreeNode"] }, { type: i1.MatTreeNodePadding, selector: "[matTreeNodePadding]", inputs: ["matTreeNodePadding", "matTreeNodePaddingIndent"] }, { type: i7.DefaultLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { type: i9.DefaultShowHideDirective, selector: " [fxShow], [fxShow.print], [fxShow.xs], [fxShow.sm], [fxShow.md], [fxShow.lg], [fxShow.xl], [fxShow.lt-sm], [fxShow.lt-md], [fxShow.lt-lg], [fxShow.lt-xl], [fxShow.gt-xs], [fxShow.gt-sm], [fxShow.gt-md], [fxShow.gt-lg], [fxHide], [fxHide.print], [fxHide.xs], [fxHide.sm], [fxHide.md], [fxHide.lg], [fxHide.xl], [fxHide.lt-sm], [fxHide.lt-md], [fxHide.lt-lg], [fxHide.lt-xl], [fxHide.gt-xs], [fxHide.gt-sm], [fxHide.gt-md], [fxHide.gt-lg]", inputs: ["fxShow", "fxShow.print", "fxShow.xs", "fxShow.sm", "fxShow.md", "fxShow.lg", "fxShow.xl", "fxShow.lt-sm", "fxShow.lt-md", "fxShow.lt-lg", "fxShow.lt-xl", "fxShow.gt-xs", "fxShow.gt-sm", "fxShow.gt-md", "fxShow.gt-lg", "fxHide", "fxHide.print", "fxHide.xs", "fxHide.sm", "fxHide.md", "fxHide.lg", "fxHide.xl", "fxHide.lt-sm", "fxHide.lt-md", "fxHide.lt-lg", "fxHide.lt-xl", "fxHide.gt-xs", "fxHide.gt-sm", "fxHide.gt-md", "fxHide.gt-lg"] }, { type: i10.IconDirective, selector: "mat-icon[rxapIcon]", inputs: ["rxapIcon"] }, { type: i1.MatTreeNodeToggle, selector: "[matTreeNodeToggle]", inputs: ["matTreeNodeToggleRecursive"] }, { type: i11.ContenteditableDirective, selector: "[rxapContenteditable]", inputs: ["rxapContenteditable", "disabled"], outputs: ["change"] }, { type: i7.DefaultFlexOffsetDirective, selector: " [fxFlexOffset], [fxFlexOffset.xs], [fxFlexOffset.sm], [fxFlexOffset.md], [fxFlexOffset.lg], [fxFlexOffset.xl], [fxFlexOffset.lt-sm], [fxFlexOffset.lt-md], [fxFlexOffset.lt-lg], [fxFlexOffset.lt-xl], [fxFlexOffset.gt-xs], [fxFlexOffset.gt-sm], [fxFlexOffset.gt-md], [fxFlexOffset.gt-lg]", inputs: ["fxFlexOffset", "fxFlexOffset.xs", "fxFlexOffset.sm", "fxFlexOffset.md", "fxFlexOffset.lg", "fxFlexOffset.xl", "fxFlexOffset.lt-sm", "fxFlexOffset.lt-md", "fxFlexOffset.lt-lg", "fxFlexOffset.lt-xl", "fxFlexOffset.gt-xs", "fxFlexOffset.gt-sm", "fxFlexOffset.gt-md", "fxFlexOffset.gt-lg"] }, { type: i12.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }], pipes: { "async": i8.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
440
455
|
__decorate([
|
|
441
456
|
Required,
|
|
442
457
|
__metadata("design:type", TreeDataSource)
|
|
@@ -475,6 +490,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImpor
|
|
|
475
490
|
type: Input
|
|
476
491
|
}], getIcon: [{
|
|
477
492
|
type: Input
|
|
493
|
+
}], multiple: [{
|
|
494
|
+
type: Input
|
|
478
495
|
}], hasDetails: [{
|
|
479
496
|
type: Input
|
|
480
497
|
}], content: [{
|
|
@@ -507,7 +524,8 @@ TreeComponentModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", ver
|
|
|
507
524
|
MatProgressSpinnerModule,
|
|
508
525
|
PortalModule,
|
|
509
526
|
ContenteditableDirectiveModule,
|
|
510
|
-
IconDirectiveModule
|
|
527
|
+
IconDirectiveModule,
|
|
528
|
+
MatCheckboxModule], exports: [TreeComponent, TreeContentDirective] });
|
|
511
529
|
TreeComponentModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: TreeComponentModule, imports: [[
|
|
512
530
|
CommonModule,
|
|
513
531
|
MatTreeModule,
|
|
@@ -518,7 +536,8 @@ TreeComponentModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", ver
|
|
|
518
536
|
MatProgressSpinnerModule,
|
|
519
537
|
PortalModule,
|
|
520
538
|
ContenteditableDirectiveModule,
|
|
521
|
-
IconDirectiveModule
|
|
539
|
+
IconDirectiveModule,
|
|
540
|
+
MatCheckboxModule
|
|
522
541
|
]] });
|
|
523
542
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: TreeComponentModule, decorators: [{
|
|
524
543
|
type: NgModule,
|
|
@@ -533,7 +552,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImpor
|
|
|
533
552
|
MatProgressSpinnerModule,
|
|
534
553
|
PortalModule,
|
|
535
554
|
ContenteditableDirectiveModule,
|
|
536
|
-
IconDirectiveModule
|
|
555
|
+
IconDirectiveModule,
|
|
556
|
+
MatCheckboxModule
|
|
537
557
|
],
|
|
538
558
|
declarations: [TreeComponent, TreeContentDirective],
|
|
539
559
|
exports: [TreeComponent, TreeContentDirective],
|