balkan-orgchart-js 9.2.49 → 9.3.1

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.mts CHANGED
@@ -252,6 +252,17 @@ declare class OrgChart {
252
252
  onNodeMouseleave(listener: (this: OrgChart, args: OrgChart.nodeMouseEventArgs) => void): OrgChart;
253
253
 
254
254
 
255
+ /**
256
+ * Fires when the chart requests nodes on demand.
257
+ * Use this event to dynamically load and append nodes.
258
+ *
259
+ * @param listener Callback function triggered on demand node request.
260
+ * @param listener.args Event arguments containing the requested node data.
261
+ * @returns {OrgChart} The current chart instance.
262
+ */
263
+ onDemand(listener: (this: OrgChart, args: OrgChart.demandEventArgs) => void): OrgChart;
264
+
265
+
255
266
  /**
256
267
  * On canvas SVG click event listener.
257
268
  * ```typescript
@@ -624,6 +635,16 @@ declare class OrgChart {
624
635
  */
625
636
  addNode(data: OrgChart.nodeData, callback?: () => void, fireEvent?: boolean): void;
626
637
 
638
+ /**
639
+ * Adds new nodes to the chart while keeping the specified node fixed in its current position.
640
+ *
641
+ * @param {string | number} id The id of the node that should remain stationary when the new nodes are added.
642
+ * @param {Array<OrgChart.nodeData>} dataArray An array of node data objects to add to the chart.
643
+ * @param {() => void} [callback] A callback function that is called after the nodes are added.
644
+ * @returns {void}
645
+ */
646
+ addNodes(id: string | number, dataArray: Array<OrgChart.nodeData>, callback?: () => void): void;
647
+
627
648
  /**
628
649
  * Removes specified node from nodes collection, redraws the chart and fires remove event.
629
650
  * ```typescript
@@ -1007,6 +1028,15 @@ declare class OrgChart {
1007
1028
  */
1008
1029
  moveNodesToVisibleArea(ids: Array<number | string>, callback?: () => void): void;
1009
1030
 
1031
+ /**
1032
+ * Moves the specified nodes into the visible area after a node expansion.
1033
+ *
1034
+ * @param id The ID of the node that was clicked to trigger the expand action.
1035
+ * @param ids Array of node IDs that should be moved into the visible area.
1036
+ * @param Optional callback executed after the operation is completed.
1037
+ */
1038
+ moveNodesToVisibleAreaAfterExpand(id: number | string, ids: Array<number | string>, callback?: () => void): void;
1039
+
1010
1040
  /**
1011
1041
  * Search in the chart.
1012
1042
  * ```typescript
@@ -1026,16 +1056,7 @@ declare class OrgChart {
1026
1056
  __searchField: string,
1027
1057
  __searchMarks: string
1028
1058
  }>;
1029
- /**
1030
- * Gets collpased node ids of the specifeid node
1031
- * ```typescript
1032
- * let chart = new OrgChart('#tree', {});
1033
- * ...
1034
- * let ids = chart.getCollapsedIds(2);
1035
- * ```
1036
- * @param node
1037
- */
1038
- getCollapsedIds(node: OrgChart.node): Array<string | number>;
1059
+
1039
1060
  /**
1040
1061
  * State to url.
1041
1062
  * ```typescript
@@ -2372,6 +2393,18 @@ declare namespace OrgChart {
2372
2393
  */
2373
2394
  event: MouseEvent
2374
2395
  }
2396
+
2397
+ interface demandEventArgs {
2398
+ /**
2399
+ * The id of the clicked node.
2400
+ */
2401
+ id: string | number,
2402
+
2403
+ /**
2404
+ * An array of node ids that should be loaded from the server.
2405
+ */
2406
+ ids: Array<string | number>
2407
+ }
2375
2408
 
2376
2409
 
2377
2410
  interface canvasClickEventArgs {
@@ -2603,15 +2636,14 @@ declare namespace OrgChart {
2603
2636
  * template name, you can specify multiple templates with tags in one chart
2604
2637
  */
2605
2638
  templateName?: string,
2606
-
2607
- /**
2608
- * Number of direct child nodes.
2609
- */
2610
- childCount?: number,
2639
+
2611
2640
  /**
2612
- * Number of direct child nodes that are currently collapsed (hidden).
2613
- */
2614
- collapsedChildCount?: number,
2641
+ * Array of collapsed direct child node IDs.
2642
+ *
2643
+ * Contains the IDs of child nodes whose `collapsed` state is `true`.
2644
+ * Always initialized as an array.
2645
+ */
2646
+ collapsedChildrenIds?: Array<string | number>,
2615
2647
  /**
2616
2648
  * Total number of collapsed descendant nodes (collapsed at any depth).
2617
2649
  */
@@ -2621,6 +2653,12 @@ declare namespace OrgChart {
2621
2653
  */
2622
2654
  deepChildCount?: number,
2623
2655
 
2656
+ /**
2657
+ * An array of child node ids.
2658
+ */
2659
+ cids?: Array<number | string>,
2660
+
2661
+
2624
2662
  /**
2625
2663
  * a reference to the left node neighbor, the default value is undefined
2626
2664
  */
@@ -6131,8 +6169,5 @@ declare namespace OrgChart {
6131
6169
  */
6132
6170
  var t: any;
6133
6171
  }
6134
-
6135
-
6136
-
6137
6172
 
6138
6173
  export default OrgChart;
package/orgchart.d.ts CHANGED
@@ -252,6 +252,17 @@ declare class OrgChart {
252
252
  onNodeMouseleave(listener: (this: OrgChart, args: OrgChart.nodeMouseEventArgs) => void): OrgChart;
253
253
 
254
254
 
255
+ /**
256
+ * Fires when the chart requests nodes on demand.
257
+ * Use this event to dynamically load and append nodes.
258
+ *
259
+ * @param listener Callback function triggered on demand node request.
260
+ * @param listener.args Event arguments containing the requested node data.
261
+ * @returns {OrgChart} The current chart instance.
262
+ */
263
+ onDemand(listener: (this: OrgChart, args: OrgChart.demandEventArgs) => void): OrgChart;
264
+
265
+
255
266
  /**
256
267
  * On canvas SVG click event listener.
257
268
  * ```typescript
@@ -624,6 +635,16 @@ declare class OrgChart {
624
635
  */
625
636
  addNode(data: OrgChart.nodeData, callback?: () => void, fireEvent?: boolean): void;
626
637
 
638
+ /**
639
+ * Adds new nodes to the chart while keeping the specified node fixed in its current position.
640
+ *
641
+ * @param {string | number} id The id of the node that should remain stationary when the new nodes are added.
642
+ * @param {Array<OrgChart.nodeData>} dataArray An array of node data objects to add to the chart.
643
+ * @param {() => void} [callback] A callback function that is called after the nodes are added.
644
+ * @returns {void}
645
+ */
646
+ addNodes(id: string | number, dataArray: Array<OrgChart.nodeData>, callback?: () => void): void;
647
+
627
648
  /**
628
649
  * Removes specified node from nodes collection, redraws the chart and fires remove event.
629
650
  * ```typescript
@@ -1007,6 +1028,15 @@ declare class OrgChart {
1007
1028
  */
1008
1029
  moveNodesToVisibleArea(ids: Array<number | string>, callback?: () => void): void;
1009
1030
 
1031
+ /**
1032
+ * Moves the specified nodes into the visible area after a node expansion.
1033
+ *
1034
+ * @param id The ID of the node that was clicked to trigger the expand action.
1035
+ * @param ids Array of node IDs that should be moved into the visible area.
1036
+ * @param Optional callback executed after the operation is completed.
1037
+ */
1038
+ moveNodesToVisibleAreaAfterExpand(id: number | string, ids: Array<number | string>, callback?: () => void): void;
1039
+
1010
1040
  /**
1011
1041
  * Search in the chart.
1012
1042
  * ```typescript
@@ -1026,16 +1056,7 @@ declare class OrgChart {
1026
1056
  __searchField: string,
1027
1057
  __searchMarks: string
1028
1058
  }>;
1029
- /**
1030
- * Gets collpased node ids of the specifeid node
1031
- * ```typescript
1032
- * let chart = new OrgChart('#tree', {});
1033
- * ...
1034
- * let ids = chart.getCollapsedIds(2);
1035
- * ```
1036
- * @param node
1037
- */
1038
- getCollapsedIds(node: OrgChart.node): Array<string | number>;
1059
+
1039
1060
  /**
1040
1061
  * State to url.
1041
1062
  * ```typescript
@@ -2372,6 +2393,18 @@ declare namespace OrgChart {
2372
2393
  */
2373
2394
  event: MouseEvent
2374
2395
  }
2396
+
2397
+ interface demandEventArgs {
2398
+ /**
2399
+ * The id of the clicked node.
2400
+ */
2401
+ id: string | number,
2402
+
2403
+ /**
2404
+ * An array of node ids that should be loaded from the server.
2405
+ */
2406
+ ids: Array<string | number>
2407
+ }
2375
2408
 
2376
2409
 
2377
2410
  interface canvasClickEventArgs {
@@ -2603,15 +2636,14 @@ declare namespace OrgChart {
2603
2636
  * template name, you can specify multiple templates with tags in one chart
2604
2637
  */
2605
2638
  templateName?: string,
2606
-
2607
- /**
2608
- * Number of direct child nodes.
2609
- */
2610
- childCount?: number,
2639
+
2611
2640
  /**
2612
- * Number of direct child nodes that are currently collapsed (hidden).
2613
- */
2614
- collapsedChildCount?: number,
2641
+ * Array of collapsed direct child node IDs.
2642
+ *
2643
+ * Contains the IDs of child nodes whose `collapsed` state is `true`.
2644
+ * Always initialized as an array.
2645
+ */
2646
+ collapsedChildrenIds?: Array<string | number>,
2615
2647
  /**
2616
2648
  * Total number of collapsed descendant nodes (collapsed at any depth).
2617
2649
  */
@@ -2621,6 +2653,12 @@ declare namespace OrgChart {
2621
2653
  */
2622
2654
  deepChildCount?: number,
2623
2655
 
2656
+ /**
2657
+ * An array of child node ids.
2658
+ */
2659
+ cids?: Array<number | string>,
2660
+
2661
+
2624
2662
  /**
2625
2663
  * a reference to the left node neighbor, the default value is undefined
2626
2664
  */
@@ -6131,8 +6169,5 @@ declare namespace OrgChart {
6131
6169
  */
6132
6170
  var t: any;
6133
6171
  }
6134
-
6135
-
6136
-
6137
6172
 
6138
6173
  export default OrgChart;