balkan-orgchart-js-community 9.1.76 → 9.1.79

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
@@ -33,7 +33,7 @@
33
33
  * </html>
34
34
  * ```
35
35
  */
36
- declare class OrgChart {
36
+ declare class OrgChart {
37
37
  /**
38
38
  * ```typescript
39
39
  * let chart = new OrgChart('#tree', {});
@@ -43,6 +43,230 @@ declare class OrgChart {
43
43
  */
44
44
  constructor(element?: HTMLElement | string | null, options?: OrgChart.options);
45
45
 
46
+
47
+ /**
48
+ * The on() method of the OrgChart class sets up a function that will be called whenever the specified event is delivered to the target. *
49
+ * ```typescript
50
+ * let chart = new OrgChart('#tree', {});
51
+ * chart.on('init', function () {
52
+ * // console.log("initiated")
53
+ * })
54
+ * chart.load(nodes);
55
+ * ```
56
+ * @category Event Listeners
57
+ * @param type A case-sensitive string representing the event type to listen for.
58
+ * @param listener The object that receives a notification when an event of the specified type occurs. This must be a JavaScript function.
59
+ */
60
+ 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;
61
+
62
+
63
+
64
+ /**
65
+ * Occurs when the node data has been updated by updateNode method.
66
+ * ```typescript
67
+ * var chart = new OrgChart('#tree', {});
68
+ * chart.onUpdateNode((args) => {
69
+ * //return false; to cancel the operation
70
+ * });
71
+ * ```
72
+ * @category Event Listeners
73
+ * @param listener
74
+ */
75
+ onUpdateNode(listener: (this: OrgChart, args: OrgChart.updateNodeEventArgs) => void): OrgChart;
76
+
77
+ /**
78
+ * 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.
79
+ * Use this event listener to synch your server side database with this.config.nodes, this.config.clinks, this.config.slinks etc.
80
+ * ```typescript
81
+ * var chart = new OrgChart('#tree', {});
82
+ * chart.onUpdated(() => {
83
+ * //Update your server database with this.config.nodes, this.config.clinks, this.config.slinks etc.
84
+ * });
85
+ * ```
86
+ * @category Event Listeners
87
+ */
88
+ onUpdated(listener: (this: OrgChart) => void): OrgChart;
89
+
90
+
91
+ /**
92
+ * Occurs when a node has been removed by removeNode method.
93
+ * ```typescript
94
+ * var chart = new OrgChart('#tree', {});
95
+ * chart.onRemoveNode((args) => {
96
+ * //return false; to cancel the operation
97
+ * });
98
+ * ```
99
+ * @category Event Listeners
100
+ * @param listener
101
+ */
102
+ onRemoveNode(listener: (this: OrgChart, args: OrgChart.removeNodeEvemtArgs) => void): OrgChart;
103
+
104
+ /**
105
+ * Occurs when a node has been added by addNode method.
106
+ * ```typescript
107
+ * var chart = new OrgChart('#tree', {});
108
+ * chart.onAddNode((args) => {
109
+ * //return false; to cancel the operation
110
+ * });
111
+ * ```
112
+ * @category Event Listeners
113
+ * @param listener
114
+ */
115
+ onAddNode(listener: (this: OrgChart, args: OrgChart.addNodeEvemtArgs) => void): OrgChart;
116
+ /**
117
+ * The onDrag event occurs when a node is dragged. *enableDragDrop* option has to be turned on.
118
+ * ```typescript
119
+ * var chart = new OrgChart('#tree', {});
120
+ * chart.onDrag(() => {
121
+ * //return false; to cancel the operation
122
+ * });
123
+ * ```
124
+ * @category Event Listeners
125
+ * @param listener
126
+ */
127
+ onDrag(listener: (this: OrgChart, args: OrgChart.dragEventArgs) => void): OrgChart;
128
+ /**
129
+ * The onDrop event occurs when a node is dropped. *enableDragDrop* option has to be turned on.
130
+ * ```typescript
131
+ * var chart = new OrgChart('#tree', {});
132
+ * chart.onDrop(() => {
133
+ * //return false; to cancel the operation
134
+ * });
135
+ * ```
136
+ * @category Event Listeners
137
+ * @param listener
138
+ */
139
+ onDrop(listener: (this: OrgChart, args: OrgChart.dropEventArgs) => void): OrgChart;
140
+
141
+
142
+
143
+ /**
144
+ * Occurs when the nodes in OrgChart has been created and loaded to the DOM.
145
+ * ```typescript
146
+ * let chart = new OrgChart('#tree', {});
147
+ * chart.onInit(() => {
148
+ * });
149
+ * chart.load(nodes);
150
+ * ```
151
+ * @category Event Listeners
152
+ * @param listener
153
+ */
154
+ onInit(listener: (this: OrgChart) => void): OrgChart;
155
+
156
+ /**
157
+ * The onRedraw event occurs when the chart is redrawed.
158
+ * ```typescript
159
+ * let chart = new OrgChart('#tree', {});
160
+ * chart.onRedraw(() => {
161
+ * });
162
+ * chart.load(nodes);
163
+ * ```
164
+ * @category Event Listeners
165
+ * @param listener
166
+ */
167
+ onRedraw(listener: (this: OrgChart) => void): OrgChart;
168
+
169
+ /**
170
+ * The onExpandCollapseButtonClick event occurs when the chart is redrawed.
171
+ * ```typescript
172
+ * let chart = new OrgChart('#tree', {});
173
+ * chart.onExpandCollapseButtonClick(() => {
174
+ * //return false; to cancel the operation
175
+ * });
176
+ * chart.load(nodes);
177
+ * ```
178
+ * @category Event Listeners
179
+ * @param listener
180
+ */
181
+ onExpandCollapseButtonClick(listener: (this: OrgChart, args: OrgChart.expandCollapseButtonClickEventArgs) => void): OrgChart;
182
+
183
+ /**
184
+ * 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.
185
+ * ```typescript
186
+ * let chart = new OrgChart('#tree', {});
187
+ * chart.onExportStart(() => {
188
+ * args.styles += '<link href="[link to my styles]" rel="stylesheet">';
189
+ * //return false; to cancel the operation
190
+ * });
191
+ * chart.load(nodes);
192
+ * ```
193
+ * @category Event Listeners
194
+ * @param listener
195
+ */
196
+ onExportStart(listener: (this: OrgChart, args: OrgChart.exportStartEventArgs) => void): OrgChart;
197
+
198
+ /**
199
+ * 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.
200
+ * ```typescript
201
+ * let chart = new OrgChart('#tree', {});
202
+ * chart.onExportEnd(() => {
203
+ * //return false; to cancel the operation for example id you prefer the exported document to not download
204
+ * });
205
+ * chart.load(nodes);
206
+ * ```
207
+ * @category Event Listeners
208
+ * @param listener
209
+ */
210
+ onExportEnd(listener: (this: OrgChart, args: OrgChart.exportEndEventArgs) => void): OrgChart;
211
+
212
+ /**
213
+ * On node click event listener.
214
+ * ```typescript
215
+ * let chart = new OrgChart('#tree', {});
216
+ * chart.onNodeClick(() => {
217
+ * //return false; to cancel the operation
218
+ * });
219
+ * chart.load(nodes);
220
+ * ```
221
+ * @category Event Listeners
222
+ * @param listener
223
+ */
224
+ onNodeClick(listener: (this: OrgChart, args: OrgChart.nodeClickEventArgs) => void): OrgChart;
225
+
226
+
227
+ /**
228
+ * On canvas SVG click event listener.
229
+ * ```typescript
230
+ * let chart = new OrgChart('#tree', {});
231
+ * chart.onCanvasClick(() => {
232
+ * });
233
+ * chart.load(nodes);
234
+ * ```
235
+ * @category Event Listeners
236
+ * @param listener
237
+ */
238
+ onCanvasClick(listener: (this: OrgChart, args: OrgChart.canvasClickEventArgs) => void): OrgChart;
239
+
240
+ /**
241
+ * In onAIToolCalls we parse the AI responce to our functions
242
+ * ```typescript
243
+ * chart.onAIToolCalls(function(args){
244
+ * for(var toolCall of args.toolCalls){
245
+ * if (toolCall.FunctionName == 'sendEmail'){
246
+ * toolCall.FunctionResult = sendEmail(toolCall.FunctionArguments);
247
+ * }
248
+ * }
249
+ * });
250
+ * ```
251
+ * [Go to AI doc page for more details](https://balkan.app/OrgChartJS/Docs/AI)
252
+ * @param listener
253
+ */
254
+ onAIToolCalls(listener: (this: OrgChart, args: OrgChart.aiToolCallsEventArgs) => void): OrgChart;
255
+
256
+ /**
257
+ * On node double click event listener.
258
+ * ```typescript
259
+ * let chart = new OrgChart('#tree', {});
260
+ * chart.onNodeDoubleClick(() => {
261
+ * //return false; to cancel the operation
262
+ * });
263
+ * chart.load(nodes);
264
+ * ```
265
+ * @category Event Listeners
266
+ * @param listener
267
+ */
268
+ onNodeDoubleClick(listener: (this: OrgChart, args: OrgChart.nodeDoubleClickEventArgs) => void): OrgChart;
269
+
46
270
 
47
271
  /**
48
272
  * SVG icons
@@ -266,173 +490,25 @@ declare class OrgChart {
266
490
  * @param pid parent id
267
491
  */
268
492
  canUpdateLink(id: string | number, pid: string | number): boolean;
269
-
270
-
271
- /**
272
- * The on() method of the OrgChart class sets up a function that will be called whenever the specified event is delivered to the target. *
273
- * ```typescript
274
- * let chart = new OrgChart('#tree', {});
275
- * chart.on('init', function () {
276
- * // console.log("initiated")
277
- * })
278
- * chart.load(nodes);
279
- * ```
280
- * @category Event Listeners
281
- * @param type A case-sensitive string representing the event type to listen for.
282
- * @param listener The object that receives a notification when an event of the specified type occurs. This must be a JavaScript function.
283
- */
284
- 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;
285
-
493
+
286
494
  /**
287
495
  * 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.
288
496
  * ```typescript
289
497
  * let chart = new OrgChart('#tree', {});
290
- * let listener = function(sender, args){
291
- * console.log(sender.removeListener('update', listener));
292
- * };
293
- * chart.on('update', listener);
294
- * chart.load(nodes)
295
- * ```
296
- };
297
-
298
- family.on('update', listener);
299
- * @param type A string which specifies the type of event for which to remove an event listener
300
- * @param listener The event listener function of the event handler to remove from the event target
301
- */
302
- 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;
303
-
304
-
305
- /**
306
- * Occurs when the node data has been updated by updateNode method.
307
- * ```typescript
308
- * var chart = new OrgChart('#tree', {});
309
- * chart.onUpdateNode((args) => {
310
- * //return false; to cancel the operation
311
- * });
312
- * ```
313
- * @category Event Listeners
314
- * @param listener
315
- */
316
- onUpdateNode(listener: (args: {
317
- /**
318
- * old node data
319
- */
320
- oldData: OrgChart.nodeData,
321
- /**
322
- * new node data
323
- */
324
- newData: OrgChart.nodeData
325
- }) => void): OrgChart;
326
-
327
- /**
328
- * 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.
329
- * Use this event listener to synch your server side database with this.config.nodes, this.config.clinks, this.config.slinks etc.
330
- * ```typescript
331
- * var chart = new OrgChart('#tree', {});
332
- * chart.onUpdated(() => {
333
- * //Update your server database with this.config.nodes, this.config.clinks, this.config.slinks etc.
334
- * });
335
- * ```
336
- * @category Event Listeners
337
- */
338
- onUpdated(): OrgChart;
339
-
340
-
341
- /**
342
- * Occurs when a node has been removed by removeNode method.
343
- * ```typescript
344
- * var chart = new OrgChart('#tree', {});
345
- * chart.onRemoveNode((args) => {
346
- * //return false; to cancel the operation
347
- * });
348
- * ```
349
- * @category Event Listeners
350
- * @param listener
351
- */
352
- onRemoveNode(listener: (args: {
353
- /**
354
- * node id
355
- */
356
- id: number | string,
357
- /**
358
- * 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.
359
- */
360
- newPidsAndStpidsForIds: {
361
- newPidsForIds: { [key in any]: string | number },
362
- newStpidsForIds: { [key in any]: string | number }
363
- }
364
- }) => void): OrgChart;
365
-
366
- /**
367
- * Occurs when a node has been added by addNode method.
368
- * ```typescript
369
- * var chart = new OrgChart('#tree', {});
370
- * chart.onAddNode((args) => {
371
- * //return false; to cancel the operation
372
- * });
373
- * ```
374
- * @category Event Listeners
375
- * @param listener
376
- */
377
- onAddNode(listener: (args: {
378
- /**
379
- * new added data node
380
- */
381
- data: OrgChart.nodeData
382
- }) => void): OrgChart;
383
- /**
384
- * The onDrag event occurs when a node is dragged. *enableDragDrop* option has to be turned on.
385
- * ```typescript
386
- * var chart = new OrgChart('#tree', {});
387
- * chart.onDrag(() => {
388
- * //return false; to cancel the operation
389
- * });
390
- * ```
391
- * @category Event Listeners
392
- * @param listener
393
- */
394
- onDrag(listener: (args: {
395
- /**
396
- * dragged node id
397
- */
398
- dragId: string | number,
399
- event: MouseEvent,
400
- /**
401
- * array of node ids
402
- *
403
- * this property is initialized only if movable option is set
404
- */
405
- nodeIds: Array<string | number>
406
- }) => void): OrgChart;
407
- /**
408
- * The onDrop event occurs when a node is dropped. *enableDragDrop* option has to be turned on.
409
- * ```typescript
410
- * var chart = new OrgChart('#tree', {});
411
- * chart.onDrop(() => {
412
- * //return false; to cancel the operation
413
- * });
498
+ * let listener = function(sender, args){
499
+ * console.log(sender.removeListener('update', listener));
500
+ * };
501
+ * chart.on('update', listener);
502
+ * chart.load(nodes)
414
503
  * ```
415
- * @category Event Listeners
416
- * @param listener
504
+ };
505
+
506
+ family.on('update', listener);
507
+ * @param type A string which specifies the type of event for which to remove an event listener
508
+ * @param listener The event listener function of the event handler to remove from the event target
417
509
  */
418
- onDrop(listener: (args: {
419
- /**
420
- * dragged node id
421
- */
422
- dragId: string | number,
423
- /**
424
- * dropped node id
425
- */
426
- dropId: string | number,
427
- /**
428
- * draging element
429
- */
430
- dragNodeElement: HTMLElement,
431
- /**
432
- * Mouse event
433
- */
434
- event: MouseEvent
435
- }) => void): OrgChart;
510
+ 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;
511
+
436
512
 
437
513
  /**
438
514
  * All chart nodes
@@ -1189,293 +1265,52 @@ declare class OrgChart {
1189
1265
  * ```typescript
1190
1266
  * let chart = new OrgChart('#tree', {});
1191
1267
  * ...
1192
- * chart.redo();
1193
- * ```
1194
- * @param callback called when the animation completes
1195
- */
1196
- redo(callback?: () => void): void;
1197
-
1198
- /**
1199
- * Clears all Redo stack steps.
1200
- * ```typescript
1201
- * let chart = new OrgChart('#tree', {});
1202
- * ...
1203
- * chart.clearRedo();
1204
- * ```
1205
- */
1206
- clearRedo(): void;
1207
-
1208
- /**
1209
- * Clears all Undo stack steps.
1210
- * ```typescript
1211
- * let chart = new OrgChart('#tree', {});
1212
- * ...
1213
- * chart.clearUndo();
1214
- * ```
1215
- */
1216
- clearUndo(): void;
1217
- /**
1218
- * Returns the number of Undo stack steps
1219
- * ```typescript
1220
- * let chart = new OrgChart('#tree', {});
1221
- * ...
1222
- * let undoSteps = chart.undoStepsCount();
1223
- * ```
1224
- */
1225
- undoStepsCount(): number;
1226
- /**
1227
- * Returns the number of Redo stack steps
1228
- * ```typescript
1229
- * let chart = new OrgChart('#tree', {});
1230
- * ...
1231
- * let redoSteps = chart.redoStepsCount();
1232
- * ```
1233
- */
1234
- redoStepsCount(): number;
1235
-
1236
-
1237
-
1238
-
1239
- /**
1240
- * Occurs when the nodes in OrgChart has been created and loaded to the DOM.
1241
- * ```typescript
1242
- * let chart = new OrgChart('#tree', {});
1243
- * chart.onInit(() => {
1244
- * });
1245
- * chart.load(nodes);
1246
- * ```
1247
- * @category Event Listeners
1248
- * @param listener
1249
- */
1250
- onInit(listener: (this: OrgChart) => void): OrgChart;
1251
-
1252
- /**
1253
- * The onRedraw event occurs when the chart is redrawed.
1254
- * ```typescript
1255
- * let chart = new OrgChart('#tree', {});
1256
- * chart.onRedraw(() => {
1257
- * });
1258
- * chart.load(nodes);
1259
- * ```
1260
- * @category Event Listeners
1261
- * @param listener
1262
- */
1263
- onRedraw(listener: (this: OrgChart) => void): OrgChart;
1264
-
1265
- /**
1266
- * The onExpandCollapseButtonClick event occurs when the chart is redrawed.
1267
- * ```typescript
1268
- * let chart = new OrgChart('#tree', {});
1269
- * chart.onExpandCollapseButtonClick(() => {
1270
- * //return false; to cancel the operation
1271
- * });
1272
- * chart.load(nodes);
1273
- * ```
1274
- * @category Event Listeners
1275
- * @param listener
1276
- */
1277
- onExpandCollapseButtonClick(listener: (this: OrgChart, args: {
1278
- /**
1279
- * Indicates id the operation is collaps or expand
1280
- */
1281
- collapsing: boolean,
1282
- /**
1283
- * the id of the clicked node
1284
- */
1285
- id: number | string,
1286
- /**
1287
- * node ids that will be expanded or collapsed
1288
- */
1289
- ids: Array<number | string>
1290
- }) => void): OrgChart;
1291
-
1292
- /**
1293
- * 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.
1294
- * ```typescript
1295
- * let chart = new OrgChart('#tree', {});
1296
- * chart.onExportStart(() => {
1297
- * args.styles += '<link href="[link to my styles]" rel="stylesheet">';
1298
- * //return false; to cancel the operation
1299
- * });
1300
- * chart.load(nodes);
1301
- * ```
1302
- * @category Event Listeners
1303
- * @param listener
1304
- */
1305
- onExportStart(listener: (this: OrgChart, args: {
1306
- options: {
1307
- childLevels?: number,
1308
- expandChildren?: boolean,
1309
- fileName?: string,
1310
- footer?: string,
1311
- header?: string,
1312
- height?: number,
1313
- width?: number,
1314
- landscape?: boolean,
1315
- margin?: Array<number>,
1316
- min?: boolean,
1317
- openInNewTab?: boolean,
1318
- padding?: number,
1319
- parentLevels?: number,
1320
- type?: string,
1321
- pages?: Array<{
1322
- chartInstance?: OrgChart,
1323
- childLevels?: number,
1324
- expandChildren?: boolean,
1325
- footer?: string,
1326
- header?: string,
1327
- margin?: Array<number>,
1328
- min?: boolean,
1329
- padding?: number,
1330
- parentLevels?: number,
1331
- isProfile?: boolean,
1332
- nodeId?: number | string,
1333
- content?: string,
1334
- height?: number,
1335
- width?: number,
1336
- }>
1337
- },
1338
- pages?: Array<SVGElement>,
1339
- styles?: string
1340
- }) => void): OrgChart;
1341
-
1342
- /**
1343
- * 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.
1344
- * ```typescript
1345
- * let chart = new OrgChart('#tree', {});
1346
- * chart.onExportEnd(() => {
1347
- * //return false; to cancel the operation for example id you prefer the exported document to not download
1348
- * });
1349
- * chart.load(nodes);
1350
- * ```
1351
- * @category Event Listeners
1352
- * @param listener
1353
- */
1354
- onExportEnd(listener: (this: OrgChart, args:
1355
- /**
1356
- * for PDF/PNG
1357
- */
1358
- {
1359
- /**
1360
- * the array buffer is the exported document, you can save it on a server or send it via email
1361
- *
1362
- * this property is initialized only for PDF/PNG exports
1363
- */
1364
- ArrayBuffer: ArrayBuffer
1365
- /**
1366
- * extension
1367
- *
1368
- * this property is initialized only for CSV/XML exports
1369
- */
1370
- ext: string,
1371
- /**
1372
- * filename, you can change the filename here
1373
- *
1374
- * this property is initialized only for CSV/XML exports
1375
- */
1376
- filename: string,
1377
- /**
1378
- * an array of node objects
1379
- *
1380
- * this property is initialized only for CSV/XML exports
1381
- */
1382
- nodes: Array<object>,
1383
- /**
1384
- * csv ot xml string
1385
- *
1386
- * this property is initialized only for CSV/XML/SVG exports
1387
- */
1388
- content: string,
1389
- /**
1390
- * add extra styles
1391
- *
1392
- * this property is initialized only for SVG exports
1393
- */
1394
- styles: string,
1395
- }) => void): OrgChart;
1396
-
1397
- /**
1398
- * On node click event listener.
1399
- * ```typescript
1400
- * let chart = new OrgChart('#tree', {});
1401
- * chart.onNodeClick(() => {
1402
- * //return false; to cancel the operation
1403
- * });
1404
- * chart.load(nodes);
1405
- * ```
1406
- * @category Event Listeners
1407
- * @param listener
1408
- */
1409
- onNodeClick(listener: (this: OrgChart, args: {
1410
- /**
1411
- * node JSON object
1412
- */
1413
- node: OrgChart.node,
1414
- /**
1415
- * the browser event
1416
- */
1417
- event: any
1418
- }) => void): OrgChart;
1419
-
1420
-
1421
- /**
1422
- * On canvas SVG click event listener.
1423
- * ```typescript
1424
- * let chart = new OrgChart('#tree', {});
1425
- * chart.onCanvasClick(() => {
1426
- * });
1427
- * chart.load(nodes);
1268
+ * chart.redo();
1428
1269
  * ```
1429
- * @category Event Listeners
1430
- * @param listener
1431
- */
1432
- onCanvasClick(listener: (this: OrgChart, args: {
1433
- /**
1434
- * the browser event
1435
- */
1436
- event: any
1437
- }) => void): OrgChart;
1270
+ * @param callback called when the animation completes
1271
+ */
1272
+ redo(callback?: () => void): void;
1438
1273
 
1439
1274
  /**
1440
- * In onAIToolCalls we parse the AI responce to our functions
1441
- * ```typescript
1442
- * chart.onAIToolCalls(function(args){
1443
- * for(var toolCall of args.toolCalls){
1444
- * if (toolCall.FunctionName == 'sendEmail'){
1445
- * toolCall.FunctionResult = sendEmail(toolCall.FunctionArguments);
1446
- * }
1447
- * }
1448
- * });
1275
+ * Clears all Redo stack steps.
1276
+ * ```typescript
1277
+ * let chart = new OrgChart('#tree', {});
1278
+ * ...
1279
+ * chart.clearRedo();
1449
1280
  * ```
1450
- * [Go to AI doc page for more details](https://balkan.app/OrgChartJS/Docs/AI)
1451
- * @param listener
1452
1281
  */
1453
- onAIToolCalls(listener: (this: OrgChart, args: {
1454
- toolCalls: Array<{
1455
- FunctionName : string,
1456
- FunctionResult : string,
1457
- FunctionArguments : { [key: string]: any }
1458
- }>
1459
- }) => void): OrgChart;
1460
-
1282
+ clearRedo(): void;
1283
+
1461
1284
  /**
1462
- * On node double click event listener.
1285
+ * Clears all Undo stack steps.
1463
1286
  * ```typescript
1464
1287
  * let chart = new OrgChart('#tree', {});
1465
- * chart.onNodeDoubleClick(() => {
1466
- * //return false; to cancel the operation
1467
- * });
1468
- * chart.load(nodes);
1288
+ * ...
1289
+ * chart.clearUndo();
1469
1290
  * ```
1470
- * @category Event Listeners
1471
- * @param listener
1472
- */
1473
- onNodeDoubleClick(listener: (this: OrgChart, args: {
1474
- /**
1475
- * clicked node data
1476
- */
1477
- data: object
1478
- }) => void): OrgChart;
1291
+ */
1292
+ clearUndo(): void;
1293
+ /**
1294
+ * Returns the number of Undo stack steps
1295
+ * ```typescript
1296
+ * let chart = new OrgChart('#tree', {});
1297
+ * ...
1298
+ * let undoSteps = chart.undoStepsCount();
1299
+ * ```
1300
+ */
1301
+ undoStepsCount(): number;
1302
+ /**
1303
+ * Returns the number of Redo stack steps
1304
+ * ```typescript
1305
+ * let chart = new OrgChart('#tree', {});
1306
+ * ...
1307
+ * let redoSteps = chart.redoStepsCount();
1308
+ * ```
1309
+ */
1310
+ redoStepsCount(): number;
1311
+
1312
+
1313
+
1479
1314
 
1480
1315
  /**
1481
1316
  * The tree div element.
@@ -2299,6 +2134,202 @@ declare class OrgChart {
2299
2134
 
2300
2135
  declare namespace OrgChart {
2301
2136
 
2137
+ interface updateNodeEventArgs{
2138
+ /**
2139
+ * old node data
2140
+ */
2141
+ oldData: OrgChart.nodeData,
2142
+ /**
2143
+ * new node data
2144
+ */
2145
+ newData: OrgChart.nodeData
2146
+ }
2147
+
2148
+ interface removeNodeEvemtArgs{
2149
+ /**
2150
+ * node id
2151
+ */
2152
+ id: number | string,
2153
+ /**
2154
+ * 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.
2155
+ */
2156
+ newPidsAndStpidsForIds: {
2157
+ newPidsForIds: { [key in any]: string | number },
2158
+ newStpidsForIds: { [key in any]: string | number }
2159
+ }
2160
+ }
2161
+
2162
+ interface addNodeEvemtArgs{
2163
+ /**
2164
+ * new added data node
2165
+ */
2166
+ data: OrgChart.nodeData
2167
+ }
2168
+
2169
+ interface dragEventArgs{
2170
+ /**
2171
+ * dragged node id
2172
+ */
2173
+ dragId: string | number,
2174
+ event: MouseEvent,
2175
+ /**
2176
+ * array of node ids
2177
+ *
2178
+ * this property is initialized only if movable option is set
2179
+ */
2180
+ nodeIds: Array<string | number>
2181
+ }
2182
+
2183
+ interface dropEventArgs{
2184
+ /**
2185
+ * dragged node id
2186
+ */
2187
+ dragId: string | number,
2188
+ /**
2189
+ * dropped node id
2190
+ */
2191
+ dropId: string | number,
2192
+ /**
2193
+ * draging element
2194
+ */
2195
+ dragNodeElement: HTMLElement,
2196
+ /**
2197
+ * Mouse event
2198
+ */
2199
+ event: MouseEvent
2200
+ }
2201
+
2202
+ interface expandCollapseButtonClickEventArgs{
2203
+ /**
2204
+ * Indicates id the operation is collaps or expand
2205
+ */
2206
+ collapsing: boolean,
2207
+ /**
2208
+ * the id of the clicked node
2209
+ */
2210
+ id: number | string,
2211
+ /**
2212
+ * node ids that will be expanded or collapsed
2213
+ */
2214
+ ids: Array<number | string>
2215
+ }
2216
+
2217
+ interface exportStartEventArgs {
2218
+ options: {
2219
+ childLevels?: number,
2220
+ expandChildren?: boolean,
2221
+ fileName?: string,
2222
+ footer?: string,
2223
+ header?: string,
2224
+ height?: number,
2225
+ width?: number,
2226
+ landscape?: boolean,
2227
+ margin?: Array<number>,
2228
+ min?: boolean,
2229
+ openInNewTab?: boolean,
2230
+ padding?: number,
2231
+ parentLevels?: number,
2232
+ type?: string,
2233
+ pages?: Array<{
2234
+ chartInstance?: OrgChart,
2235
+ childLevels?: number,
2236
+ expandChildren?: boolean,
2237
+ footer?: string,
2238
+ header?: string,
2239
+ margin?: Array<number>,
2240
+ min?: boolean,
2241
+ padding?: number,
2242
+ parentLevels?: number,
2243
+ isProfile?: boolean,
2244
+ nodeId?: number | string,
2245
+ content?: string,
2246
+ height?: number,
2247
+ width?: number,
2248
+ }>
2249
+ },
2250
+ pages?: Array<SVGElement>,
2251
+ styles?: string
2252
+ };
2253
+
2254
+ /**
2255
+ * for PDF/PNG
2256
+ */
2257
+ interface exportEndEventArgs {
2258
+ /**
2259
+ * the array buffer is the exported document, you can save it on a server or send it via email
2260
+ *
2261
+ * this property is initialized only for PDF/PNG exports
2262
+ */
2263
+ ArrayBuffer: ArrayBuffer
2264
+ /**
2265
+ * extension
2266
+ *
2267
+ * this property is initialized only for CSV/XML exports
2268
+ */
2269
+ ext: string,
2270
+ /**
2271
+ * filename, you can change the filename here
2272
+ *
2273
+ * this property is initialized only for CSV/XML exports
2274
+ */
2275
+ filename: string,
2276
+ /**
2277
+ * an array of node objects
2278
+ *
2279
+ * this property is initialized only for CSV/XML exports
2280
+ */
2281
+ nodes: Array<object>,
2282
+ /**
2283
+ * csv ot xml string
2284
+ *
2285
+ * this property is initialized only for CSV/XML/SVG exports
2286
+ */
2287
+ content: string,
2288
+ /**
2289
+ * add extra styles
2290
+ *
2291
+ * this property is initialized only for SVG exports
2292
+ */
2293
+ styles: string,
2294
+ }
2295
+
2296
+ interface nodeClickEventArgs {
2297
+ /**
2298
+ * node JSON object
2299
+ */
2300
+ node: OrgChart.node,
2301
+ /**
2302
+ * the browser event
2303
+ */
2304
+ event: any
2305
+ }
2306
+
2307
+
2308
+ interface canvasClickEventArgs {
2309
+ /**
2310
+ * the browser event
2311
+ */
2312
+ event: any
2313
+ }
2314
+
2315
+
2316
+ interface aiToolCallsEventArgs {
2317
+ toolCalls: Array<{
2318
+ FunctionName : string,
2319
+ FunctionResult : string,
2320
+ FunctionArguments : { [key: string]: any }
2321
+ }>
2322
+ }
2323
+
2324
+
2325
+ interface nodeDoubleClickEventArgs {
2326
+ /**
2327
+ * clicked node data
2328
+ */
2329
+ data: object
2330
+ }
2331
+
2332
+
2302
2333
  /**
2303
2334
  * The node JSON data
2304
2335
  * ```ts
@@ -5993,5 +6024,7 @@ declare namespace OrgChart {
5993
6024
  */
5994
6025
  var t: any;
5995
6026
  }
5996
- export { OrgChart };
5997
- export default OrgChart;
6027
+
6028
+
6029
+
6030
+ export default OrgChart;