@balkangraph/orgchart.js 8.14.79 → 8.14.81

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
@@ -118,26 +118,25 @@ declare class OrgChart {
118
118
 
119
119
 
120
120
  /**
121
- * Can update link
121
+ * Can update link (Does the node is dropping under itself)
122
+ * ```typescript
123
+ * let canDropTheNode = chart.canUpdateLink(draggedNodeId, droppedNodeId));
124
+ * ```
122
125
  * @param id child id
123
126
  * @param pid parent id
124
127
  */
125
128
  canUpdateLink(id: string | number, pid: string | number): boolean;
126
129
 
127
- /**
128
- * Removes specified node from nodes collection, redraws the chart and fires remove event.
129
- * @param id identification number of the node
130
- * @param callback called at the end of animation
131
- * @param fireEvent indicates if the remove event will be called or not
132
- */
133
- removeNode(id: string | number, callback?: () => void, fireEvent?: boolean): void;
134
-
135
-
136
-
137
-
138
130
 
139
131
  /**
140
132
  * The on() method of the OrgChart class sets up a function that will be called whenever the specified event is delivered to the target. *
133
+ * ```typescript
134
+ * let chart = new OrgChart('#tree', {});
135
+ * chart.on('init', function () {
136
+ * // console.log("initiated")
137
+ * })
138
+ * chart.load(nodes);
139
+ * ```
141
140
  * @category Event Listeners
142
141
  * @param type A case-sensitive string representing the event type to listen for.
143
142
  * @param listener The object that receives a notification when an event of the specified type occurs. This must be a JavaScript function.
@@ -146,6 +145,15 @@ declare class OrgChart {
146
145
 
147
146
  /**
148
147
  * 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.
148
+ * let chart = new OrgChart('#tree', {});
149
+ * let listener = function(sender, args){
150
+ * console.log(sender.removeListener('update', listener));
151
+ * };
152
+ * chart.on('update', listener);
153
+ * chart.load(nodes)
154
+ };
155
+
156
+ family.on('update', listener);
149
157
  * @param type A string which specifies the type of event for which to remove an event listener
150
158
  * @param listener The event listener function of the event handler to remove from the event target
151
159
  */
@@ -188,8 +196,6 @@ declare class OrgChart {
188
196
  onUpdated(): OrgChart;
189
197
 
190
198
 
191
-
192
-
193
199
  /**
194
200
  * Occurs when a node has been removed by removeNode method.
195
201
  * ```typescript
@@ -286,8 +292,19 @@ declare class OrgChart {
286
292
  event: MouseEvent
287
293
  }) => void): OrgChart;
288
294
 
289
-
295
+ /**
296
+ * All chart nodes
297
+ * ```typescript
298
+ * let chart = new OrgChart('#tree', {});
299
+ * chart.onInit(() => {
300
+ * let nodes = chart.nodes;
301
+ * });
302
+ * chart.load(nodes)
303
+ * ```
304
+ */
290
305
  nodes: { [key in any]: OrgChart.node };
306
+
307
+
291
308
  isVisible: boolean;
292
309
  visibleNodeIds: Array<number | string>;
293
310
 
@@ -337,6 +354,33 @@ declare class OrgChart {
337
354
  * @param data node data
338
355
  */
339
356
  add(data: object): OrgChart;
357
+
358
+ /**
359
+ * Adds new node to the nodes collection, redraws the chart and fires remove event
360
+ * ```typescript
361
+ * let chart = new OrgChart('#tree', {});
362
+ * ...
363
+ * chart.addNode({ id: 1, name: "Denny Curtis", title: "CEO" });
364
+ * ```
365
+ * @param data node data
366
+ * @param callback called at the end of animation
367
+ * @param fireEvent indicates if the add event will be called or not
368
+ */
369
+ addNode(data: object, callback?: () => void, fireEvent?: boolean): void;
370
+
371
+ /**
372
+ * Removes specified node from nodes collection, redraws the chart and fires remove event.
373
+ * ```typescript
374
+ * var chart = new OrgChart('#tree', {});
375
+ * chart.removeNode(2);
376
+ * ```
377
+ * @param id identification number of the node
378
+ * @param callback called at the end of animation
379
+ * @param fireEvent indicates if the remove event will be called or not
380
+ */
381
+ removeNode(id: string | number, callback?: () => void, fireEvent?: boolean): void;
382
+
383
+
340
384
  /**
341
385
  * Gets node data.
342
386
  * ```typescript
@@ -610,18 +654,6 @@ declare class OrgChart {
610
654
  */
611
655
  getNode(nodeId: string | number): OrgChart.node;
612
656
 
613
- /**
614
- * Adds new node to the nodes collection, redraws the chart and fires remove event
615
- * ```typescript
616
- * let chart = new OrgChart('#tree', {});
617
- * ...
618
- * chart.addNode({ id: 1, name: "Denny Curtis", title: "CEO" });
619
- * ```
620
- * @param data node data
621
- * @param callback called at the end of animation
622
- * @param fireEvent indicates if the add event will be called or not
623
- */
624
- addNode(data: object, callback?: () => void, fireEvent?: boolean): void;
625
657
 
626
658
  /**
627
659
  * Sets layout.