@balkangraph/orgchart.js 8.14.68 → 8.14.70

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
@@ -13,39 +13,68 @@ declare class OrgChart extends OrgChartBase {
13
13
 
14
14
 
15
15
  /**
16
- * ```typescript
16
+ * Updates the node data
17
+ * ```typescript
17
18
  * var chart = new OrgChart('#tree', {});
18
19
  * ...
19
20
  * chart.update({ id: 1, name: "Updated Name", title: "Updated Title" });
20
21
  * chart.draw();
21
22
  * ```
22
- * Updates the node data
23
23
  * @param newData node data
24
24
  */
25
25
  update(newData: object): OrgChart;
26
26
 
27
27
  /**
28
28
  * Removes specified node from nodes collection
29
+ * ```typescript
30
+ * var chart = new OrgChart('#tree', {});
31
+ * ...
32
+ * chart.remove(2);
33
+ * chart.draw();
34
+ * ```
35
+
29
36
  * @param id identification number of the node
30
37
  */
31
38
  remove(id: string | number): OrgChart;
32
39
  /**
33
40
  * Adds new node to the nodes collection
41
+ * ```typescript
42
+ * var chart = new OrgChart('#tree', {});
43
+ * ...
44
+ * chart.add({ id: 2, pid: 1, name: "Ashley Barnett", title: "Sales Manager" })
45
+ * chart.draw();
46
+ * ```
47
+
34
48
  * @param data node data
35
49
  */
36
50
  add(data: object): OrgChart;
37
51
  /**
38
52
  * Gets node data.
53
+ * ```typescript
54
+ * var chart = new OrgChart('#tree', {});
55
+ * ...
56
+ * let node = chart.get(2);
57
+ * ```
39
58
  * @param id identification number of the node
40
59
  */
41
60
  get(id: string | number): OrgChart.node;
42
61
  /**
43
62
  * If specified node has assistant/s or partner/s as children will return false.
63
+ * ```typescript
64
+ * var chart = new OrgChart('#tree', {});
65
+ * ...
66
+ * let canRemove = chart.canRemove(2);
67
+ * ```
44
68
  * @param id identification number of the node
45
69
  */
46
70
  canRemove(id: string | number): boolean;
47
71
  /**
48
72
  * Expands specified nodes.
73
+ * ```typescript
74
+ * var chart = new OrgChart('#tree', {});
75
+ * ...
76
+ * chart.expand(1, [2]);
77
+ * ```
49
78
  * @param id the id of the node that will not move during the animation
50
79
  * @param ids node ids that will be expanded
51
80
  * @param callback called after the animation completes
@@ -53,6 +82,11 @@ declare class OrgChart extends OrgChartBase {
53
82
  expand(id: string | number, ids: Array<string | number> | "all", callback?: () => void): void;
54
83
  /**
55
84
  * Collapses specified nodes.
85
+ * ```typescript
86
+ * var chart = new OrgChart('#tree', {});
87
+ * ...
88
+ * chart.collapse(1, [2]);
89
+ * ```
56
90
  * @param id the id of the node that will not move
57
91
  * @param ids node ids that will be collapsed
58
92
  * @param callback called after the animation completes
@@ -60,6 +94,11 @@ declare class OrgChart extends OrgChartBase {
60
94
  collapse(id: string | number, ids: Array<string | number>, callback?: () => void): void;
61
95
  /**
62
96
  * Expand/Collapse lists of nodes.
97
+ * ```typescript
98
+ * var chart = new OrgChart('#tree', {});
99
+ * ...
100
+ * chart.expandCollapse(1, [2], [3]);
101
+ * ```
63
102
  * @param id the id of the node that will not move
64
103
  * @param expandIds expand all nodes with ids
65
104
  * @param collapseIds collpase all nodes with ids
@@ -67,7 +106,12 @@ declare class OrgChart extends OrgChartBase {
67
106
  */
68
107
  expandCollapse(id: string | number, expandIds: Array<string | number>, collapseIds: Array<string | number>, callback?: () => void): void;
69
108
  /**
70
- * Changes roots order.
109
+ * Changes roots order.
110
+ * ```typescript
111
+ * var chart = new OrgChart('#tree', {});
112
+ * ...
113
+ * chart.changeRoots(1, [2]);
114
+ * ```
71
115
  * @param id id of a node that will not change is position, can be null
72
116
  * @param roots roots id array in the required order
73
117
  * @param callback called after the roots are changed and animation completes
@@ -75,6 +119,11 @@ declare class OrgChart extends OrgChartBase {
75
119
  changeRoots(id: string | number, roots: Array<string | number>, callback?: () => void): void;
76
120
  /**
77
121
  * Maximize the node. Without parameters maximize all nodes.
122
+ * ```typescript
123
+ * var chart = new OrgChart('#tree', {});
124
+ * ...
125
+ * chart.maximize();
126
+ * ```
78
127
  * @param id the id of the node, if id is null, undefined ot empty string will maximize all nodes
79
128
  * @param horizontalCenter center horizontally
80
129
  * @param verticalCenter center vertically
@@ -82,6 +131,11 @@ declare class OrgChart extends OrgChartBase {
82
131
  */
83
132
  maximize(id?: string | number, horizontalCenter?: boolean, verticalCenter?: boolean, callback?: () => void): void;
84
133
  /**
134
+ * ```typescript
135
+ * var chart = new OrgChart('#tree', {});
136
+ * ...
137
+ * chart.minimize();
138
+ * ```
85
139
  * Minimize the node. Without parameters minimize all nodes.
86
140
  * @param id the id of the node, if id is null, undefined ot empty string will minimize all nodes
87
141
  * @param callback called when the animation completes
@@ -89,6 +143,15 @@ declare class OrgChart extends OrgChartBase {
89
143
  minimize(id?: string | number, callback?: () => void): void;
90
144
  /**
91
145
  * Load nodes data.
146
+ * ```typescript
147
+ * var chart = new OrgChart('#tree', {});
148
+ * ...
149
+ * chart.load([
150
+ * { id: 1, name: "Denny Curtis" },
151
+ * { id: 2, pid: 1, name: "Ashley Barnett" },
152
+ * { id: 3, pid: 1, name: "Caden Ellison" }
153
+ * ]);
154
+ * ```
92
155
  * @param data node data array
93
156
  * @param callback function called after the load
94
157
  */
@@ -96,6 +159,11 @@ declare class OrgChart extends OrgChartBase {
96
159
 
97
160
  /**
98
161
  * Updates the node data, redraws the chart and fires update event.
162
+ * ```typescript
163
+ * var chart = new OrgChart('#tree', {});
164
+ * ...
165
+ * chart.updateNode({ id: 4, pid: 2, name: "Updated Name", title: "Updated Title" });
166
+ * ```
99
167
  * @param data node data
100
168
  * @param callback function called when the animation completes
101
169
  * @param fireEvent if it set to true the update event is called
@@ -104,16 +172,31 @@ declare class OrgChart extends OrgChartBase {
104
172
 
105
173
  /**
106
174
  * Loads nodes from xml.
175
+ * ```typescript
176
+ * var chart = new OrgChart('#tree', {});
177
+ * 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>';
178
+ * chart.loadXML(xml);
179
+ * ```
107
180
  * @param xml Xml with node structure
108
181
  * @param callback function called after the load
109
182
  */
110
183
  loadXML(xml: string, callback?: () => void): OrgChart;
111
184
  /**
112
185
  * Gets nodes as xml.
186
+ * ```typescript
187
+ * var chart = new OrgChart('#tree', {});
188
+ * let xml = chart.getXML();
189
+ * ```
113
190
  */
114
191
  getXML(): string;
115
192
  /**
116
193
  * Draws the chart.
194
+ * ```typescript
195
+ * var chart = new OrgChart('#tree', {});
196
+ * ...
197
+ * chart.update({ id: 1, name: "Updated Name", title: "Updated Title" });
198
+ * chart.draw();
199
+ * ```
117
200
  * @param action Action for example OrgChart.action.centerNode, default is OrgChart.action.update
118
201
  * @param actionParams parameters for the action
119
202
  * @param callback called when the animation completes
@@ -121,23 +204,48 @@ declare class OrgChart extends OrgChartBase {
121
204
  draw(action?: OrgChart.action, actionParams?: any, callback?: () => void): void;
122
205
  /**
123
206
  * Gets the width of the container.
207
+ * ```typescript
208
+ * var chart = new OrgChart('#tree', {});
209
+ * ...
210
+ * let width = chart.width();
211
+ * ```
124
212
  */
125
213
  width(): number;
126
214
  /**
215
+ * ```typescript
216
+ * var chart = new OrgChart('#tree', {});
217
+ * ...
218
+ * let height = chart.height();
219
+ * ```
127
220
  * Gets the height of the container.
128
221
  */
129
222
  height(): number;
130
223
  /**
131
224
  * Gets the view box attribute of the svg html element.
225
+ * ```typescript
226
+ * var chart = new OrgChart('#tree', {});
227
+ * ...
228
+ * let viewBox = chart.getViewBox();
229
+ * ```
132
230
  */
133
231
  getViewBox(): Array<number>;
134
232
  /**
135
233
  * Sets the view box attribute of the svg html element.
234
+ * ```typescript
235
+ * var chart = new OrgChart('#tree', {});
236
+ * ...
237
+ * chart.setViewBox();
238
+ * ```
136
239
  * @param viewBox
137
240
  */
138
241
  setViewBox(viewBox: Array<number>): void;
139
242
  /**
140
243
  * Gets the current scale of the chart.
244
+ * ```typescript
245
+ * var chart = new OrgChart('#tree', {});
246
+ * ...
247
+ * let scale = chart.getScale();
248
+ * ```
141
249
  * @param viewBox
142
250
  */
143
251
  getScale(viewBox?: Array<number>): number;
@@ -145,11 +253,21 @@ declare class OrgChart extends OrgChartBase {
145
253
  /**
146
254
  * Sets the current scale of the chart.
147
255
  * Returns the actual scale limited by scaleMax and scaleMin
256
+ * ```typescript
257
+ * var chart = new OrgChart('#tree', {});
258
+ * ...
259
+ * chart.setScale(1.2);
260
+ * ```
148
261
  * @param newScale new scale value
149
262
  */
150
263
  setScale(newScale: number): number;
151
264
  /**
152
265
  * Animates specified node with ripple animation - highlight the node.
266
+ * ```typescript
267
+ * var chart = new OrgChart('#tree', {});
268
+ * ...
269
+ * chart.ripple(2);
270
+ * ```
153
271
  * @param id the id of the node
154
272
  * @param clientX x value of the ripple center in the node
155
273
  * @param clientY y value of the ripple center in the node
@@ -157,6 +275,11 @@ declare class OrgChart extends OrgChartBase {
157
275
  ripple(id: string | number, clientX?: number, clientY?: number): void;
158
276
  /**
159
277
  * Centers specified node on the screen.
278
+ * ```typescript
279
+ * var chart = new OrgChart('#tree', {});
280
+ * ...
281
+ * chart.center(2);
282
+ * ```
160
283
  * @param nodeId the id of the node
161
284
  * @param options parentState: OrgChart.COLLAPSE_PARENT_NEIGHBORS, childrenState: OrgChart.COLLAPSE_SUB_CHILDRENS, rippleId: rippleId, vertical: false, horizontal: false
162
285
  * @param callback called when the animation completes
@@ -170,43 +293,78 @@ declare class OrgChart extends OrgChartBase {
170
293
  } | null, callback?: () => void): void;
171
294
  /**
172
295
  * Fits the content to the visible area.
296
+ * ```typescript
297
+ * var chart = new OrgChart('#tree', {});
298
+ * ...
299
+ * chart.fit();
300
+ * ```
173
301
  * @param callback called when the animation completes
174
302
  */
175
303
  fit(callback?: () => void): void;
176
304
  /**
177
305
  * Toggles full screen mode.
306
+ * ```typescript
307
+ * var chart = new OrgChart('#tree', {});
308
+ * ...
309
+ * chart.toggleFullScreen();
310
+ * ```
178
311
  */
179
312
  toggleFullScreen(): void;
180
313
  /**
181
314
  * Gets the node as {@link OrgChart.node} object.
315
+ * ```typescript
316
+ * var chart = new OrgChart('#tree', {});
317
+ * ...
318
+ * let node = chart.getNode(2);
319
+ * ```
182
320
  * @param nodeId
183
321
  */
184
322
  getNode(nodeId: string | number): OrgChart.node;
185
- /**
186
- * Sets layout.
187
- * @param layout layout type
188
- * @param lcn lyout config name for the specified sub tree
189
- */
190
323
 
191
324
  /**
192
325
  * Adds new node to the nodes collection, redraws the chart and fires remove event
326
+ * ```typescript
327
+ * var chart = new OrgChart('#tree', {});
328
+ * ...
329
+ * chart.addNode({ id: 1, name: "Denny Curtis", title: "CEO" });
330
+ * ```
193
331
  * @param data node data
194
332
  * @param callback called at the end of animation
195
333
  * @param fireEvent indicates if the add event will be called or not
196
334
  */
197
335
  addNode(data: object, callback?: () => void, fireEvent?: boolean): void;
198
336
 
337
+ /**
338
+ * Sets layout.
339
+ * ```typescript
340
+ * var chart = new OrgChart('#tree', {});
341
+ * ...
342
+ * chart.setLayout(OrgChart.tree);
343
+ * ```
344
+ * @param layout layout type
345
+ * @param lcn lyout config name for the specified sub tree
346
+ */
347
+
199
348
  setLayout(layout: OrgChart.layout | number, lcn?: string): void;
200
349
  /**
201
350
  * Sets orientation.
351
+ * ```typescript
352
+ * var chart = new OrgChart('#tree', {});
353
+ * ...
354
+ * chart.setOrientation(2);
355
+ * ```
202
356
  * @param orientation orientation type
203
357
  * @param lcn lyout config name for the specified sub tree
204
358
  * @param callback called at the end of animation
205
359
  */
206
360
  setOrientation(orientation: OrgChart.orientation, lcn?: string, callback?: () => void): void;
207
361
 
208
-
209
362
  /**
363
+ * ```typescript
364
+ * var chart = new OrgChart('#tree', {});
365
+ * ...
366
+ * chart.moveNodesToVisibleArea([2, 3]);
367
+ * ```
210
368
  * Moves specified nodes to the visible area.
211
369
  * @param ids Array of node ids
212
370
  * @param callback called at the end of animation
@@ -215,6 +373,11 @@ declare class OrgChart extends OrgChartBase {
215
373
 
216
374
  /**
217
375
  * Search in the chart.
376
+ * ```typescript
377
+ * var chart = new OrgChart('#tree', {});
378
+ * ...
379
+ * chart.search("Ava");
380
+ * ```
218
381
  * @param value search for value
219
382
  * @param searchInFields search in field names
220
383
  * @param retrieveFields retrive data for fields
@@ -229,25 +392,50 @@ declare class OrgChart extends OrgChartBase {
229
392
  }>;
230
393
  /**
231
394
  * Gets collpased node ids of the specifeid node
395
+ * ```typescript
396
+ * var chart = new OrgChart('#tree', {});
397
+ * ...
398
+ * let ids = chart.getCollapsedIds(2);
399
+ * ```
232
400
  * @param node
233
401
  */
234
402
  getCollapsedIds(node: OrgChart.node): Array<string | number>;
235
403
  /**
236
404
  * State to url.
405
+ * ```typescript
406
+ * var chart = new OrgChart('#tree', {});
407
+ * ...
408
+ * let url = chart.stateToUrl();
409
+ * ```
237
410
  * {@link https://balkan.app/OrgChartJS/Docs/State | See doc...}
238
411
  */
239
412
  stateToUrl(): string;
240
413
  /**
241
414
  * Genereates unique identification number that can be used for new nodes
415
+ * ```typescript
416
+ * var chart = new OrgChart('#tree', {});
417
+ * ...
418
+ * let id = chart.generateId();
419
+ * ```
242
420
  */
243
421
  generateId(): string;
244
422
  /**
245
423
  * Destroys the object.
424
+ * ```typescript
425
+ * var chart = new OrgChart('#tree', {});
426
+ * ...
427
+ * chart.destroy();
428
+ * ```
246
429
  */
247
430
  destroy(): void;
248
431
  /**
249
432
  * Replaces the id, pid, stpid, ppid and the ids in clinks, slinks, dottedLines, groupDottedLines.
250
433
  * After the replacment updates the UI
434
+ * ```typescript
435
+ * var chart = new OrgChart('#tree', {});
436
+ * ...
437
+ * chart.replaceIds[{2:21, 3:31});
438
+ * ```
251
439
  * @param old_new_ids dictionary containing old and new ids
252
440
  * @param callback called when the replacment completes
253
441
  */
@@ -256,6 +444,12 @@ declare class OrgChart extends OrgChartBase {
256
444
  }, callback?: () => void): void;
257
445
  /**
258
446
  * Adds curved link.
447
+ * ```typescript
448
+ * var chart = new OrgChart('#tree', {});
449
+ * ...
450
+ * chart.addClink(4, 0, 'text')
451
+ * chart.draw();
452
+ * ```
259
453
  * @param from from node with id
260
454
  * @param to to node with id
261
455
  * @param label link label
@@ -264,12 +458,24 @@ declare class OrgChart extends OrgChartBase {
264
458
  addClink(from: string | number, to: string | number, label?: string, template?: string): OrgChart;
265
459
  /**
266
460
  * Removes curved link.
461
+ * ```typescript
462
+ * var chart = new OrgChart('#tree', {});
463
+ * ...
464
+ * chart.removeClink(4, 0)
465
+ * chart.draw();
466
+ * ```
267
467
  * @param from from node with id
268
468
  * @param to to node with id
269
469
  */
270
470
  removeClink(from: string | number, to: string | number): OrgChart;
271
471
  /**
272
472
  * Adds second link.
473
+ * ```typescript
474
+ * var chart = new OrgChart('#tree', {});
475
+ * ...
476
+ * chart.addSlink(4, 0, 'text')
477
+ * chart.draw();
478
+ * ```
273
479
  * @param from from node with id
274
480
  * @param to to node with id
275
481
  * @param label link label
@@ -278,12 +484,19 @@ declare class OrgChart extends OrgChartBase {
278
484
  addSlink(from: string | number, to: string | number, label?: string, template?: string): OrgChart;
279
485
  /**
280
486
  * Removes second link.
487
+ * ```typescript
488
+ * var chart = new OrgChart('#tree', {});
489
+ * ...
490
+ * chart.removeSlink(4, 0)
491
+ * chart.draw();
492
+ * ```
281
493
  * @param from from node with id
282
494
  * @param to to node with id
283
495
  */
284
496
  removeSlink(from: string | number, to: string | number): OrgChart;
285
497
  /**
286
498
  * Gets svg html element
499
+ *
287
500
  */
288
501
  getSvg(): SVGAElement;
289
502
  /**