balkan-orgchart-js-community 9.1.76 → 9.1.77
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 +424 -414
- package/orgchart.d.ts +424 -414
- package/orgchart.js +1 -1
- package/orgchart.mjs +1 -1
- package/package.json +1 -1
package/orgchart.d.mts
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
* </html>
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
|
-
declare class OrgChart {
|
|
36
|
+
declare class OrgChart extends OrgChartEventListeners {
|
|
37
37
|
/**
|
|
38
38
|
* ```typescript
|
|
39
39
|
* let chart = new OrgChart('#tree', {});
|
|
@@ -266,23 +266,7 @@ declare class OrgChart {
|
|
|
266
266
|
* @param pid parent id
|
|
267
267
|
*/
|
|
268
268
|
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
|
-
|
|
269
|
+
|
|
286
270
|
/**
|
|
287
271
|
* 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
272
|
* ```typescript
|
|
@@ -302,138 +286,6 @@ declare class OrgChart {
|
|
|
302
286
|
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
287
|
|
|
304
288
|
|
|
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
|
-
* });
|
|
414
|
-
* ```
|
|
415
|
-
* @category Event Listeners
|
|
416
|
-
* @param listener
|
|
417
|
-
*/
|
|
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;
|
|
436
|
-
|
|
437
289
|
/**
|
|
438
290
|
* All chart nodes
|
|
439
291
|
* ```typescript
|
|
@@ -1237,281 +1089,40 @@ declare class OrgChart {
|
|
|
1237
1089
|
|
|
1238
1090
|
|
|
1239
1091
|
/**
|
|
1240
|
-
*
|
|
1241
|
-
* ```typescript
|
|
1092
|
+
* The tree div element.
|
|
1093
|
+
* ```typescript
|
|
1242
1094
|
* let chart = new OrgChart('#tree', {});
|
|
1243
|
-
* chart.
|
|
1244
|
-
* });
|
|
1245
|
-
* chart.load(nodes);
|
|
1095
|
+
* let element = chart.element;
|
|
1246
1096
|
* ```
|
|
1247
|
-
* @category Event Listeners
|
|
1248
|
-
* @param listener
|
|
1249
1097
|
*/
|
|
1250
|
-
|
|
1251
|
-
|
|
1098
|
+
element: HTMLElement;
|
|
1099
|
+
|
|
1252
1100
|
/**
|
|
1253
|
-
* The
|
|
1254
|
-
*
|
|
1101
|
+
* The tree div element.
|
|
1102
|
+
* ```typescript
|
|
1255
1103
|
* let chart = new OrgChart('#tree', {});
|
|
1256
|
-
* chart.
|
|
1257
|
-
* });
|
|
1258
|
-
* chart.load(nodes);
|
|
1104
|
+
* let mainElement = chart.mainElement;
|
|
1259
1105
|
* ```
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1106
|
+
*/
|
|
1107
|
+
mainElement: HTMLElement;
|
|
1108
|
+
|
|
1109
|
+
get leftElement(): HTMLElement;
|
|
1110
|
+
|
|
1264
1111
|
|
|
1265
1112
|
/**
|
|
1266
|
-
* The
|
|
1267
|
-
* ```typescript
|
|
1113
|
+
* The chart editUI object.
|
|
1114
|
+
* ```typescript
|
|
1268
1115
|
* let chart = new OrgChart('#tree', {});
|
|
1269
|
-
* chart.
|
|
1270
|
-
* //return false; to cancel the operation
|
|
1271
|
-
* });
|
|
1272
|
-
* chart.load(nodes);
|
|
1116
|
+
* let editUI = chart.editUI;
|
|
1273
1117
|
* ```
|
|
1274
|
-
|
|
1275
|
-
|
|
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;
|
|
1118
|
+
*/
|
|
1119
|
+
editUI: OrgChart.editUI;
|
|
1291
1120
|
|
|
1292
1121
|
/**
|
|
1293
|
-
*
|
|
1294
|
-
*
|
|
1122
|
+
* The chart aiUI object.
|
|
1123
|
+
* ```typescript
|
|
1295
1124
|
* let chart = new OrgChart('#tree', {});
|
|
1296
|
-
* chart.
|
|
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);
|
|
1428
|
-
* ```
|
|
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;
|
|
1438
|
-
|
|
1439
|
-
/**
|
|
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
|
-
* });
|
|
1449
|
-
* ```
|
|
1450
|
-
* [Go to AI doc page for more details](https://balkan.app/OrgChartJS/Docs/AI)
|
|
1451
|
-
* @param listener
|
|
1452
|
-
*/
|
|
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
|
-
|
|
1461
|
-
/**
|
|
1462
|
-
* On node double click event listener.
|
|
1463
|
-
* ```typescript
|
|
1464
|
-
* let chart = new OrgChart('#tree', {});
|
|
1465
|
-
* chart.onNodeDoubleClick(() => {
|
|
1466
|
-
* //return false; to cancel the operation
|
|
1467
|
-
* });
|
|
1468
|
-
* chart.load(nodes);
|
|
1469
|
-
* ```
|
|
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;
|
|
1479
|
-
|
|
1480
|
-
/**
|
|
1481
|
-
* The tree div element.
|
|
1482
|
-
* ```typescript
|
|
1483
|
-
* let chart = new OrgChart('#tree', {});
|
|
1484
|
-
* let element = chart.element;
|
|
1485
|
-
* ```
|
|
1486
|
-
*/
|
|
1487
|
-
element: HTMLElement;
|
|
1488
|
-
|
|
1489
|
-
/**
|
|
1490
|
-
* The tree div element.
|
|
1491
|
-
* ```typescript
|
|
1492
|
-
* let chart = new OrgChart('#tree', {});
|
|
1493
|
-
* let mainElement = chart.mainElement;
|
|
1494
|
-
* ```
|
|
1495
|
-
*/
|
|
1496
|
-
mainElement: HTMLElement;
|
|
1497
|
-
|
|
1498
|
-
get leftElement(): HTMLElement;
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
/**
|
|
1502
|
-
* The chart editUI object.
|
|
1503
|
-
* ```typescript
|
|
1504
|
-
* let chart = new OrgChart('#tree', {});
|
|
1505
|
-
* let editUI = chart.editUI;
|
|
1506
|
-
* ```
|
|
1507
|
-
*/
|
|
1508
|
-
editUI: OrgChart.editUI;
|
|
1509
|
-
|
|
1510
|
-
/**
|
|
1511
|
-
* The chart aiUI object.
|
|
1512
|
-
* ```typescript
|
|
1513
|
-
* let chart = new OrgChart('#tree', {});
|
|
1514
|
-
* let aiUI = chart.aiUI;
|
|
1125
|
+
* let aiUI = chart.aiUI;
|
|
1515
1126
|
* ```
|
|
1516
1127
|
*/
|
|
1517
1128
|
aiUI: OrgChart.aiUI;
|
|
@@ -5993,5 +5604,404 @@ declare namespace OrgChart {
|
|
|
5993
5604
|
*/
|
|
5994
5605
|
var t: any;
|
|
5995
5606
|
}
|
|
5996
|
-
|
|
5997
|
-
|
|
5607
|
+
|
|
5608
|
+
|
|
5609
|
+
declare class OrgChartEventListeners {
|
|
5610
|
+
|
|
5611
|
+
|
|
5612
|
+
/**
|
|
5613
|
+
* The on() method of the OrgChart class sets up a function that will be called whenever the specified event is delivered to the target. *
|
|
5614
|
+
* ```typescript
|
|
5615
|
+
* let chart = new OrgChart('#tree', {});
|
|
5616
|
+
* chart.on('init', function () {
|
|
5617
|
+
* // console.log("initiated")
|
|
5618
|
+
* })
|
|
5619
|
+
* chart.load(nodes);
|
|
5620
|
+
* ```
|
|
5621
|
+
* @category Event Listeners
|
|
5622
|
+
* @param type A case-sensitive string representing the event type to listen for.
|
|
5623
|
+
* @param listener The object that receives a notification when an event of the specified type occurs. This must be a JavaScript function.
|
|
5624
|
+
*/
|
|
5625
|
+
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;
|
|
5626
|
+
|
|
5627
|
+
|
|
5628
|
+
|
|
5629
|
+
/**
|
|
5630
|
+
* Occurs when the node data has been updated by updateNode method.
|
|
5631
|
+
* ```typescript
|
|
5632
|
+
* var chart = new OrgChart('#tree', {});
|
|
5633
|
+
* chart.onUpdateNode((args) => {
|
|
5634
|
+
* //return false; to cancel the operation
|
|
5635
|
+
* });
|
|
5636
|
+
* ```
|
|
5637
|
+
* @category Event Listeners
|
|
5638
|
+
* @param listener
|
|
5639
|
+
*/
|
|
5640
|
+
onUpdateNode(listener: (args: {
|
|
5641
|
+
/**
|
|
5642
|
+
* old node data
|
|
5643
|
+
*/
|
|
5644
|
+
oldData: OrgChart.nodeData,
|
|
5645
|
+
/**
|
|
5646
|
+
* new node data
|
|
5647
|
+
*/
|
|
5648
|
+
newData: OrgChart.nodeData
|
|
5649
|
+
}) => void): OrgChart;
|
|
5650
|
+
|
|
5651
|
+
/**
|
|
5652
|
+
* 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.
|
|
5653
|
+
* Use this event listener to synch your server side database with this.config.nodes, this.config.clinks, this.config.slinks etc.
|
|
5654
|
+
* ```typescript
|
|
5655
|
+
* var chart = new OrgChart('#tree', {});
|
|
5656
|
+
* chart.onUpdated(() => {
|
|
5657
|
+
* //Update your server database with this.config.nodes, this.config.clinks, this.config.slinks etc.
|
|
5658
|
+
* });
|
|
5659
|
+
* ```
|
|
5660
|
+
* @category Event Listeners
|
|
5661
|
+
*/
|
|
5662
|
+
onUpdated(): OrgChart;
|
|
5663
|
+
|
|
5664
|
+
|
|
5665
|
+
/**
|
|
5666
|
+
* Occurs when a node has been removed by removeNode method.
|
|
5667
|
+
* ```typescript
|
|
5668
|
+
* var chart = new OrgChart('#tree', {});
|
|
5669
|
+
* chart.onRemoveNode((args) => {
|
|
5670
|
+
* //return false; to cancel the operation
|
|
5671
|
+
* });
|
|
5672
|
+
* ```
|
|
5673
|
+
* @category Event Listeners
|
|
5674
|
+
* @param listener
|
|
5675
|
+
*/
|
|
5676
|
+
onRemoveNode(listener: (args: {
|
|
5677
|
+
/**
|
|
5678
|
+
* node id
|
|
5679
|
+
*/
|
|
5680
|
+
id: number | string,
|
|
5681
|
+
/**
|
|
5682
|
+
* 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.
|
|
5683
|
+
*/
|
|
5684
|
+
newPidsAndStpidsForIds: {
|
|
5685
|
+
newPidsForIds: { [key in any]: string | number },
|
|
5686
|
+
newStpidsForIds: { [key in any]: string | number }
|
|
5687
|
+
}
|
|
5688
|
+
}) => void): OrgChart;
|
|
5689
|
+
|
|
5690
|
+
/**
|
|
5691
|
+
* Occurs when a node has been added by addNode method.
|
|
5692
|
+
* ```typescript
|
|
5693
|
+
* var chart = new OrgChart('#tree', {});
|
|
5694
|
+
* chart.onAddNode((args) => {
|
|
5695
|
+
* //return false; to cancel the operation
|
|
5696
|
+
* });
|
|
5697
|
+
* ```
|
|
5698
|
+
* @category Event Listeners
|
|
5699
|
+
* @param listener
|
|
5700
|
+
*/
|
|
5701
|
+
onAddNode(listener: (args: {
|
|
5702
|
+
/**
|
|
5703
|
+
* new added data node
|
|
5704
|
+
*/
|
|
5705
|
+
data: OrgChart.nodeData
|
|
5706
|
+
}) => void): OrgChart;
|
|
5707
|
+
/**
|
|
5708
|
+
* The onDrag event occurs when a node is dragged. *enableDragDrop* option has to be turned on.
|
|
5709
|
+
* ```typescript
|
|
5710
|
+
* var chart = new OrgChart('#tree', {});
|
|
5711
|
+
* chart.onDrag(() => {
|
|
5712
|
+
* //return false; to cancel the operation
|
|
5713
|
+
* });
|
|
5714
|
+
* ```
|
|
5715
|
+
* @category Event Listeners
|
|
5716
|
+
* @param listener
|
|
5717
|
+
*/
|
|
5718
|
+
onDrag(listener: (args: {
|
|
5719
|
+
/**
|
|
5720
|
+
* dragged node id
|
|
5721
|
+
*/
|
|
5722
|
+
dragId: string | number,
|
|
5723
|
+
event: MouseEvent,
|
|
5724
|
+
/**
|
|
5725
|
+
* array of node ids
|
|
5726
|
+
*
|
|
5727
|
+
* this property is initialized only if movable option is set
|
|
5728
|
+
*/
|
|
5729
|
+
nodeIds: Array<string | number>
|
|
5730
|
+
}) => void): OrgChart;
|
|
5731
|
+
/**
|
|
5732
|
+
* The onDrop event occurs when a node is dropped. *enableDragDrop* option has to be turned on.
|
|
5733
|
+
* ```typescript
|
|
5734
|
+
* var chart = new OrgChart('#tree', {});
|
|
5735
|
+
* chart.onDrop(() => {
|
|
5736
|
+
* //return false; to cancel the operation
|
|
5737
|
+
* });
|
|
5738
|
+
* ```
|
|
5739
|
+
* @category Event Listeners
|
|
5740
|
+
* @param listener
|
|
5741
|
+
*/
|
|
5742
|
+
onDrop(listener: (args: {
|
|
5743
|
+
/**
|
|
5744
|
+
* dragged node id
|
|
5745
|
+
*/
|
|
5746
|
+
dragId: string | number,
|
|
5747
|
+
/**
|
|
5748
|
+
* dropped node id
|
|
5749
|
+
*/
|
|
5750
|
+
dropId: string | number,
|
|
5751
|
+
/**
|
|
5752
|
+
* draging element
|
|
5753
|
+
*/
|
|
5754
|
+
dragNodeElement: HTMLElement,
|
|
5755
|
+
/**
|
|
5756
|
+
* Mouse event
|
|
5757
|
+
*/
|
|
5758
|
+
event: MouseEvent
|
|
5759
|
+
}) => void): OrgChart;
|
|
5760
|
+
|
|
5761
|
+
|
|
5762
|
+
|
|
5763
|
+
/**
|
|
5764
|
+
* Occurs when the nodes in OrgChart has been created and loaded to the DOM.
|
|
5765
|
+
* ```typescript
|
|
5766
|
+
* let chart = new OrgChart('#tree', {});
|
|
5767
|
+
* chart.onInit(() => {
|
|
5768
|
+
* });
|
|
5769
|
+
* chart.load(nodes);
|
|
5770
|
+
* ```
|
|
5771
|
+
* @category Event Listeners
|
|
5772
|
+
* @param listener
|
|
5773
|
+
*/
|
|
5774
|
+
onInit(listener: (this: OrgChart) => void): OrgChart;
|
|
5775
|
+
|
|
5776
|
+
/**
|
|
5777
|
+
* The onRedraw event occurs when the chart is redrawed.
|
|
5778
|
+
* ```typescript
|
|
5779
|
+
* let chart = new OrgChart('#tree', {});
|
|
5780
|
+
* chart.onRedraw(() => {
|
|
5781
|
+
* });
|
|
5782
|
+
* chart.load(nodes);
|
|
5783
|
+
* ```
|
|
5784
|
+
* @category Event Listeners
|
|
5785
|
+
* @param listener
|
|
5786
|
+
*/
|
|
5787
|
+
onRedraw(listener: (this: OrgChart) => void): OrgChart;
|
|
5788
|
+
|
|
5789
|
+
/**
|
|
5790
|
+
* The onExpandCollapseButtonClick event occurs when the chart is redrawed.
|
|
5791
|
+
* ```typescript
|
|
5792
|
+
* let chart = new OrgChart('#tree', {});
|
|
5793
|
+
* chart.onExpandCollapseButtonClick(() => {
|
|
5794
|
+
* //return false; to cancel the operation
|
|
5795
|
+
* });
|
|
5796
|
+
* chart.load(nodes);
|
|
5797
|
+
* ```
|
|
5798
|
+
* @category Event Listeners
|
|
5799
|
+
* @param listener
|
|
5800
|
+
*/
|
|
5801
|
+
onExpandCollapseButtonClick(listener: (this: OrgChart, args: {
|
|
5802
|
+
/**
|
|
5803
|
+
* Indicates id the operation is collaps or expand
|
|
5804
|
+
*/
|
|
5805
|
+
collapsing: boolean,
|
|
5806
|
+
/**
|
|
5807
|
+
* the id of the clicked node
|
|
5808
|
+
*/
|
|
5809
|
+
id: number | string,
|
|
5810
|
+
/**
|
|
5811
|
+
* node ids that will be expanded or collapsed
|
|
5812
|
+
*/
|
|
5813
|
+
ids: Array<number | string>
|
|
5814
|
+
}) => void): OrgChart;
|
|
5815
|
+
|
|
5816
|
+
/**
|
|
5817
|
+
* 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.
|
|
5818
|
+
* ```typescript
|
|
5819
|
+
* let chart = new OrgChart('#tree', {});
|
|
5820
|
+
* chart.onExportStart(() => {
|
|
5821
|
+
* args.styles += '<link href="[link to my styles]" rel="stylesheet">';
|
|
5822
|
+
* //return false; to cancel the operation
|
|
5823
|
+
* });
|
|
5824
|
+
* chart.load(nodes);
|
|
5825
|
+
* ```
|
|
5826
|
+
* @category Event Listeners
|
|
5827
|
+
* @param listener
|
|
5828
|
+
*/
|
|
5829
|
+
onExportStart(listener: (this: OrgChart, args: {
|
|
5830
|
+
options: {
|
|
5831
|
+
childLevels?: number,
|
|
5832
|
+
expandChildren?: boolean,
|
|
5833
|
+
fileName?: string,
|
|
5834
|
+
footer?: string,
|
|
5835
|
+
header?: string,
|
|
5836
|
+
height?: number,
|
|
5837
|
+
width?: number,
|
|
5838
|
+
landscape?: boolean,
|
|
5839
|
+
margin?: Array<number>,
|
|
5840
|
+
min?: boolean,
|
|
5841
|
+
openInNewTab?: boolean,
|
|
5842
|
+
padding?: number,
|
|
5843
|
+
parentLevels?: number,
|
|
5844
|
+
type?: string,
|
|
5845
|
+
pages?: Array<{
|
|
5846
|
+
chartInstance?: OrgChart,
|
|
5847
|
+
childLevels?: number,
|
|
5848
|
+
expandChildren?: boolean,
|
|
5849
|
+
footer?: string,
|
|
5850
|
+
header?: string,
|
|
5851
|
+
margin?: Array<number>,
|
|
5852
|
+
min?: boolean,
|
|
5853
|
+
padding?: number,
|
|
5854
|
+
parentLevels?: number,
|
|
5855
|
+
isProfile?: boolean,
|
|
5856
|
+
nodeId?: number | string,
|
|
5857
|
+
content?: string,
|
|
5858
|
+
height?: number,
|
|
5859
|
+
width?: number,
|
|
5860
|
+
}>
|
|
5861
|
+
},
|
|
5862
|
+
pages?: Array<SVGElement>,
|
|
5863
|
+
styles?: string
|
|
5864
|
+
}) => void): OrgChart;
|
|
5865
|
+
|
|
5866
|
+
/**
|
|
5867
|
+
* 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.
|
|
5868
|
+
* ```typescript
|
|
5869
|
+
* let chart = new OrgChart('#tree', {});
|
|
5870
|
+
* chart.onExportEnd(() => {
|
|
5871
|
+
* //return false; to cancel the operation for example id you prefer the exported document to not download
|
|
5872
|
+
* });
|
|
5873
|
+
* chart.load(nodes);
|
|
5874
|
+
* ```
|
|
5875
|
+
* @category Event Listeners
|
|
5876
|
+
* @param listener
|
|
5877
|
+
*/
|
|
5878
|
+
onExportEnd(listener: (this: OrgChart, args:
|
|
5879
|
+
/**
|
|
5880
|
+
* for PDF/PNG
|
|
5881
|
+
*/
|
|
5882
|
+
{
|
|
5883
|
+
/**
|
|
5884
|
+
* the array buffer is the exported document, you can save it on a server or send it via email
|
|
5885
|
+
*
|
|
5886
|
+
* this property is initialized only for PDF/PNG exports
|
|
5887
|
+
*/
|
|
5888
|
+
ArrayBuffer: ArrayBuffer
|
|
5889
|
+
/**
|
|
5890
|
+
* extension
|
|
5891
|
+
*
|
|
5892
|
+
* this property is initialized only for CSV/XML exports
|
|
5893
|
+
*/
|
|
5894
|
+
ext: string,
|
|
5895
|
+
/**
|
|
5896
|
+
* filename, you can change the filename here
|
|
5897
|
+
*
|
|
5898
|
+
* this property is initialized only for CSV/XML exports
|
|
5899
|
+
*/
|
|
5900
|
+
filename: string,
|
|
5901
|
+
/**
|
|
5902
|
+
* an array of node objects
|
|
5903
|
+
*
|
|
5904
|
+
* this property is initialized only for CSV/XML exports
|
|
5905
|
+
*/
|
|
5906
|
+
nodes: Array<object>,
|
|
5907
|
+
/**
|
|
5908
|
+
* csv ot xml string
|
|
5909
|
+
*
|
|
5910
|
+
* this property is initialized only for CSV/XML/SVG exports
|
|
5911
|
+
*/
|
|
5912
|
+
content: string,
|
|
5913
|
+
/**
|
|
5914
|
+
* add extra styles
|
|
5915
|
+
*
|
|
5916
|
+
* this property is initialized only for SVG exports
|
|
5917
|
+
*/
|
|
5918
|
+
styles: string,
|
|
5919
|
+
}) => void): OrgChart;
|
|
5920
|
+
|
|
5921
|
+
/**
|
|
5922
|
+
* On node click event listener.
|
|
5923
|
+
* ```typescript
|
|
5924
|
+
* let chart = new OrgChart('#tree', {});
|
|
5925
|
+
* chart.onNodeClick(() => {
|
|
5926
|
+
* //return false; to cancel the operation
|
|
5927
|
+
* });
|
|
5928
|
+
* chart.load(nodes);
|
|
5929
|
+
* ```
|
|
5930
|
+
* @category Event Listeners
|
|
5931
|
+
* @param listener
|
|
5932
|
+
*/
|
|
5933
|
+
onNodeClick(listener: (this: OrgChart, args: {
|
|
5934
|
+
/**
|
|
5935
|
+
* node JSON object
|
|
5936
|
+
*/
|
|
5937
|
+
node: OrgChart.node,
|
|
5938
|
+
/**
|
|
5939
|
+
* the browser event
|
|
5940
|
+
*/
|
|
5941
|
+
event: any
|
|
5942
|
+
}) => void): OrgChart;
|
|
5943
|
+
|
|
5944
|
+
|
|
5945
|
+
/**
|
|
5946
|
+
* On canvas SVG click event listener.
|
|
5947
|
+
* ```typescript
|
|
5948
|
+
* let chart = new OrgChart('#tree', {});
|
|
5949
|
+
* chart.onCanvasClick(() => {
|
|
5950
|
+
* });
|
|
5951
|
+
* chart.load(nodes);
|
|
5952
|
+
* ```
|
|
5953
|
+
* @category Event Listeners
|
|
5954
|
+
* @param listener
|
|
5955
|
+
*/
|
|
5956
|
+
onCanvasClick(listener: (this: OrgChart, args: {
|
|
5957
|
+
/**
|
|
5958
|
+
* the browser event
|
|
5959
|
+
*/
|
|
5960
|
+
event: any
|
|
5961
|
+
}) => void): OrgChart;
|
|
5962
|
+
|
|
5963
|
+
/**
|
|
5964
|
+
* In onAIToolCalls we parse the AI responce to our functions
|
|
5965
|
+
* ```typescript
|
|
5966
|
+
* chart.onAIToolCalls(function(args){
|
|
5967
|
+
* for(var toolCall of args.toolCalls){
|
|
5968
|
+
* if (toolCall.FunctionName == 'sendEmail'){
|
|
5969
|
+
* toolCall.FunctionResult = sendEmail(toolCall.FunctionArguments);
|
|
5970
|
+
* }
|
|
5971
|
+
* }
|
|
5972
|
+
* });
|
|
5973
|
+
* ```
|
|
5974
|
+
* [Go to AI doc page for more details](https://balkan.app/OrgChartJS/Docs/AI)
|
|
5975
|
+
* @param listener
|
|
5976
|
+
*/
|
|
5977
|
+
onAIToolCalls(listener: (this: OrgChart, args: {
|
|
5978
|
+
toolCalls: Array<{
|
|
5979
|
+
FunctionName : string,
|
|
5980
|
+
FunctionResult : string,
|
|
5981
|
+
FunctionArguments : { [key: string]: any }
|
|
5982
|
+
}>
|
|
5983
|
+
}) => void): OrgChart;
|
|
5984
|
+
|
|
5985
|
+
/**
|
|
5986
|
+
* On node double click event listener.
|
|
5987
|
+
* ```typescript
|
|
5988
|
+
* let chart = new OrgChart('#tree', {});
|
|
5989
|
+
* chart.onNodeDoubleClick(() => {
|
|
5990
|
+
* //return false; to cancel the operation
|
|
5991
|
+
* });
|
|
5992
|
+
* chart.load(nodes);
|
|
5993
|
+
* ```
|
|
5994
|
+
* @category Event Listeners
|
|
5995
|
+
* @param listener
|
|
5996
|
+
*/
|
|
5997
|
+
onNodeDoubleClick(listener: (this: OrgChart, args: {
|
|
5998
|
+
/**
|
|
5999
|
+
* clicked node data
|
|
6000
|
+
*/
|
|
6001
|
+
data: object
|
|
6002
|
+
}) => void): OrgChart;
|
|
6003
|
+
}
|
|
6004
|
+
|
|
6005
|
+
|
|
6006
|
+
export { OrgChart, OrgChartEventListeners };
|
|
6007
|
+
export default OrgChart;
|