-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorgchart.d.ts
More file actions
6030 lines (5580 loc) · 184 KB
/
orgchart.d.ts
File metadata and controls
6030 lines (5580 loc) · 184 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* ```typescript
* <!DOCTYPE html>
* <html>
* <head>
* <meta charset="utf-8">
* <meta name="viewport" content="width=device-width, initial-scale=1.0">
* <title>OrgChartJS</title>
* <style>
* html, body { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; font-family: Helvetica; }
* #tree { width: 100%; height: 100%; }
* </style>
* </head>
* <body>
* <script src="https://cdn.balkan.app/orgchart.js"></script>
* <div id="tree"></div>
* <script>
* let chart = new OrgChart(document.getElementById("tree"), {
* mouseScrool: OrgChart.action.scroll,
* enableDragDrop: true,
* nodeBinding: { field_0: "name" },
* nodes: [
* { id: 1, name: "Amber McKenzie" },
* { id: 2, pid: 1, name: "Ava Field" },
* { id: 3, pid: 1, name: "Peter Stevens" }
* ]
* });
* </script>
* </body>
* </html>
* ```
*/
declare class OrgChart {
/**
* ```typescript
* let chart = new OrgChart('#tree', {});
* ```
* @param element HTML element or string selector for example '#tree'
* @param options configuration options
*/
constructor(element?: HTMLElement | string | null, options?: OrgChart.options);
/**
* The on() method of the OrgChart class sets up a function that will be called whenever the specified event is delivered to the target. *
* ```typescript
* let chart = new OrgChart('#tree', {});
* chart.on('init', function () {
* // console.log("initiated")
* })
* chart.load(nodes);
* ```
* @category Event Listeners
* @param type A case-sensitive string representing the event type to listen for.
* @param listener The object that receives a notification when an event of the specified type occurs. This must be a JavaScript function.
*/
on(type: "init" | "field" | "update" | "add" | "remove" | "renderbuttons" | "label" | "render-link" | "drag" | "drop" | "redraw" | "expcollclick" | "exportstart" | "exportend" | "click" | "dbclick" | "slink-click" | "clink-click" | "up-click" | "searchclick" | "import" | "updated" | "key-down" | "visibility-change" | "renderdefs" | "render" | "prerender" | "screen-reader-text" | "ready" | "ripple" | "node-initialized" | "nodes-initialized" | "node-layout", listener: (sender: OrgChart, args?: any, args1?: any, args2?: any) => void | boolean): OrgChart;
/**
* Occurs when the node data has been updated by updateNode method.
* ```typescript
* var chart = new OrgChart('#tree', {});
* chart.onUpdateNode((args) => {
* //return false; to cancel the operation
* });
* ```
* @category Event Listeners
* @param listener
*/
onUpdateNode(listener: (this: OrgChart, args: OrgChart.updateNodeEventArgs) => void): OrgChart;
/**
* Occurs when new nodes are added, removed, updated or imported, also when slink or clink is added or removed and after undo or redo operations.
* Use this event listener to synch your server side database with this.config.nodes, this.config.clinks, this.config.slinks etc.
* ```typescript
* var chart = new OrgChart('#tree', {});
* chart.onUpdated(() => {
* //Update your server database with this.config.nodes, this.config.clinks, this.config.slinks etc.
* });
* ```
* @category Event Listeners
*/
onUpdated(listener: (this: OrgChart) => void): OrgChart;
/**
* Occurs when a node has been removed by removeNode method.
* ```typescript
* var chart = new OrgChart('#tree', {});
* chart.onRemoveNode((args) => {
* //return false; to cancel the operation
* });
* ```
* @category Event Listeners
* @param listener
*/
onRemoveNode(listener: (this: OrgChart, args: OrgChart.removeNodeEventArgs) => void): OrgChart;
/**
* Occurs when a node has been added by addNode method.
* ```typescript
* var chart = new OrgChart('#tree', {});
* chart.onAddNode((args) => {
* //return false; to cancel the operation
* });
* ```
* @category Event Listeners
* @param listener
*/
onAddNode(listener: (this: OrgChart, args: OrgChart.addNodeEventArgs) => void): OrgChart;
/**
* The onDrag event occurs when a node is dragged. *enableDragDrop* option has to be turned on.
* ```typescript
* var chart = new OrgChart('#tree', {});
* chart.onDrag(() => {
* //return false; to cancel the operation
* });
* ```
* @category Event Listeners
* @param listener
*/
onDrag(listener: (this: OrgChart, args: OrgChart.dragEventArgs) => void): OrgChart;
/**
* The onDrop event occurs when a node is dropped. *enableDragDrop* option has to be turned on.
* ```typescript
* var chart = new OrgChart('#tree', {});
* chart.onDrop(() => {
* //return false; to cancel the operation
* });
* ```
* @category Event Listeners
* @param listener
*/
onDrop(listener: (this: OrgChart, args: OrgChart.dropEventArgs) => void): OrgChart;
/**
* Occurs when the nodes in OrgChart has been created and loaded to the DOM.
* ```typescript
* let chart = new OrgChart('#tree', {});
* chart.onInit(() => {
* });
* chart.load(nodes);
* ```
* @category Event Listeners
* @param listener
*/
onInit(listener: (this: OrgChart) => void): OrgChart;
/**
* The onRedraw event occurs when the chart is redrawed.
* ```typescript
* let chart = new OrgChart('#tree', {});
* chart.onRedraw(() => {
* });
* chart.load(nodes);
* ```
* @category Event Listeners
* @param listener
*/
onRedraw(listener: (this: OrgChart) => void): OrgChart;
/**
* The onExpandCollapseButtonClick event occurs when the chart is redrawed.
* ```typescript
* let chart = new OrgChart('#tree', {});
* chart.onExpandCollapseButtonClick(() => {
* //return false; to cancel the operation
* });
* chart.load(nodes);
* ```
* @category Event Listeners
* @param listener
*/
onExpandCollapseButtonClick(listener: (this: OrgChart, args: OrgChart.expandCollapseButtonClickEventArgs) => void): OrgChart;
/**
* Occurs in the beginning of the export. Extra css styles can be added to the exported document using this event listener or show loading image.
* ```typescript
* let chart = new OrgChart('#tree', {});
* chart.onExportStart(() => {
* args.styles += '<link href="[link to my styles]" rel="stylesheet">';
* //return false; to cancel the operation
* });
* chart.load(nodes);
* ```
* @category Event Listeners
* @param listener
*/
onExportStart(listener: (this: OrgChart, args: OrgChart.exportStartEventArgs) => void): OrgChart;
/**
* Occurs in the beginning of the export. Use this event listener to hide loading image or upload exported document to your server using ArrayBuffer argument.
* ```typescript
* let chart = new OrgChart('#tree', {});
* chart.onExportEnd(() => {
* //return false; to cancel the operation for example id you prefer the exported document to not download
* });
* chart.load(nodes);
* ```
* @category Event Listeners
* @param listener
*/
onExportEnd(listener: (this: OrgChart, args: OrgChart.exportEndEventArgs) => void): OrgChart;
/**
* On node click event listener.
* ```typescript
* let chart = new OrgChart('#tree', {});
* chart.onNodeClick(() => {
* //return false; to cancel the operation
* });
* chart.load(nodes);
* ```
* @category Event Listeners
* @param listener
*/
onNodeClick(listener: (this: OrgChart, args: OrgChart.nodeClickEventArgs) => void): OrgChart;
/**
* On canvas SVG click event listener.
* ```typescript
* let chart = new OrgChart('#tree', {});
* chart.onCanvasClick(() => {
* });
* chart.load(nodes);
* ```
* @category Event Listeners
* @param listener
*/
onCanvasClick(listener: (this: OrgChart, args: OrgChart.canvasClickEventArgs) => void): OrgChart;
/**
* In onAIToolCalls we parse the AI responce to our functions
* ```typescript
* chart.onAIToolCalls(function(args){
* for(var toolCall of args.toolCalls){
* if (toolCall.FunctionName == 'sendEmail'){
* toolCall.FunctionResult = sendEmail(toolCall.FunctionArguments);
* }
* }
* });
* ```
* [Go to AI doc page for more details](https://balkan.app/OrgChartJS/Docs/AI)
* @param listener
*/
onAIToolCalls(listener: (this: OrgChart, args: OrgChart.aiToolCallsEventArgs) => void): OrgChart;
/**
* On node double click event listener.
* ```typescript
* let chart = new OrgChart('#tree', {});
* chart.onNodeDoubleClick(() => {
* //return false; to cancel the operation
* });
* chart.load(nodes);
* ```
* @category Event Listeners
* @param listener
*/
onNodeDoubleClick(listener: (this: OrgChart, args: OrgChart.nodeDoubleClickEventArgs) => void): OrgChart;
/**
* SVG icons
* @param w - width
* @param h - height
* @param c - color
* @param x - X position
* @param y - Y position
* @returns string with the SVG definition
*/
static icon: {
/**
* ```typescript
* let pngIcon = OrgChart.icon.png(24, 24, "#7A7A7A");
* ```
*/
png: (w: string| number, h: string | number, c: string, x?: string| number, y?: string| number) => string,
/**
* ```typescript
* let pdfIcon = OrgChart.icon.pdf(24, 24, "#7A7A7A");
* ```
*/
pdf: (w: string | number, h: string | number, c: string, x?: string| number, y?: string| number) => string,
/**
* ```typescript
* let svgIcon = OrgChart.icon.svg(24, 24, "#7A7A7A");
* ```
*/
svg: (w: string| number, h: string| number, c: string | number, x?: string| number, y?: string| number) => string,
/**
* ```typescript
* let csvIcon = OrgChart.icon.csv(24, 24, "#7A7A7A");
* ```
*/
csv: (w: string| number, h: string| number, c: string| number, x?: string| number, y?: string| number) => string,
/**
* ```typescript
* let excelIcon = OrgChart.icon.excel(24, 24, "#7A7A7A");
* ```
*/
excel: (w: string| number, h: string| number, c: string| number, x?: string| number, y?: string| number) => string,
/**
* ```typescript
* let powerPointIcon = OrgChart.icon.powerpoint(24, 24, "#7A7A7A");
* ```
*/
powerpoint: (w: string| number, h: string| number, c: string| number, x?: string| number, y?: string| number) => string,
/**
* ```typescript
* let powerPointPreviewIcon = OrgChart.icon.pppreview(24, 24, "#7A7A7A");
* ```
*/
pppreview: (w: string| number, h: string| number, c: string| number, x?: string| number, y?: string| number) => string,
/**
* ```typescript
* let editIcon = OrgChart.icon.edit(24, 24, "#7A7A7A");
* ```
*/
edit: (w: string| number, h: string| number, c: string| number, x?: string| number, y?: string| number) => string,
/**
* ```typescript
* let detailsIcon = OrgChart.icon.details(24, 24, "#7A7A7A");
* ```
*/
details: (w: string| number, h: string| number, c: string| number, x?: string| number, y?: string| number) => string,
/**
* ```typescript
* let removeIcon = OrgChart.icon.remove(24, 24, "#7A7A7A");
* ```
*/
remove: (w: string| number, h: string| number, c: string| number, x?: string| number, y?: string| number) => string,
/**
* ```typescript
* let addIcon = OrgChart.icon.add(24, 24, "#7A7A7A");
* ```
*/
add: (w: string| number, h: string| number, c: string| number, x?: string| number, y?: string| number) => string,
/**
* ```typescript
* let xmlIcon = OrgChart.icon.xml(24, 24, "#7A7A7A");
* ```
*/
xml: (w: string| number, h: string| number, c: string| number, x?: string| number, y?: string| number) => string,
/**
* ```typescript
* let visioIcon = OrgChart.icon.visio(24, 24, "#7A7A7A");
* ```
*/
visio: (w: string| number, h: string| number, c: string| number, x?: string| number, y?: string| number) => string,
/**
* ```typescript
* let linkIcon = OrgChart.icon.link(24, 24, "#7A7A7A");
* ```
*/
link: (w: string| number, h: string| number, c: string| number, x?: string| number, y?: string| number) => string,
/**
* ```typescript
* let happyIcon = OrgChart.icon.happy(24, 24, "#7A7A7A");
* ```
*/
happy: (w: string| number, h: string| number, c: string| number, x?: string| number, y?: string| number) => string,
/**
* ```typescript
* let sadIcon = OrgChart.icon.sad(24, 24, "#7A7A7A");
* ```
*/
sad: (w: string| number, h: string| number, c: string| number, x?: string| number, y?: string| number) => string,
/**
* ```typescript
* let shareIcon = OrgChart.icon.share(24, 24, "#7A7A7A");
* ```
*/
share: (w: string| number, h: string| number, c: string| number, x?: string| number, y?: string| number) => string,
/**
* ```typescript
* let userIcon = OrgChart.icon.user(24, 24, "#7A7A7A");
* ```
*/
user: (w: string| number, h: string| number, c: string| number, x?: string| number, y?: string| number) => string,
/**
* ```typescript
* let undoIcon = OrgChart.icon.undo(24, 24, "#7A7A7A");
* ```
*/
undo: (w: string| number, h: string| number, c: string| number, x?: string| number, y?: string| number) => string,
/**
* ```typescript
* let redoIcon = OrgChart.icon.redo(24, 24, "#7A7A7A");
* ```
*/
redo: (w: string| number, h: string| number, c: string| number, x?: string| number, y?: string| number) => string,
/**
* ```typescript
* let fitIcon = OrgChart.icon.fit(24, 24, "#7A7A7A");
* ```
*/
fit: (w: string| number, h: string| number, c: string| number, x?: string| number, y?: string| number) => string,
/**
* ```typescript
* let expand_allIcon = OrgChart.icon.expand_all(24, 24, "#7A7A7A");
* ```
*/
expand_all: (w: string| number, h: string| number, c: string| number, x?: string| number, y?: string| number) => string,
/**
* ```typescript
* let full_screenIcon = OrgChart.icon.full_screen(24, 24, "#7A7A7A");
* ```
*/
full_screen: (w: string| number, h: string| number, c: string| number, x?: string| number, y?: string| number) => string,
/**
* ```typescript
* let zoom_inIcon = OrgChart.icon.zoom_in(24, 24, "#7A7A7A");
* ```
*/
zoom_in: (w: string| number, h: string| number, c: string| number, x?: string| number, y?: string| number) => string,
/**
* ```typescript
* let zoom_outIcon = OrgChart.icon.zoom_out(24, 24, "#7A7A7A");
* ```
*/
zoom_out: (w: string| number, h: string| number, c: string| number, x?: string| number, y?: string| number) => string,
/**
* ```typescript
* let layout_mixedIcon = OrgChart.icon.layout_mixed(24, 24, "#7A7A7A");
* ```
*/
layout_mixed: (w: string| number, h: string| number, c: string| number, x?: string| number, y?: string| number) => string,
/**
* ```typescript
* let layout_normalIcon = OrgChart.icon.layout_normal(24, 24, "#7A7A7A");
* ```
*/
layout_normal: (w: string| number, h: string| number, c: string| number, x?: string| number, y?: string| number) => string,
/**
* ```typescript
* let layout_right_offsetIcon = OrgChart.icon.layout_right_offset(24, 24, "#7A7A7A");
* ```
*/
layout_right_offset: (w: string| number, h: string| number, c: string| number, x?: string| number, y?: string| number) => string,
/**
* ```typescript
* let layout_left_offsetIcon = OrgChart.icon.layout_left_offset(24, 24, "#7A7A7A");
* ```
*/
layout_left_offset: (w: string| number, h: string| number, c: string| number, x?: string| number, y?: string| number) => string,
/**
* ```typescript
* let layout_treeIcon = OrgChart.icon.layout_tree(24, 24, "#7A7A7A");
* ```
*/
layout_tree: (w: string| number, h: string| number, c: string| number, x?: string| number, y?: string| number) => string,
/**
* ```typescript
* let layout_gridIcon = OrgChart.icon.layout_grid(24, 24, "#7A7A7A");
* ```
*/
layout_grid: (w: string| number, h: string| number, c: string| number, x?: string| number, y?: string| number) => string,
/**
* ```typescript
* let cursorIcon = OrgChart.icon.cursor(24, 24, "#7A7A7A");
* ```
*/
cursor: (w: string| number, h: string| number, c: string| number, x?: string| number, y?: string| number) => string,
}
/**
* Can update link (Does the node is dropping under itself)
* ```typescript
* let canDropTheNode = chart.canUpdateLink(draggedNodeId, droppedNodeId));
* ```
* @param id child id
* @param pid parent id
*/
canUpdateLink(id: string | number, pid: string | number): boolean;
/**
* Removes an event listener previously registered. The event listener to be removed is identified using a combination of the event type and the event listener function itself. Returns true if success and false if fail.
* ```typescript
* let chart = new OrgChart('#tree', {});
* let listener = function(sender, args){
* console.log(sender.removeListener('update', listener));
* };
* chart.on('update', listener);
* chart.load(nodes)
* ```
};
family.on('update', listener);
* @param type A string which specifies the type of event for which to remove an event listener
* @param listener The event listener function of the event handler to remove from the event target
*/
removeListener(type: "init" | "field" | "update" | "add" | "remove" | "renderbuttons" | "label" | "render-link" | "drag" | "drop" | "redraw" | "expcollclick" | "exportstart" | "exportend" | "click" | "dbclick" | "slink-click" | "clink-click" | "up-click" | "searchclick" | "import" | "updated" | "key-down" | "visibility-change" | "renderdefs" | "render" | "prerender" | "screen-reader-text" | "ready" | "ripple" | "node-initialized" | "nodes-initialized" | "node-layout", listener?: () => void): boolean;
/**
* All chart nodes
* ```typescript
* let chart = new OrgChart('#tree', {});
* chart.onInit(() => {
* let nodes = chart.nodes;
* });
* chart.load(nodes)
* ```
*/
nodes: { [key in any]: OrgChart.node };
/**
* Returns true if chart is visible
* ```typescript
* let chart = new OrgChart('#tree', {});
* chart.onInit(() => {
* console.log(chart.isVisible);
* });
* chart.load(nodes)
* ```
*/
isVisible: boolean;
/**
* Returns the visible nodes ids
* ```typescript
* let chart = new OrgChart('#tree', {});
* chart.onInit(() => {
* console.log(chart.visibleNodeIds);
* });
* chart.load(nodes)
* ```
*/
visibleNodeIds: Array<number | string>;
/**
* Updates the node data
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* chart.update({ id: 1, name: "Updated Name", title: "Updated Title" });
* chart.draw();
* ```
* @param newData node data
*/
update(newData: object): OrgChart;
/**
* Removes specified node from nodes collection
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* chart.remove(2);
* chart.draw();
* ```
* @param id identification number of the node
*/
remove(id: string | number): OrgChart;
/**
* Adds new node to the nodes collection
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* chart.add({ id: 2, pid: 1, name: "Ashley Barnett", title: "Sales Manager" })
* chart.draw();
* ```
* @param data node data
*/
add(data: object): OrgChart;
/**
* Adds new node to the nodes collection, redraws the chart and fires remove event
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* chart.addNode({ id: 1, name: "Denny Curtis", title: "CEO" });
* ```
* @param data node data
* @param callback called at the end of animation
* @param fireEvent indicates if the add event will be called or not
*/
addNode(data: OrgChart.nodeData, callback?: () => void, fireEvent?: boolean): void;
/**
* Removes specified node from nodes collection, redraws the chart and fires remove event.
* ```typescript
* var chart = new OrgChart('#tree', {});
* chart.removeNode(2);
* ```
* @param id identification number of the node
* @param callback called at the end of animation
* @param fireEvent indicates if the remove event will be called or not
*/
removeNode(id: string | number, callback?: () => void, fireEvent?: boolean): void;
/**
* Init method can be used if the chart needs to be instantiated without parameters, and init can be called later.
* ```typescript
* let chart = new OrgChart();
* chart.init('#tree', {})
* ```
* @param element
* @param options
*/
init(element?: HTMLElement | string | null, options?: OrgChart.options): void;
/**
* Gets node data.
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* let node = chart.get(2);
* ```
* @param id identification number of the node
*/
get(id: string | number): OrgChart.nodeData;
/**
* If specified node has assistant/s or partner/s as children will return false.
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* let canRemove = chart.canRemove(2);
* ```
* @param id identification number of the node
*/
canRemove(id: string | number): boolean;
/**
* Expands specified nodes.
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* chart.expand(1, [2]);
* ```
* @param id the id of the node that will not move during the animation
* @param ids node ids that will be expanded
* @param callback called after the animation completes
*/
expand(id: string | number, ids: Array<string | number> | "all", callback?: () => void): void;
/**
* Collapses specified nodes.
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* chart.collapse(1, [2]);
* ```
* @param id the id of the node that will not move
* @param ids node ids that will be collapsed
* @param callback called after the animation completes
*/
collapse(id: string | number, ids: Array<string | number>, callback?: () => void): void;
/**
* Expand/Collapse lists of nodes.
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* chart.expandCollapse(1, [2], [3]);
* ```
* @param id the id of the node that will not move
* @param expandIds expand all nodes with ids
* @param collapseIds collpase all nodes with ids
* @param callback called after the animation completes
*/
expandCollapse(id: string | number, expandIds: Array<string | number>, collapseIds: Array<string | number>, callback?: () => void): void;
/**
* Changes roots order.
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* chart.changeRoots(1, [2]);
* ```
* @param id id of a node that will not change is position, can be null
* @param roots roots id array in the required order
* @param callback called after the roots are changed and animation completes
*/
changeRoots(id: string | number, roots: Array<string | number>, callback?: () => void): void;
/**
* Maximize the node. Without parameters maximize all nodes.
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* chart.maximize();
* ```
* @param id the id of the node, if id is null, undefined ot empty string will maximize all nodes
* @param horizontalCenter center horizontally
* @param verticalCenter center vertically
* @param callback called when the animation completes
*/
maximize(id?: string | number, horizontalCenter?: boolean, verticalCenter?: boolean, callback?: () => void): void;
/**
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* chart.minimize();
* ```
* Minimize the node. Without parameters minimize all nodes.
* @param id the id of the node, if id is null, undefined ot empty string will minimize all nodes
* @param callback called when the animation completes
*/
minimize(id?: string | number, callback?: () => void): void;
/**
* Load nodes data.
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* chart.load([
* { id: 1, name: "Denny Curtis" },
* { id: 2, pid: 1, name: "Ashley Barnett" },
* { id: 3, pid: 1, name: "Caden Ellison" }
* ]);
* ```
* @param data nodes data array
* @param callback function called after the load
*/
load(data: Array<OrgChart.nodeData>, callback?: () => void): OrgChart;
/**
* Updates the node data, redraws the chart and fires update event.
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* chart.updateNode({ id: 4, pid: 2, name: "Updated Name", title: "Updated Title" });
* ```
* @param data node data
* @param callback function called when the animation completes
* @param fireEvent if it set to true the update event is called
*/
updateNode(data: OrgChart.nodeData, callback?: () => void, fireEvent?: boolean): void;
/**
* Loads nodes from xml.
* ```typescript
* let chart = new OrgChart('#tree', {});
* let xml = '<?xml version="1.0" encoding="utf-8" ?><nodes><node id="1" pids="2" name="Amber McKenzie" gender="female"/><node id="2" pids="1" name="Ava Field" gender="male"/><node id="3" pids="4,5" mid="1" fid="2" name="Peter Stevens" gender="male"/></nodes>';
* chart.loadXML(xml);
* ```
* @param xml Xml with node structure
* @param callback function called after the load
*/
loadXML(xml: string, callback?: () => void): OrgChart;
/**
* Gets nodes as xml.
* ```typescript
* let chart = new OrgChart('#tree', {});
* let xml = chart.getXML();
* ```
*/
getXML(): string;
/**
* Draws the chart.
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* chart.update({ id: 1, name: "Updated Name", title: "Updated Title" });
* chart.draw();
* ```
* @param action Action for example OrgChart.action.centerNode, default is OrgChart.action.update
* @param actionParams parameters for the action
* @param callback called when the animation completes
*/
draw(action?: OrgChart.action, actionParams?: any, callback?: () => void): void;
/**
* Gets the width of the container.
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* let width = chart.width();
* ```
*/
width(): number;
/**
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* let height = chart.height();
* ```
* Gets the height of the container.
*/
height(): number;
/**
* Gets the view box attribute of the svg html element.
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* let viewBox = chart.getViewBox();
* ```
*/
getViewBox(): Array<number>;
/**
* Sets the view box attribute of the svg html element.
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* chart.setViewBox();
* ```
* @param viewBox
*/
setViewBox(viewBox: Array<number>): void;
/**
* Gets the current scale of the chart.
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* let scale = chart.getScale();
* ```
* @param viewBox
*/
getScale(viewBox?: Array<number>): number;
/**
* Sets the current scale of the chart.
* Returns the actual scale limited by scaleMax and scaleMin
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* chart.setScale(1.2);
* ```
* @param newScale new scale value
*/
setScale(newScale: number): number;
/**
* Animates specified node with ripple animation - highlight the node.
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* chart.ripple(2);
* ```
* @param id the id of the node
* @param clientX x value of the ripple center in the node
* @param clientY y value of the ripple center in the node
*/
ripple(id: string | number, clientX?: number, clientY?: number): void;
/**
* Centers specified node on the screen.
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* chart.center(2);
* ```
* @param nodeId the id of the node
* @param options parentState: OrgChart.COLLAPSE_PARENT_NEIGHBORS, childrenState: OrgChart.COLLAPSE_SUB_CHILDRENS, rippleId: rippleId, vertical: false, horizontal: false
* @param callback called when the animation completes
*/
center(nodeId: string | number, options?: {
parentState: any,
childrenState: any,
rippleId: string | number,
vertical: boolean,
horizontal: boolean
} | null, callback?: () => void): void;
/**
* Fits the content to the visible area.
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* chart.fit();
* ```
* @param callback called when the animation completes
*/
fit(callback?: () => void): void;
/**
* Fits the content to the visible area if it is ouside of the visible area.
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* chart.fitOfOutside();
* ```
* @param callback called when the animation completes
*/
fitIfOutside(callback?: () => void): void;
/**
* Toggles full screen mode.
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* chart.toggleFullScreen();
* ```
*/
toggleFullScreen(): void;
/**
* Gets the node as {@link OrgChart.node} object.
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* let node = chart.getNode(2);
* ```
* @param nodeId
*/
getNode(nodeId: string | number): OrgChart.node;
/**
* Sets layout.
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* chart.setLayout(OrgChart.tree);
* ```
* @param layout layout type
* @param lcn lyout config name for the specified sub tree
*/
setLayout(layout: OrgChart.layout | number, lcn?: string): void;
/**
* Sets orientation.
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* chart.setOrientation(2);
* ```
* @param orientation orientation type
* @param lcn lyout config name for the specified sub tree
* @param callback called at the end of animation
*/
setOrientation(orientation: OrgChart.orientation, lcn?: string, callback?: () => void): void;
/**
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* chart.moveNodesToVisibleArea([2, 3]);
* ```
* Moves specified nodes to the visible area.
* @param ids Array of node ids
* @param callback called at the end of animation
*/
moveNodesToVisibleArea(ids: Array<number | string>, callback?: () => void): void;
/**
* Search in the chart.
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* chart.search("Ava");
* ```
* @param value search for value
* @param searchInFields search in field names
* @param retrieveFields retrive data for fields
* {@link https://balkan.app/OrgChartJS/Docs/Search | See doc...}
*/
search(value: string, searchInFields?: Array<string>, retrieveFields?: Array<string>): Array<{
id: number | string,
name: string,
__score: number,
__searchField: string,
__searchMarks: string
}>;
/**
* Gets collpased node ids of the specifeid node
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* let ids = chart.getCollapsedIds(2);
* ```
* @param node
*/
getCollapsedIds(node: OrgChart.node): Array<string | number>;
/**
* State to url.
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* let url = chart.stateToUrl();
* ```
* {@link https://balkan.app/OrgChartJS/Docs/State | See doc...}
*/
stateToUrl(): string;
/**
* Genereates unique identification number that can be used for new nodes
* ```typescript
* let chart = new OrgChart('#tree', {});
* ...
* let id = chart.generateId();
* ```
*/
generateId(): string;
/**
* Destroys the object.