-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: import cycles would need to be created to compile this component…
… #INFR-2077
- Loading branch information
1 parent
5a6a1a7
commit f3eba0b
Showing
15 changed files
with
332 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { InjectionToken } from '@angular/core'; | ||
|
||
export interface ThyConfirmAbstractComponent { | ||
okText: string; | ||
okType: string; | ||
cancelText: string; | ||
okLoadingText: string; | ||
} | ||
|
||
export const THY_CONFIRM_COMPONENT_TOKEN = new InjectionToken<ThyConfirmAbstractComponent>('thy-confirm-component-token'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
export * from './module'; | ||
export * from './tree-select.component'; | ||
export * from './tree-select.class'; | ||
export { ThyTreeSelectNodesComponent } from './tree-select-nodes.component'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,112 +1,112 @@ | ||
import { BehaviorSubject, Subject } from 'rxjs'; | ||
import { Component, OnInit, HostBinding, Input } from '@angular/core'; | ||
import { ThyTreeSelectComponent } from './tree-select.component'; | ||
import { ThyTreeSelectNode } from './tree-select.class'; | ||
|
||
@Component({ | ||
selector: 'thy-tree-select-nodes', | ||
templateUrl: './tree-select-nodes.component.html' | ||
}) | ||
export class ThyTreeSelectNodesComponent implements OnInit { | ||
@HostBinding('class') class: string; | ||
|
||
@Input() treeNodes: ThyTreeSelectNode[]; | ||
|
||
public primaryKey = this.parent.thyPrimaryKey; | ||
|
||
public showKey = this.parent.thyShowKey; | ||
|
||
public isMultiple = this.parent.thyMultiple; | ||
|
||
public valueIsObject = this.parent.valueIsObject; | ||
|
||
public selectedValue = this.parent.selectedValue; | ||
|
||
public childCountKey = this.parent.thyChildCountKey; | ||
|
||
public treeNodeTemplateRef = this.parent.treeNodeTemplateRef; | ||
|
||
constructor(public parent: ThyTreeSelectComponent) {} | ||
|
||
ngOnInit() { | ||
this.class = this.isMultiple ? 'thy-tree-select-dropdown thy-tree-select-dropdown-multiple' : 'thy-tree-select-dropdown'; | ||
} | ||
|
||
treeNodeIsSelected(node: ThyTreeSelectNode) { | ||
if (this.parent.thyMultiple) { | ||
return (this.parent.selectedNodes || []).find(item => { | ||
return item[this.primaryKey] === node[this.primaryKey]; | ||
}); | ||
} else { | ||
return this.parent.selectedNode && this.parent.selectedNode[this.primaryKey] === node[this.primaryKey]; | ||
} | ||
} | ||
|
||
treeNodeIsHidden(node: ThyTreeSelectNode) { | ||
if (this.parent.thyHiddenNodeKey) { | ||
return node[this.parent.thyHiddenNodeKey]; | ||
} | ||
if (this.parent.thyHiddenNodeFn) { | ||
return this.parent.thyHiddenNodeFn(node); | ||
} | ||
return false; | ||
} | ||
|
||
treeNodeIsDisable(node: ThyTreeSelectNode) { | ||
if (this.parent.thyDisableNodeKey) { | ||
return node[this.parent.thyDisableNodeKey]; | ||
} | ||
if (this.parent.thyDisableNodeFn) { | ||
return this.parent.thyDisableNodeFn(node); | ||
} | ||
return false; | ||
} | ||
|
||
treeNodeIsExpand(node: ThyTreeSelectNode) { | ||
let isSelectedNodeParent = false; | ||
if (this.parent.thyMultiple) { | ||
isSelectedNodeParent = !!(this.parent.selectedNodes || []).find(item => { | ||
return item.parentValues.indexOf(node[this.primaryKey]) > -1; | ||
}); | ||
} else { | ||
isSelectedNodeParent = this.parent.selectedNode | ||
? this.parent.selectedNode.parentValues.indexOf(node[this.primaryKey]) > -1 | ||
: false; | ||
} | ||
const isExpand = node.expand || (Object.keys(node).indexOf('expand') < 0 && isSelectedNodeParent); | ||
node.expand = isExpand; | ||
return isExpand; | ||
} | ||
|
||
getNodeChildren(node: ThyTreeSelectNode) { | ||
return this.parent.getNodeChildren(node); | ||
} | ||
|
||
selectTreeNode(event: Event, node: ThyTreeSelectNode) { | ||
event.stopPropagation(); | ||
if (this.treeNodeIsDisable(node)) { | ||
return; | ||
} | ||
this.parent.selectNode(node); | ||
} | ||
|
||
nodeExpandToggle(event: Event, node: ThyTreeSelectNode) { | ||
event.stopPropagation(); | ||
if (Object.keys(node).indexOf('expand') > -1) { | ||
node.expand = !node.expand; | ||
} else { | ||
if (this.treeNodeIsExpand(node)) { | ||
node.expand = false; | ||
} else { | ||
node.expand = true; | ||
} | ||
} | ||
|
||
if (node.expand && this.parent.thyAsyncNode) { | ||
this.getNodeChildren(node).subscribe(() => { | ||
this.parent.setPosition(); | ||
}); | ||
} | ||
this.parent.setPosition(); | ||
} | ||
} | ||
// import { BehaviorSubject, Subject } from 'rxjs'; | ||
// import { Component, OnInit, HostBinding, Input } from '@angular/core'; | ||
// import { ThyTreeSelectComponent } from './tree-select.component'; | ||
// import { ThyTreeSelectNode } from './tree-select.class'; | ||
|
||
// @Component({ | ||
// selector: 'thy-tree-select-nodes', | ||
// templateUrl: './tree-select-nodes.component.html' | ||
// }) | ||
// export class ThyTreeSelectNodesComponent implements OnInit { | ||
// @HostBinding('class') class: string; | ||
|
||
// @Input() treeNodes: ThyTreeSelectNode[]; | ||
|
||
// public primaryKey = this.parent.thyPrimaryKey; | ||
|
||
// public showKey = this.parent.thyShowKey; | ||
|
||
// public isMultiple = this.parent.thyMultiple; | ||
|
||
// public valueIsObject = this.parent.valueIsObject; | ||
|
||
// public selectedValue = this.parent.selectedValue; | ||
|
||
// public childCountKey = this.parent.thyChildCountKey; | ||
|
||
// public treeNodeTemplateRef = this.parent.treeNodeTemplateRef; | ||
|
||
// constructor(public parent: ThyTreeSelectComponent) {} | ||
|
||
// ngOnInit() { | ||
// this.class = this.isMultiple ? 'thy-tree-select-dropdown thy-tree-select-dropdown-multiple' : 'thy-tree-select-dropdown'; | ||
// } | ||
|
||
// treeNodeIsSelected(node: ThyTreeSelectNode) { | ||
// if (this.parent.thyMultiple) { | ||
// return (this.parent.selectedNodes || []).find(item => { | ||
// return item[this.primaryKey] === node[this.primaryKey]; | ||
// }); | ||
// } else { | ||
// return this.parent.selectedNode && this.parent.selectedNode[this.primaryKey] === node[this.primaryKey]; | ||
// } | ||
// } | ||
|
||
// treeNodeIsHidden(node: ThyTreeSelectNode) { | ||
// if (this.parent.thyHiddenNodeKey) { | ||
// return node[this.parent.thyHiddenNodeKey]; | ||
// } | ||
// if (this.parent.thyHiddenNodeFn) { | ||
// return this.parent.thyHiddenNodeFn(node); | ||
// } | ||
// return false; | ||
// } | ||
|
||
// treeNodeIsDisable(node: ThyTreeSelectNode) { | ||
// if (this.parent.thyDisableNodeKey) { | ||
// return node[this.parent.thyDisableNodeKey]; | ||
// } | ||
// if (this.parent.thyDisableNodeFn) { | ||
// return this.parent.thyDisableNodeFn(node); | ||
// } | ||
// return false; | ||
// } | ||
|
||
// treeNodeIsExpand(node: ThyTreeSelectNode) { | ||
// let isSelectedNodeParent = false; | ||
// if (this.parent.thyMultiple) { | ||
// isSelectedNodeParent = !!(this.parent.selectedNodes || []).find(item => { | ||
// return item.parentValues.indexOf(node[this.primaryKey]) > -1; | ||
// }); | ||
// } else { | ||
// isSelectedNodeParent = this.parent.selectedNode | ||
// ? this.parent.selectedNode.parentValues.indexOf(node[this.primaryKey]) > -1 | ||
// : false; | ||
// } | ||
// const isExpand = node.expand || (Object.keys(node).indexOf('expand') < 0 && isSelectedNodeParent); | ||
// node.expand = isExpand; | ||
// return isExpand; | ||
// } | ||
|
||
// getNodeChildren(node: ThyTreeSelectNode) { | ||
// return this.parent.getNodeChildren(node); | ||
// } | ||
|
||
// selectTreeNode(event: Event, node: ThyTreeSelectNode) { | ||
// event.stopPropagation(); | ||
// if (this.treeNodeIsDisable(node)) { | ||
// return; | ||
// } | ||
// this.parent.selectNode(node); | ||
// } | ||
|
||
// nodeExpandToggle(event: Event, node: ThyTreeSelectNode) { | ||
// event.stopPropagation(); | ||
// if (Object.keys(node).indexOf('expand') > -1) { | ||
// node.expand = !node.expand; | ||
// } else { | ||
// if (this.treeNodeIsExpand(node)) { | ||
// node.expand = false; | ||
// } else { | ||
// node.expand = true; | ||
// } | ||
// } | ||
|
||
// if (node.expand && this.parent.thyAsyncNode) { | ||
// this.getNodeChildren(node).subscribe(() => { | ||
// this.parent.setPosition(); | ||
// }); | ||
// } | ||
// this.parent.setPosition(); | ||
// } | ||
// } |
Oops, something went wrong.