@balkangraph/orgchart.js 8.2.2 → 8.2.6

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/orgchart.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- declare class OrgChart {
1
+ declare class OrgChart extends OrgChartBase {
2
2
  nodes: { [key: string | number]: OrgChart.node };
3
3
  isVisible: boolean;
4
4
 
@@ -8,37 +8,18 @@ declare class OrgChart {
8
8
  */
9
9
  constructor(element: HTMLElement | string, options?: OrgChart.options);
10
10
 
11
- /**
12
- * Updates the node data, redraws the chart and fires update event.
13
- * @param data node data
14
- * @param callback function called when the animation completes
15
- * @param fireEvent if it set to true the update event is called
16
- */
17
- updateNode(data: object, callback?: () => void, fireEvent?: boolean): void;
11
+
18
12
  /**
19
13
  * Updates the node data
20
14
  * @param newData node data
21
15
  */
22
16
  update(newData: object): OrgChart;
23
- /**
24
- * Removes specified node from nodes collection, redraws the chart and fires remove event.
25
- * @param id identification number of the node
26
- * @param callback called at the end of animation
27
- * @param fireEvent indicates if the remove event will be called or not
28
- */
29
- removeNode(id: string | number, callback?: () => void, fireEvent?: boolean): void;
17
+
30
18
  /**
31
19
  * Removes specified node from nodes collection
32
20
  * @param id identification number of the node
33
21
  */
34
22
  remove(id: string | number): OrgChart;
35
- /**
36
- * Adds new node to the nodes collection, redraws the chart and fires remove event
37
- * @param data node data
38
- * @param callback called at the end of animation
39
- * @param fireEvent indicates if the add event will be called or not
40
- */
41
- addNode(data: object, callback?: () => void, fireEvent?: boolean): void;
42
23
  /**
43
24
  * Adds new node to the nodes collection
44
25
  * @param data node data
@@ -320,14 +301,6 @@ declare class OrgChart {
320
301
  zoom(delta: boolean | number, center?: Array<number>, shouldAnimate?: boolean, callback?: () => void): void;
321
302
 
322
303
 
323
- /**
324
- * The on() method of the OrgChart class sets up a function that will be called whenever the specified event is delivered to the target. *
325
- * @category Event Listeners
326
- * @param type A case-sensitive string representing the event type to listen for.
327
- * @param listener The object that receives a notification when an event of the specified type occurs. This must be a JavaScript function.
328
- */
329
- 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" | "import" | "adding" | "added" | "updated" | "key-down" | "visibility-change" | "renderdefs" | "render" | "prerender" | "screen-reader-text" | "removed" | "ready" | "ripple", listener: (sender: OrgChart, args: unknown, args1: unknown, args2: unknown) => void | boolean): OrgChart;
330
-
331
304
  /**
332
305
  * The onField() method of the OrgChart class sets up a function that will be called whenever the specified event is delivered to the target.
333
306
  * ```typescript
@@ -374,106 +347,7 @@ declare class OrgChart {
374
347
  */
375
348
  onInit(listener: () => void): OrgChart;
376
349
 
377
- /**
378
- * Occurs when the node data has been updated by updateNode method.
379
- * ```typescript
380
- * var chart = new OrgChart('#tree', {});
381
- * chart.onUpdateNode((args) => {
382
- * //return false; to cancel the operation
383
- * });
384
- * ```
385
- * @category Event Listeners
386
- * @param listener
387
- */
388
- onUpdateNode(listener: (args: {
389
- /**
390
- * old node data
391
- */
392
- oldData: object,
393
- /**
394
- * new node data
395
- */
396
- newData: object
397
- }) => void): OrgChart;
398
- /**
399
- * Occurs when a node has been removed by removeNode method.
400
- * ```typescript
401
- * var chart = new OrgChart('#tree', {});
402
- * chart.onRemoveNode((args) => {
403
- * //return false; to cancel the operation
404
- * });
405
- * ```
406
- * @category Event Listeners
407
- * @param listener
408
- */
409
- onRemoveNode(listener: (args: {
410
- /**
411
- * node id
412
- */
413
- id: number | string,
414
- /**
415
- * parent ids and sub tree parents ids that needs to be updated on the server. For example if you remove a node that has children all chilren nodes will change their pid to the parent node id of the removed node.
416
- */
417
- newPidsAndStpidsForIds: {
418
- newPidsForIds: {[key: string | number] : string | number},
419
- newStpidsForIds: {[key: string | number] : string | number}
420
- }}) => void): OrgChart;
421
350
 
422
- /**
423
- * Occurs when a node has been added by addNode method.
424
- * ```typescript
425
- * var chart = new OrgChart('#tree', {});
426
- * chart.onAddNode((args) => {
427
- * //return false; to cancel the operation
428
- * });
429
- * ```
430
- * @category Event Listeners
431
- * @param listener
432
- */
433
- onAddNode(listener: (args: {
434
- /**
435
- * new added data node
436
- */
437
- data: object
438
- }) => void): OrgChart;
439
- /**
440
- * The onDrag event occurs when a node is dragged. *enableDragDrop* option has to be turned on.
441
- * ```typescript
442
- * var chart = new OrgChart('#tree', {});
443
- * chart.onDrag(() => {
444
- * //return false; to cancel the operation
445
- * });
446
- * ```
447
- * @category Event Listeners
448
- * @param listener
449
- */
450
- onDrag(listener: (args: {
451
- /**
452
- * dragged node id
453
- */
454
- dragId: string | number
455
- }) => void): OrgChart;
456
- /**
457
- * The onDrop event occurs when a node is dropped. *enableDragDrop* option has to be turned on.
458
- * ```typescript
459
- * var chart = new OrgChart('#tree', {});
460
- * chart.onDrop(() => {
461
- * //return false; to cancel the operation
462
- * });
463
- * ```
464
- * @category Event Listeners
465
- * @param listener
466
- */
467
- onDrop(listener: (args: {
468
- /**
469
- * dragged node id
470
- */
471
- dragId: string | number,
472
- /**
473
- * dropped node id
474
- */
475
- dropId: string | number
476
- }) => void): OrgChart;
477
351
 
478
352
  /**
479
353
  * The onRedraw event occurs when the chart is redrawed.
@@ -690,6 +564,10 @@ declare class OrgChart {
690
564
  static childrenCount(chart: OrgChart, node: OrgChart.node, count?: number): number;
691
565
  static collapsedChildrenCount(chart: OrgChart, node: OrgChart.node, count?: number): number;
692
566
  static getRootOf(node: OrgChart.node): OrgChart.node;
567
+ /**
568
+ * is null, empty or undefined
569
+ * @param val
570
+ */
693
571
  static isNEU(val: unknown): boolean;
694
572
  static gradientCircleForDefs(id: string | number, colors: Array<string> | string, r: number, strokeWidth: number): string;
695
573
 
@@ -742,7 +620,16 @@ declare class OrgChart {
742
620
  static templates :{ [key: string]: OrgChart.template} ;
743
621
 
744
622
 
745
-
623
+ static scroll: {
624
+ visible?: boolean,
625
+ smooth?: number,
626
+ speed?: number,
627
+ safari?: { smooth?: number; speed?: number; },
628
+ edge?: { smooth?: number; speed?: number; },
629
+ chrome?: { smooth?: number; speed?: number; },
630
+ firefox?: { smooth?: number; speed?: number; },
631
+ opera?: { smooth?: number; speed?: number; }
632
+ };
746
633
 
747
634
  static events: {
748
635
  on(type: "node-created" | "layout", listener: (args: unknown, args1: unknown, args2: unknown) => void): void
@@ -851,20 +738,9 @@ declare class OrgChart {
851
738
 
852
739
  }
853
740
 
854
- declare namespace OrgChart {
855
- /**
856
- * deprecated, use OrgChart.align.center isntead
857
- * @ignore
858
- */
859
- const CENTER: number;
860
- /**
861
- * deprecated, use OrgChart.align.orientation isntead
862
- * @ignore
863
- */
864
- const ORIENTATION: number;
865
-
866
-
741
+ declare namespace OrgChart {
867
742
  /**
743
+ * deprecated
868
744
  * @ignore
869
745
  */
870
746
  const none: number;
@@ -879,44 +755,9 @@ declare namespace OrgChart {
879
755
  */
880
756
  const COLLAPSE_SUB_CHILDRENS: number;
881
757
 
882
- /**
883
- * deprecated, use OrgChart.layout.normal isntead
884
- * @ignore
885
- */
886
- const normal: number;
887
-
888
- /**
889
- * deprecated, use OrgChart.layout.mixed isntead
890
- * @ignore
891
- */
892
- const mixed: number;
893
- /**
894
- * deprecated, use OrgChart.layout.tree isntead
895
- * @ignore
896
- */
897
- const tree: number;
898
- /**
899
- * deprecated, use OrgChart.layout.treeLeftOffset isntead
900
- * @ignore
901
- */
902
- const treeLeftOffset: any;
903
- /**
904
- * deprecated, use OrgChart.layout.treeRightOffset isntead
905
- * @ignore
906
- */
907
- const treeRightOffset: any;
908
758
 
909
759
 
910
- const scroll: {
911
- visible?: boolean,
912
- smooth?: number,
913
- speed?: number,
914
- safari?: { smooth?: number; speed?: number; },
915
- edge?: { smooth?: number; speed?: number; },
916
- chrome?: { smooth?: number; speed?: number; },
917
- firefox?: { smooth?: number; speed?: number; },
918
- opera?: { smooth?: number; speed?: number; }
919
- };
760
+
920
761
 
921
762
  interface template
922
763
  {
@@ -1073,7 +914,7 @@ declare namespace OrgChart {
1073
914
 
1074
915
 
1075
916
 
1076
- type toolbar = {
917
+ interface toolbar {
1077
918
  layout?: boolean,
1078
919
  zoom?: boolean,
1079
920
  fit?: boolean,
@@ -1082,7 +923,7 @@ declare namespace OrgChart {
1082
923
  }
1083
924
 
1084
925
 
1085
- type exportOptions = {
926
+ interface exportOptions {
1086
927
  margin?: Array<number>,
1087
928
  padding?: number,
1088
929
  landscape?: boolean,
@@ -1094,22 +935,22 @@ declare namespace OrgChart {
1094
935
  openInNewTab?: boolean
1095
936
  }
1096
937
 
1097
- type linkTemplate = {
938
+ interface linkTemplate {
1098
939
  defs?: string,
1099
940
  link?: string,
1100
941
  label?: string,
1101
942
  labelPosition?: string
1102
943
  }
1103
- type menu = {
944
+ interface menu {
1104
945
  [key: string]: {
1105
- text?: string,
946
+ text: string,
1106
947
  icon?: string,
1107
948
  onClick?: Function,
1108
949
  color?: string,
1109
950
  draggable?: boolean
1110
951
  }
1111
952
  }
1112
- type editFormElement = {
953
+ interface editFormElement {
1113
954
  type?: string,
1114
955
  label?: string,
1115
956
  binding?: string,
@@ -1117,13 +958,13 @@ declare namespace OrgChart {
1117
958
  btn?: string,
1118
959
  vlidators?: { required?: string, email?: string }
1119
960
  }
1120
- type link = {
961
+ interface link {
1121
962
  from?: string | number,
1122
963
  to?: string | number,
1123
964
  template?: string,
1124
965
  label?: string
1125
966
  }
1126
- type orderBy = {
967
+ interface orderBy {
1127
968
  field?: string,
1128
969
  desc?: boolean
1129
970
  }
@@ -1198,7 +1039,7 @@ declare namespace OrgChart {
1198
1039
  none
1199
1040
  }
1200
1041
 
1201
- type node = {
1042
+ interface node {
1202
1043
  /**
1203
1044
  * the same id you provided in the source node
1204
1045
  */
@@ -1345,15 +1186,7 @@ declare namespace OrgChart {
1345
1186
  */
1346
1187
  lazyLoading?: boolean,
1347
1188
 
1348
- /**
1349
- * With the drag and drop features enabled you can move nodes easily and change the tree structure. Default value - *false*.
1350
- * ```typescript
1351
- * var chart = new OrgChart('#tree', {
1352
- * enableDragDrop: true
1353
- * });
1354
- * ```
1355
- */
1356
- enableDragDrop?: boolean,
1189
+
1357
1190
 
1358
1191
  /**
1359
1192
  * Enables advanced search. Default value is true.
@@ -2048,7 +1881,7 @@ declare namespace OrgChart {
2048
1881
  * ```typescript
2049
1882
  * var chart = new OrgChart('#tree', {
2050
1883
  * state: {
2051
- * name: 'StateForMyOrgChart',
1884
+ * name: 'MyStateName',
2052
1885
  * readFromLocalStorage: true,
2053
1886
  * writeToLocalStorage: true,
2054
1887
  * readFromIndexedDB: true,