hitpa-common-navigation 0.1.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.
- package/README.md +74 -0
- package/dist/components/HitpaSideBar.d.ts +2 -0
- package/dist/components/NavigationSidebar.d.ts +2 -0
- package/dist/components/SequenceMenuSidebar.d.ts +2 -0
- package/dist/index.cjs +44 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +4144 -0
- package/dist/menuIconMap.d.ts +1 -0
- package/dist/types.d.ts +112 -0
- package/dist/utils/menuBuilder.d.ts +4 -0
- package/package.json +38 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const menuIconNameMapping: Record<string, string>;
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { CSSProperties, ReactNode } from "react";
|
|
2
|
+
export interface ResourceAccessClient {
|
|
3
|
+
roles?: string[];
|
|
4
|
+
}
|
|
5
|
+
export type ResourceAccessMap = Record<string, ResourceAccessClient | undefined>;
|
|
6
|
+
export type NavigationPathField = "menuPath" | "consintMenuPath";
|
|
7
|
+
export type LocalModulePreset = "product" | "provider" | "provider_management" | "user_management" | "master_management" | "product_managment" | "dashboard_mgmt" | "messaging" | "communications" | "report_claim" | "preauth_cashlesh_management" | "reimbursement_management" | "letter_management" | "claim_config_managment" | "sla_management" | "grievance_management" | "claim_audit_recovery" | "dms" | "digitization" | "fwa_desk_audit" | "webservices" | "reopenclaim_management" | "reporting" | "none";
|
|
8
|
+
export interface LocalModuleConfig {
|
|
9
|
+
sectionKey?: string;
|
|
10
|
+
menuId?: string;
|
|
11
|
+
pathPrefix?: string;
|
|
12
|
+
pathPreference?: NavigationPathField[];
|
|
13
|
+
}
|
|
14
|
+
export type LocalModuleInput = LocalModulePreset | LocalModuleConfig;
|
|
15
|
+
export interface OrderedMenuChild {
|
|
16
|
+
kcUniqueCode: string;
|
|
17
|
+
menuName: string;
|
|
18
|
+
menuSequence?: number;
|
|
19
|
+
menuPath?: string;
|
|
20
|
+
consintMenuPath?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface OrderedMenuNode {
|
|
23
|
+
menuId?: string;
|
|
24
|
+
kcUniqueCode: string;
|
|
25
|
+
menuName: string;
|
|
26
|
+
menuSequence?: number;
|
|
27
|
+
menuPath?: string;
|
|
28
|
+
consintMenuPath?: string;
|
|
29
|
+
children?: OrderedMenuChild[];
|
|
30
|
+
}
|
|
31
|
+
export interface NavigationLeaf {
|
|
32
|
+
key: string;
|
|
33
|
+
label: string;
|
|
34
|
+
path: string;
|
|
35
|
+
external?: boolean;
|
|
36
|
+
meta?: OrderedMenuChild;
|
|
37
|
+
}
|
|
38
|
+
export interface NavigationSection {
|
|
39
|
+
key: string;
|
|
40
|
+
label: string;
|
|
41
|
+
iconKey: string;
|
|
42
|
+
icon?: ReactNode;
|
|
43
|
+
children: NavigationLeaf[];
|
|
44
|
+
order?: number;
|
|
45
|
+
meta?: OrderedMenuNode;
|
|
46
|
+
}
|
|
47
|
+
export interface SequenceMenuResponse {
|
|
48
|
+
dataList?: OrderedMenuNode[] | null;
|
|
49
|
+
}
|
|
50
|
+
export type ResolveChildPath = (args: {
|
|
51
|
+
child: OrderedMenuChild;
|
|
52
|
+
parent: OrderedMenuNode;
|
|
53
|
+
defaultPath: string;
|
|
54
|
+
}) => string | undefined;
|
|
55
|
+
export interface SequenceMenuOptions {
|
|
56
|
+
clientPrefix?: string;
|
|
57
|
+
pathPreference?: NavigationPathField[];
|
|
58
|
+
sectionLabelOverrides?: Record<string, string>;
|
|
59
|
+
resolveChildPath?: ResolveChildPath;
|
|
60
|
+
}
|
|
61
|
+
export interface SequenceMenuBehaviorOptions {
|
|
62
|
+
externalNavigation?: "replace" | "assign" | "none";
|
|
63
|
+
navigateAllInternal?: boolean;
|
|
64
|
+
noPermissionPath?: string;
|
|
65
|
+
isItemSelected?: (item: NavigationLeaf, selectedKey?: string) => boolean;
|
|
66
|
+
onNavigate?: (item: NavigationLeaf, section: NavigationSection) => void;
|
|
67
|
+
}
|
|
68
|
+
export interface BuildSequenceMenuSectionsOptions extends SequenceMenuOptions {
|
|
69
|
+
resourceAccess?: ResourceAccessMap | null;
|
|
70
|
+
sequenceMenu?: SequenceMenuResponse | OrderedMenuNode[] | null;
|
|
71
|
+
localModule?: LocalModuleInput;
|
|
72
|
+
}
|
|
73
|
+
export interface NavigationSidebarProps {
|
|
74
|
+
sections: NavigationSection[];
|
|
75
|
+
collapsed?: boolean;
|
|
76
|
+
selectedKey?: string;
|
|
77
|
+
defaultOpenKeys?: string[];
|
|
78
|
+
width?: number;
|
|
79
|
+
collapsedWidth?: number;
|
|
80
|
+
topOffset?: number;
|
|
81
|
+
title?: ReactNode;
|
|
82
|
+
footer?: ReactNode;
|
|
83
|
+
style?: CSSProperties;
|
|
84
|
+
renderSectionIcon?: (section: NavigationSection) => ReactNode;
|
|
85
|
+
isItemSelected?: (item: NavigationLeaf, selectedKey?: string) => boolean;
|
|
86
|
+
onToggleCollapse?: () => void;
|
|
87
|
+
onNavigate?: (item: NavigationLeaf, section: NavigationSection) => void;
|
|
88
|
+
}
|
|
89
|
+
export type SequenceMenuSidebarUiOptions = Omit<NavigationSidebarProps, "sections" | "collapsed" | "selectedKey" | "isItemSelected" | "onToggleCollapse" | "onNavigate">;
|
|
90
|
+
export interface SequenceMenuSidebarProps {
|
|
91
|
+
resourceAccess?: ResourceAccessMap | null;
|
|
92
|
+
sequenceMenu?: SequenceMenuResponse | OrderedMenuNode[] | null;
|
|
93
|
+
pathname?: string;
|
|
94
|
+
collapsed?: boolean;
|
|
95
|
+
onCollapse?: () => void;
|
|
96
|
+
navigate?: (path: string, options?: {
|
|
97
|
+
replace?: boolean;
|
|
98
|
+
}) => void;
|
|
99
|
+
localModule?: LocalModuleInput;
|
|
100
|
+
redirectOnNoPermission?: boolean;
|
|
101
|
+
onMenuClick?: (item: NavigationLeaf, section: NavigationSection) => void;
|
|
102
|
+
menuOptions?: SequenceMenuOptions;
|
|
103
|
+
behavior?: SequenceMenuBehaviorOptions;
|
|
104
|
+
ui?: SequenceMenuSidebarUiOptions;
|
|
105
|
+
}
|
|
106
|
+
export type SequenceMenuLoader = () => Promise<SequenceMenuResponse | OrderedMenuNode[] | null | undefined>;
|
|
107
|
+
export interface HitpaSideBarProps extends Omit<SequenceMenuSidebarProps, "resourceAccess" | "sequenceMenu" | "pathname" | "navigate"> {
|
|
108
|
+
loadSequenceMenu: SequenceMenuLoader;
|
|
109
|
+
tokenStorageKey?: string;
|
|
110
|
+
defaultCollapsed?: boolean;
|
|
111
|
+
onLoadError?: (error: unknown) => void;
|
|
112
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { BuildSequenceMenuSectionsOptions, LocalModuleConfig, LocalModuleInput, NavigationSection, ResourceAccessMap } from "../types";
|
|
2
|
+
export declare function getLocalModuleConfig(localModule?: LocalModuleInput): LocalModuleConfig;
|
|
3
|
+
export declare function getAuthorizedMenuCodes(resourceAccess?: ResourceAccessMap | null, clientPrefix?: string): Set<string>;
|
|
4
|
+
export declare function buildSequenceMenuSections({ resourceAccess, sequenceMenu, clientPrefix, pathPreference, localModule, resolveChildPath }: BuildSequenceMenuSectionsOptions): NavigationSection[];
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hitpa-common-navigation",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"main": "./dist/index.cjs",
|
|
5
|
+
"module": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"require": "./dist/index.cjs"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "vite build && tsc --emitDeclarationOnly",
|
|
19
|
+
"prepublishOnly": "npm run build"
|
|
20
|
+
},
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"@emotion/react": "^11.14.0",
|
|
26
|
+
"@emotion/styled": "^11.14.0",
|
|
27
|
+
"@mui/icons-material": "^6.4.12",
|
|
28
|
+
"@mui/material": "^6.4.5",
|
|
29
|
+
"react": "^18.3.1",
|
|
30
|
+
"react-dom": "^18.3.1",
|
|
31
|
+
"react-router-dom": "^6.0.0 || ^7.0.0"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@vitejs/plugin-react": "^6.0.1",
|
|
35
|
+
"typescript": "^5.0.0",
|
|
36
|
+
"vite": "^8.0.7"
|
|
37
|
+
}
|
|
38
|
+
}
|