Browse Source

UI: Refactoring

pull/12888/head
Artem Dzhereleiko 2 years ago
parent
commit
492ae5dece
  1. 6
      ui-ngx/src/app/shared/components/nav-tree.component.ts
  2. 1
      ui-ngx/src/typings/jquery.jstree.typings.d.ts

6
ui-ngx/src/app/shared/components/nav-tree.component.ts

@ -52,6 +52,10 @@ export interface NavTreeEditCallbacks {
clearSearch?: () => void; clearSearch?: () => void;
} }
interface JSTreeEventDataWithAction extends JSTreeEventData {
action: string;
}
export type NodesCallback = (nodes: NavTreeNode[]) => void; export type NodesCallback = (nodes: NavTreeNode[]) => void;
export type LoadNodesCallback = (node: NavTreeNode, cb: NodesCallback) => void; export type LoadNodesCallback = (node: NavTreeNode, cb: NodesCallback) => void;
export type NodeSearchCallback = (searchText: string, node: NavTreeNode) => boolean; export type NodeSearchCallback = (searchText: string, node: NavTreeNode) => boolean;
@ -149,7 +153,7 @@ export class NavTreeComponent implements OnInit {
this.treeElement = $('.tb-nav-tree-container', this.elementRef.nativeElement).jstree(config); this.treeElement = $('.tb-nav-tree-container', this.elementRef.nativeElement).jstree(config);
this.treeElement.on('changed.jstree', (e: any, data) => { this.treeElement.on('changed.jstree', (e: any, data: JSTreeEventDataWithAction) => {
const node: NavTreeNode = data.instance.get_selected(true)[0]; const node: NavTreeNode = data.instance.get_selected(true)[0];
if (this.onNodeSelected && data.action !== 'ready') { if (this.onNodeSelected && data.action !== 'ready') {
this.ngZone.run(() => this.onNodeSelected(node, e as Event)); this.ngZone.run(() => this.onNodeSelected(node, e as Event));

1
ui-ngx/src/typings/jquery.jstree.typings.d.ts

@ -26,7 +26,6 @@ interface JQuery {
} }
interface JSTreeEventData { interface JSTreeEventData {
action: string;
instance: JSTree; instance: JSTree;
} }

Loading…
Cancel
Save