@ruc-lib/org-chart 2.0.0

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.
@@ -0,0 +1,41 @@
1
+ import { TreeNode } from 'primeng/api';
2
+ export interface CustomTreeNode extends TreeNode {
3
+ customNodeStyle?: {
4
+ [key: string]: string | number;
5
+ };
6
+ originalStyle?: {
7
+ [key: string]: string | number;
8
+ };
9
+ description?: string;
10
+ }
11
+ export interface CustomNodeStyle {
12
+ backgroundColor?: string;
13
+ color?: string;
14
+ padding?: string;
15
+ borderRadius?: string;
16
+ }
17
+ export interface OrgDataItem {
18
+ label?: string;
19
+ expanded?: boolean;
20
+ description?: string;
21
+ customNodeStyle?: CustomNodeStyle;
22
+ type?: string;
23
+ data?: {
24
+ image?: string;
25
+ name?: string;
26
+ title: string;
27
+ };
28
+ children?: OrgDataItem[];
29
+ originalStyle?: CustomNodeStyle;
30
+ }
31
+ export interface OrgData {
32
+ isDisplayHambergerMenu?: boolean;
33
+ isDisplaySearchBar?: boolean;
34
+ nodeTemplate: string;
35
+ hambergerMenuList: {
36
+ label: string;
37
+ id: number;
38
+ }[];
39
+ greyNodeStyle: CustomNodeStyle;
40
+ orgData: OrgDataItem[];
41
+ }
@@ -0,0 +1,64 @@
1
+ import { OnInit } from '@angular/core';
2
+ import { CustomTreeNode, OrgData, OrgDataItem } from '../../interfaces/org-chart';
3
+ import { TreeNode } from 'primeng/api';
4
+ import { OrganizationChart } from 'primeng/organizationchart';
5
+ import * as i0 from "@angular/core";
6
+ /** Displays an organizational chart with nodes and relationships (Org Chart Component) */
7
+ export declare class OrgChartComponent implements OnInit {
8
+ rucInputData: OrgData;
9
+ customTheme: string | undefined;
10
+ selectedNodes: CustomTreeNode[];
11
+ searchText: string;
12
+ hoveredNode: CustomTreeNode | null;
13
+ orgChart: OrganizationChart;
14
+ /** Initializes the component */
15
+ ngOnInit(): void;
16
+ /** add default property for grey nodes if user does not provided */
17
+ addDefaultKeysIfNotAvailable(orgData: OrgData): OrgData;
18
+ /** manipulate input json as If customNodeStyle exists, create originalStyle for node and its children */
19
+ updateRucInputData(data: OrgDataItem[]): OrgDataItem[];
20
+ /** Expands all nodes in the org chart */
21
+ expandAllNodes(): void;
22
+ /** Recursively expands all nodes in the given array
23
+ * @param nodes Nodes to expand @returns Expanded nodes */
24
+ expandNodes(nodes: OrgDataItem[]): OrgDataItem[];
25
+ /** Collapses all nodes in the org chart */
26
+ collapseAllNodes(): void;
27
+ /** Recursively collapses all nodes in the given array
28
+ * @param nodes Nodes to collapse @returns Collapsed nodes */
29
+ collapseNodes(nodes: OrgDataItem[]): OrgDataItem[];
30
+ /** Gets the background color of a node based on search text
31
+ @param node Node to check @returns Whether the node matches the search text */
32
+ getBackgroungColorOfNode(node: CustomTreeNode): boolean;
33
+ /** Handles node hover event @param node Hovered node */
34
+ onNodeHover(node: CustomTreeNode): void;
35
+ /** Handles node leave event */
36
+ onNodeLeave(): void;
37
+ /** Updates node styles based on the hovered node */
38
+ updateNodeStyles(): void;
39
+ /** Resets node styles to their original state */
40
+ resetNodeStyles(): void;
41
+ /** Applies grey node style to non-matching nodes @param nodes Nodes to apply styles to */
42
+ applyGreyNodes(nodes: OrgDataItem[]): void;
43
+ /** Applies styles to nodes based on the hovered node
44
+ * @param nodes Nodes to apply styles @param isHovered Whether the node is hovered */
45
+ applyStyles(nodes: OrgDataItem[], isHovered: boolean): void;
46
+ /** Use the downloadChart utility method */
47
+ downloadChart(format: 'png' | 'jpeg' | 'pdf'): void;
48
+ /** Handles menu click event @param id Menu item ID */
49
+ onMenuClick(id: number, event: MouseEvent): void;
50
+ /** Gets tooltip data for a node @param node Node to get tooltip data */
51
+ getTooltipData(node: CustomTreeNode): string | undefined;
52
+ /** Checks if a node is a parent of another node.
53
+ * @param currentNode The current node to check.
54
+ * @param hoveredNode The node to check for parentage.
55
+ * @returns Whether the current node is a parent of the hovered node. */
56
+ isParent(currentNode: TreeNode, hoveredNode: TreeNode | null): boolean | null | undefined;
57
+ /** Checks if a node is a child of another node.
58
+ * @param node The node to check for child status
59
+ * @param target The node to check for parentage.
60
+ * @returns Whether the node is a child of the target node.*/
61
+ isChild(node: TreeNode, target: TreeNode | null): boolean | null | undefined;
62
+ static ɵfac: i0.ɵɵFactoryDeclaration<OrgChartComponent, never>;
63
+ static ɵcmp: i0.ɵɵComponentDeclaration<OrgChartComponent, "uxp-org-chart", never, { "rucInputData": "rucInputData"; "customTheme": "customTheme"; }, {}, never, never, false, never>;
64
+ }
@@ -0,0 +1,16 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./org-chart/org-chart.component";
3
+ import * as i2 from "@angular/common";
4
+ import * as i3 from "primeng/button";
5
+ import * as i4 from "@angular/platform-browser";
6
+ import * as i5 from "@angular/forms";
7
+ import * as i6 from "primeng/organizationchart";
8
+ import * as i7 from "@angular/material/input";
9
+ import * as i8 from "@angular/material/menu";
10
+ import * as i9 from "@angular/material/button";
11
+ import * as i10 from "@angular/material/icon";
12
+ export declare class RuclibOrgChartModule {
13
+ static ɵfac: i0.ɵɵFactoryDeclaration<RuclibOrgChartModule, never>;
14
+ static ɵmod: i0.ɵɵNgModuleDeclaration<RuclibOrgChartModule, [typeof i1.OrgChartComponent], [typeof i2.CommonModule, typeof i3.ButtonModule, typeof i4.BrowserModule, typeof i5.FormsModule, typeof i6.OrganizationChartModule, typeof i7.MatInputModule, typeof i8.MatMenuModule, typeof i9.MatButtonModule, typeof i10.MatIconModule], [typeof i1.OrgChartComponent]>;
15
+ static ɵinj: i0.ɵɵInjectorDeclaration<RuclibOrgChartModule>;
16
+ }
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@ruc-lib/org-chart",
3
+ "version": "2.0.0",
4
+ "license": "MIT",
5
+ "peerDependencies": {
6
+ "@angular/common": "^17.0.0 || ^16.0.0 || ^15.0.0",
7
+ "@angular/core": "^17.0.0 || ^16.0.0 || ^15.0.0",
8
+ "primeng": "^15.4.1"
9
+ },
10
+ "dependencies": {
11
+ "tslib": "^2.3.0"
12
+ },
13
+ "publishConfig": {
14
+ "access": "public"
15
+ },
16
+ "sideEffects": false,
17
+ "module": "fesm2015/ruc-lib-org-chart.mjs",
18
+ "es2020": "fesm2020/ruc-lib-org-chart.mjs",
19
+ "esm2020": "esm2020/ruc-lib-org-chart.mjs",
20
+ "fesm2020": "fesm2020/ruc-lib-org-chart.mjs",
21
+ "fesm2015": "fesm2015/ruc-lib-org-chart.mjs",
22
+ "typings": "index.d.ts",
23
+ "exports": {
24
+ "./package.json": {
25
+ "default": "./package.json"
26
+ },
27
+ ".": {
28
+ "types": "./index.d.ts",
29
+ "esm2020": "./esm2020/ruc-lib-org-chart.mjs",
30
+ "es2020": "./fesm2020/ruc-lib-org-chart.mjs",
31
+ "es2015": "./fesm2015/ruc-lib-org-chart.mjs",
32
+ "node": "./fesm2015/ruc-lib-org-chart.mjs",
33
+ "default": "./fesm2020/ruc-lib-org-chart.mjs"
34
+ }
35
+ }
36
+ }
@@ -0,0 +1,8 @@
1
+ import { OrgData, OrgDataItem } from '../interfaces/org-chart';
2
+ export declare const downloadChart: (chartContainer: HTMLElement, format: 'png' | 'jpeg' | 'pdf') => void;
3
+ export declare const captureElementAsImage: (element: HTMLElement, format: 'png' | 'jpeg') => Promise<string>;
4
+ export declare const createPDF: (element: HTMLElement) => void;
5
+ export declare const downloadImage: (imgData: string, format: 'png' | 'jpeg') => void;
6
+ export declare const handleCanvasError: (error: any) => void;
7
+ export declare const checkPropsType: (props: OrgData) => void;
8
+ export declare const checkOrgDataItem: (item: OrgDataItem) => void;