@balkangraph/orgchart.js 8.14.80 → 8.14.82
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 +231 -45
- package/orgchart.js +1 -1
- package/package.json +1 -1
package/orgchart.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
declare class OrgChart {
|
|
4
|
+
/**
|
|
5
|
+
* ```typescript
|
|
6
|
+
* let chart = new OrgChart('#tree', {});
|
|
7
|
+
* ```
|
|
8
|
+
* @param element HTML element or string selector for example '#tree'
|
|
9
|
+
* @param options configuration options
|
|
10
|
+
*/
|
|
11
|
+
constructor(element: HTMLElement | string, options?: OrgChart.options);
|
|
12
|
+
|
|
13
|
+
|
|
4
14
|
/**
|
|
5
15
|
* SVG icons
|
|
6
16
|
* @param w - width
|
|
@@ -127,24 +137,16 @@ declare class OrgChart {
|
|
|
127
137
|
*/
|
|
128
138
|
canUpdateLink(id: string | number, pid: string | number): boolean;
|
|
129
139
|
|
|
130
|
-
/**
|
|
131
|
-
* Removes specified node from nodes collection, redraws the chart and fires remove event.
|
|
132
|
-
* ```typescript
|
|
133
|
-
* var chart = new OrgChart('#tree', {});
|
|
134
|
-
* chart.removeNode(2);
|
|
135
|
-
* ```
|
|
136
|
-
* @param id identification number of the node
|
|
137
|
-
* @param callback called at the end of animation
|
|
138
|
-
* @param fireEvent indicates if the remove event will be called or not
|
|
139
|
-
*/
|
|
140
|
-
removeNode(id: string | number, callback?: () => void, fireEvent?: boolean): void;
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
140
|
|
|
146
141
|
/**
|
|
147
142
|
* The on() method of the OrgChart class sets up a function that will be called whenever the specified event is delivered to the target. *
|
|
143
|
+
* ```typescript
|
|
144
|
+
* let chart = new OrgChart('#tree', {});
|
|
145
|
+
* chart.on('init', function () {
|
|
146
|
+
* // console.log("initiated")
|
|
147
|
+
* })
|
|
148
|
+
* chart.load(nodes);
|
|
149
|
+
* ```
|
|
148
150
|
* @category Event Listeners
|
|
149
151
|
* @param type A case-sensitive string representing the event type to listen for.
|
|
150
152
|
* @param listener The object that receives a notification when an event of the specified type occurs. This must be a JavaScript function.
|
|
@@ -153,6 +155,15 @@ declare class OrgChart {
|
|
|
153
155
|
|
|
154
156
|
/**
|
|
155
157
|
* 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.
|
|
158
|
+
* let chart = new OrgChart('#tree', {});
|
|
159
|
+
* let listener = function(sender, args){
|
|
160
|
+
* console.log(sender.removeListener('update', listener));
|
|
161
|
+
* };
|
|
162
|
+
* chart.on('update', listener);
|
|
163
|
+
* chart.load(nodes)
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
family.on('update', listener);
|
|
156
167
|
* @param type A string which specifies the type of event for which to remove an event listener
|
|
157
168
|
* @param listener The event listener function of the event handler to remove from the event target
|
|
158
169
|
*/
|
|
@@ -195,8 +206,6 @@ declare class OrgChart {
|
|
|
195
206
|
onUpdated(): OrgChart;
|
|
196
207
|
|
|
197
208
|
|
|
198
|
-
|
|
199
|
-
|
|
200
209
|
/**
|
|
201
210
|
* Occurs when a node has been removed by removeNode method.
|
|
202
211
|
* ```typescript
|
|
@@ -293,20 +302,41 @@ declare class OrgChart {
|
|
|
293
302
|
event: MouseEvent
|
|
294
303
|
}) => void): OrgChart;
|
|
295
304
|
|
|
296
|
-
|
|
305
|
+
/**
|
|
306
|
+
* All chart nodes
|
|
307
|
+
* ```typescript
|
|
308
|
+
* let chart = new OrgChart('#tree', {});
|
|
309
|
+
* chart.onInit(() => {
|
|
310
|
+
* let nodes = chart.nodes;
|
|
311
|
+
* });
|
|
312
|
+
* chart.load(nodes)
|
|
313
|
+
* ```
|
|
314
|
+
*/
|
|
297
315
|
nodes: { [key in any]: OrgChart.node };
|
|
298
|
-
isVisible: boolean;
|
|
299
|
-
visibleNodeIds: Array<number | string>;
|
|
300
316
|
|
|
301
317
|
/**
|
|
302
|
-
*
|
|
318
|
+
* Returns true if chart is visible
|
|
319
|
+
* ```typescript
|
|
303
320
|
* let chart = new OrgChart('#tree', {});
|
|
321
|
+
* chart.onInit(() => {
|
|
322
|
+
* console.log(chart.isVisible);
|
|
323
|
+
* });
|
|
324
|
+
* chart.load(nodes)
|
|
304
325
|
* ```
|
|
305
|
-
* @param element HTML element or string selector for example '#tree'
|
|
306
|
-
* @param options configuration options
|
|
307
326
|
*/
|
|
308
|
-
|
|
327
|
+
isVisible: boolean;
|
|
309
328
|
|
|
329
|
+
/**
|
|
330
|
+
* Returns the visible nodes ids
|
|
331
|
+
* ```typescript
|
|
332
|
+
* let chart = new OrgChart('#tree', {});
|
|
333
|
+
* chart.onInit(() => {
|
|
334
|
+
* console.log(chart.visibleNodeIds);
|
|
335
|
+
* });
|
|
336
|
+
* chart.load(nodes)
|
|
337
|
+
* ```
|
|
338
|
+
*/
|
|
339
|
+
visibleNodeIds: Array<number | string>;
|
|
310
340
|
|
|
311
341
|
/**
|
|
312
342
|
* Updates the node data
|
|
@@ -344,6 +374,33 @@ declare class OrgChart {
|
|
|
344
374
|
* @param data node data
|
|
345
375
|
*/
|
|
346
376
|
add(data: object): OrgChart;
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Adds new node to the nodes collection, redraws the chart and fires remove event
|
|
380
|
+
* ```typescript
|
|
381
|
+
* let chart = new OrgChart('#tree', {});
|
|
382
|
+
* ...
|
|
383
|
+
* chart.addNode({ id: 1, name: "Denny Curtis", title: "CEO" });
|
|
384
|
+
* ```
|
|
385
|
+
* @param data node data
|
|
386
|
+
* @param callback called at the end of animation
|
|
387
|
+
* @param fireEvent indicates if the add event will be called or not
|
|
388
|
+
*/
|
|
389
|
+
addNode(data: object, callback?: () => void, fireEvent?: boolean): void;
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Removes specified node from nodes collection, redraws the chart and fires remove event.
|
|
393
|
+
* ```typescript
|
|
394
|
+
* var chart = new OrgChart('#tree', {});
|
|
395
|
+
* chart.removeNode(2);
|
|
396
|
+
* ```
|
|
397
|
+
* @param id identification number of the node
|
|
398
|
+
* @param callback called at the end of animation
|
|
399
|
+
* @param fireEvent indicates if the remove event will be called or not
|
|
400
|
+
*/
|
|
401
|
+
removeNode(id: string | number, callback?: () => void, fireEvent?: boolean): void;
|
|
402
|
+
|
|
403
|
+
|
|
347
404
|
/**
|
|
348
405
|
* Gets node data.
|
|
349
406
|
* ```typescript
|
|
@@ -617,18 +674,6 @@ declare class OrgChart {
|
|
|
617
674
|
*/
|
|
618
675
|
getNode(nodeId: string | number): OrgChart.node;
|
|
619
676
|
|
|
620
|
-
/**
|
|
621
|
-
* Adds new node to the nodes collection, redraws the chart and fires remove event
|
|
622
|
-
* ```typescript
|
|
623
|
-
* let chart = new OrgChart('#tree', {});
|
|
624
|
-
* ...
|
|
625
|
-
* chart.addNode({ id: 1, name: "Denny Curtis", title: "CEO" });
|
|
626
|
-
* ```
|
|
627
|
-
* @param data node data
|
|
628
|
-
* @param callback called at the end of animation
|
|
629
|
-
* @param fireEvent indicates if the add event will be called or not
|
|
630
|
-
*/
|
|
631
|
-
addNode(data: object, callback?: () => void, fireEvent?: boolean): void;
|
|
632
677
|
|
|
633
678
|
/**
|
|
634
679
|
* Sets layout.
|
|
@@ -1439,11 +1484,44 @@ declare class OrgChart {
|
|
|
1439
1484
|
* chart.load(nodes)
|
|
1440
1485
|
* ```
|
|
1441
1486
|
*/
|
|
1442
|
-
|
|
1443
1487
|
roots: Array<OrgChart.node>;
|
|
1488
|
+
|
|
1489
|
+
/**
|
|
1490
|
+
* Opens file upload dialog
|
|
1491
|
+
* ```typescript
|
|
1492
|
+
* let chart = new OrgChart('#tree', {});
|
|
1493
|
+
*
|
|
1494
|
+
* chart.editUI.on('element-btn-click', function (sender, args) {
|
|
1495
|
+
* OrgChart.fileUploadDialog(function (file) {
|
|
1496
|
+
* var formData = new FormData();
|
|
1497
|
+
* formData.append('file', file);
|
|
1498
|
+
* alert('upload the file');
|
|
1499
|
+
* })
|
|
1500
|
+
* });
|
|
1501
|
+
*
|
|
1502
|
+
* chart.load(nodes)
|
|
1503
|
+
* ```
|
|
1504
|
+
*/
|
|
1444
1505
|
|
|
1445
1506
|
static fileUploadDialog(callback: (file: any) => void): void;
|
|
1446
1507
|
|
|
1508
|
+
/**
|
|
1509
|
+
* Exports multiple charts or a chart by teams.
|
|
1510
|
+
* ```typescript
|
|
1511
|
+
* let chart1 = new OrgChart('#tree', {});
|
|
1512
|
+
* let chart2 = new OrgChart('#tree', {});
|
|
1513
|
+
* let chart3 = new OrgChart('#tree', {});
|
|
1514
|
+
* let chart4 = new OrgChart('#tree', {});
|
|
1515
|
+
* document.getElementById('btn_export').addEventListener('click', function(){
|
|
1516
|
+
* OrgChart.exportPDFFromCharts([
|
|
1517
|
+
* {chartInstance: chart1, scale: 'fit', format: 'A4', header: 'OrgChart 1' },
|
|
1518
|
+
* {chartInstance: chart2, scale: 'fit', format: 'A4', header: 'OrgChart 2' },
|
|
1519
|
+
* {chartInstance: chart3, scale: 'fit', format: 'A4', header: 'OrgChart 3' },
|
|
1520
|
+
* {chartInstance: chart4, scale: 'fit', format: 'A4', header: 'OrgChart 4' },
|
|
1521
|
+
* ], "test.pdf");
|
|
1522
|
+
* });
|
|
1523
|
+
* ```
|
|
1524
|
+
*/
|
|
1447
1525
|
static exportPDFFromCharts(optionList: Array<{
|
|
1448
1526
|
chartInstance: OrgChart,
|
|
1449
1527
|
margin?: Array<number>,
|
|
@@ -1459,40 +1537,148 @@ declare class OrgChart {
|
|
|
1459
1537
|
nodeId? : number | string
|
|
1460
1538
|
}>, filename?: string, openInNewTab?: boolean, callback?: (arrayBuffer: ArrayBuffer) => void): void;
|
|
1461
1539
|
|
|
1540
|
+
/**
|
|
1541
|
+
* Checks if the screen is mobile
|
|
1542
|
+
* ```typescript
|
|
1543
|
+
* console.log(OrgChart.isMobile());
|
|
1544
|
+
* ```
|
|
1545
|
+
*/
|
|
1462
1546
|
static isMobile(): boolean;
|
|
1463
1547
|
/**
|
|
1464
|
-
* Checks if the used
|
|
1548
|
+
* Checks if the used library is licnsed or not
|
|
1549
|
+
* ```typescript
|
|
1550
|
+
* console.log(OrgChart.isTrial());
|
|
1551
|
+
* ```
|
|
1465
1552
|
*/
|
|
1466
1553
|
static isTrial(): boolean;
|
|
1467
1554
|
/**
|
|
1468
1555
|
* Count all children nodes of the specified id.
|
|
1556
|
+
* ```typescript
|
|
1557
|
+
* let chart = new OrgChart('#tree', {});
|
|
1558
|
+
* chart.onInit(() => {
|
|
1559
|
+
* console.log(OrgChart.childrenCount(chart, chart.getNode(2)))
|
|
1560
|
+
* });
|
|
1561
|
+
* chart.load(nodes)
|
|
1562
|
+
* ```
|
|
1469
1563
|
* @param chart OrgChart instance
|
|
1470
1564
|
* @param node
|
|
1471
1565
|
* @param count
|
|
1472
1566
|
*/
|
|
1473
1567
|
static childrenCount(chart: OrgChart, node: OrgChart.node): number;
|
|
1568
|
+
|
|
1569
|
+
/**
|
|
1570
|
+
* Count the total (to the leafs) children nodes of the specified id.
|
|
1571
|
+
* ```typescript
|
|
1572
|
+
* let chart = new OrgChart('#tree', {});
|
|
1573
|
+
* chart.onInit(() => {
|
|
1574
|
+
* console.log(OrgChart.childrenTotalCount(chart, chart.getNode(2)))
|
|
1575
|
+
* });
|
|
1576
|
+
* chart.load(nodes)
|
|
1577
|
+
* ```
|
|
1578
|
+
* @param chart OrgChart instance
|
|
1579
|
+
* @param node
|
|
1580
|
+
* @param count
|
|
1581
|
+
*/
|
|
1474
1582
|
static childrenTotalCount(chart: OrgChart, node: OrgChart.node): number;
|
|
1583
|
+
|
|
1584
|
+
/**
|
|
1585
|
+
* Count the collapsed children nodes of the specified id.
|
|
1586
|
+
* ```typescript
|
|
1587
|
+
* let chart = new OrgChart('#tree', {});
|
|
1588
|
+
* chart.onInit(() => {
|
|
1589
|
+
* console.log(OrgChart.collapsedChildrenCount(chart, chart.getNode(2)))
|
|
1590
|
+
* });
|
|
1591
|
+
* chart.load(nodes)
|
|
1592
|
+
* ```
|
|
1593
|
+
* @param chart OrgChart instance
|
|
1594
|
+
* @param node
|
|
1595
|
+
* @param count
|
|
1596
|
+
*/
|
|
1475
1597
|
static collapsedChildrenCount(chart: OrgChart, node: OrgChart.node): number;
|
|
1598
|
+
|
|
1599
|
+
/**
|
|
1600
|
+
* Count the total (to the leafs) collapsed children nodes of the specified id.
|
|
1601
|
+
* ```typescript
|
|
1602
|
+
* let chart = new OrgChart('#tree', {});
|
|
1603
|
+
* chart.onInit(() => {
|
|
1604
|
+
* console.log(OrgChart.collapsedChildrenCount(chart, chart.getNode(2)))
|
|
1605
|
+
* });
|
|
1606
|
+
* chart.load(nodes)
|
|
1607
|
+
* ```
|
|
1608
|
+
* @param chart OrgChart instance
|
|
1609
|
+
* @param node
|
|
1610
|
+
* @param count
|
|
1611
|
+
*/
|
|
1476
1612
|
static collapsedChildrenTotalCount(chart: OrgChart, node: OrgChart.node): number;
|
|
1613
|
+
|
|
1614
|
+
/**
|
|
1615
|
+
* Get the root node of the specified id.
|
|
1616
|
+
* ```typescript
|
|
1617
|
+
* let chart = new OrgChart('#tree', {});
|
|
1618
|
+
* chart.onInit(() => {
|
|
1619
|
+
* let root = OrgChart.getRootOf(chart.getNode(4));
|
|
1620
|
+
* });
|
|
1621
|
+
* chart.load(nodes)
|
|
1622
|
+
* ```
|
|
1623
|
+
* @param node
|
|
1624
|
+
*/
|
|
1477
1625
|
static getRootOf(node: OrgChart.node): OrgChart.node;
|
|
1478
1626
|
|
|
1479
1627
|
/**
|
|
1480
1628
|
* is null, empty or undefined
|
|
1629
|
+
* ```typescript
|
|
1630
|
+
* console.log(OrgChart.isNEU(any_prmeter))
|
|
1631
|
+
* ```
|
|
1481
1632
|
* @param val
|
|
1482
1633
|
*/
|
|
1483
1634
|
static isNEU(val: any): boolean;
|
|
1635
|
+
|
|
1636
|
+
/**
|
|
1637
|
+
* Defines gradient circle form array of colors
|
|
1638
|
+
* ```typescript
|
|
1639
|
+
* OrgChart.templates.myTemplate.defs = OrgChart.gradientCircleForDefs('circle', ['#FF0000', '#FFD800'], 60, 10);
|
|
1640
|
+
* ```
|
|
1641
|
+
* @param id - id of the element
|
|
1642
|
+
* @param colors - array of colors
|
|
1643
|
+
* @param r - radius
|
|
1644
|
+
* @param strokeWidth - stroke width
|
|
1645
|
+
*/
|
|
1484
1646
|
static gradientCircleForDefs(id: string | number, colors: Array<string> | string, r: number, strokeWidth: number): string;
|
|
1647
|
+
|
|
1648
|
+
/**
|
|
1649
|
+
* Convert CSV to nodes
|
|
1650
|
+
* ```typescript
|
|
1651
|
+
* let chart = new OrgChart('#tree', {});
|
|
1652
|
+
* fetch('https://balkan.app/content/data.csv')
|
|
1653
|
+
* .then(response => response.text())
|
|
1654
|
+
* .then(text => {
|
|
1655
|
+
* var nodes = OrgChart.convertCsvToNodes(text);
|
|
1656
|
+
* chart.load(nodes);
|
|
1657
|
+
* });
|
|
1658
|
+
* ```
|
|
1659
|
+
* @param text
|
|
1660
|
+
*/
|
|
1485
1661
|
static convertCsvToNodes(text: string) : Array<Object>;
|
|
1662
|
+
|
|
1486
1663
|
/**
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
* @param commands The SVG input path or commands array
|
|
1490
|
-
* @param radius
|
|
1491
|
-
* @param useFractionalRadius The amount to round the corners, either a value in the SVG coordinate space, or, if useFractionalRadius is true, a value from 0 to 1.
|
|
1492
|
-
* @returns A new SVG path string with the rounding
|
|
1493
|
-
*/
|
|
1664
|
+
* @ignore
|
|
1665
|
+
*/
|
|
1494
1666
|
static roundPathCorners(commands: string | Array<Array<any>>, radius: number, useFractionalRadius: boolean) : string;
|
|
1667
|
+
|
|
1668
|
+
/**
|
|
1669
|
+
* @ignore
|
|
1670
|
+
*/
|
|
1495
1671
|
static convertNodesToCsv(nodes: Array<Object>) : string;
|
|
1672
|
+
|
|
1673
|
+
/**
|
|
1674
|
+
* Replace a text in a field
|
|
1675
|
+
* let chart = new OrgChart('#tree', {});
|
|
1676
|
+
* chart.onField(function (args) {
|
|
1677
|
+
* var val = OrgChart.wrapText(args.value, OrgChart.templates.ana.field_1)
|
|
1678
|
+
* args.value = val;
|
|
1679
|
+
* });
|
|
1680
|
+
* chart.load(nodes);
|
|
1681
|
+
*/
|
|
1496
1682
|
static wrapText(text: string, field: Object): string;
|
|
1497
1683
|
|
|
1498
1684
|
static filterUI: {
|