ubk.erp.webpack 1.0.5 → 1.0.8
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 +84 -43
- package/dist/index.cjs +14 -14
- package/dist/index.d.ts +36 -5
- package/dist/index.js +4843 -2468
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -1,81 +1,122 @@
|
|
|
1
|
-
#
|
|
1
|
+
# UBK ERP Component Library
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A professional React component library for UBK ERP systems, built with Vite and Ant Design.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## 🚀 Key Features
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- **Modular Components**: Easily integrate ERP modules like Transport, Front Office, and Dashboards.
|
|
8
|
+
- **Configurable Base URLs**: Support for configurable API and asset base URLs.
|
|
9
|
+
- **Modern UI**: Styled with Ant Design for a consistent and professional look.
|
|
10
|
+
- **TypeScript Support**: Full type definitions included.
|
|
11
|
+
- **SWR Integration**: Efficient data fetching and caching out of the box.
|
|
12
|
+
|
|
13
|
+
## 📦 Installation
|
|
14
|
+
|
|
15
|
+
Install the package and its peer dependencies:
|
|
8
16
|
|
|
9
17
|
```bash
|
|
10
18
|
npm install ubk.erp.webpack
|
|
11
19
|
```
|
|
12
20
|
|
|
13
|
-
|
|
21
|
+
### Peer Dependencies
|
|
22
|
+
Ensure your project has the following installed:
|
|
23
|
+
- `react` >= 18
|
|
24
|
+
- `react-dom` >= 18
|
|
25
|
+
- `antd` >= 5
|
|
26
|
+
- `swr` >= 2
|
|
27
|
+
- `axios` >= 1
|
|
14
28
|
|
|
15
|
-
|
|
29
|
+
## ⚙️ Configuration
|
|
16
30
|
|
|
17
|
-
|
|
18
|
-
- `react-dom` (>= 18)
|
|
19
|
-
- `antd` (>= 5)
|
|
20
|
-
- `swr` (>= 2)
|
|
31
|
+
The library determines the base URL for API calls and assets using the following priority (highest to lowest):
|
|
21
32
|
|
|
22
|
-
|
|
33
|
+
1. **Manual Configuration**: Using the `setBaseUrl()` function in your code.
|
|
34
|
+
2. **Environment Variable**: `VITE_ASSET_BASE_URL` in your `.env` file.
|
|
35
|
+
3. **Default Fallback**: `https://npmapi.ubkerp.com/` (used if no other config is found).
|
|
23
36
|
|
|
24
|
-
|
|
37
|
+
### 1. Manual Setup (Recommended for NPM Users)
|
|
25
38
|
|
|
26
39
|
```jsx
|
|
27
|
-
import
|
|
28
|
-
import { MenuSubmenu } from "ubk.erp.webpack";
|
|
40
|
+
import { setBaseUrl } from "ubk.erp.webpack";
|
|
29
41
|
|
|
42
|
+
// Set your base URL once
|
|
43
|
+
setBaseUrl("https://your-api-domain.com/");
|
|
44
|
+
```
|
|
30
45
|
|
|
31
|
-
|
|
32
|
-
const token = "123";
|
|
33
|
-
return (
|
|
34
|
-
<div>
|
|
35
|
-
<MenuSubmenu token={token} menu={"FrontOffice"} />
|
|
36
|
-
</div>
|
|
37
|
-
);
|
|
38
|
-
};
|
|
46
|
+
### Environment Variables (Alternative)
|
|
39
47
|
|
|
40
|
-
|
|
41
|
-
|
|
48
|
+
If you prefer using environment variables, the library also supports:
|
|
49
|
+
|
|
50
|
+
```env
|
|
51
|
+
# Provide a full URL for asset/API base; if omitted the default
|
|
52
|
+
# fallback `https://npmapi.ubkerp.com/` will be used.
|
|
53
|
+
VITE_ASSET_BASE_URL=https://npmapi.ubkerp.com/
|
|
54
|
+
REACT_APP_API_URL=https://npmapi.ubkerp.com/
|
|
42
55
|
|
|
43
|
-
|
|
56
|
+
# API Endpoints
|
|
57
|
+
VITE_MENU_URL=api/sdk/Menus
|
|
58
|
+
VITE_ADMISSION_ENQUIRY_URL=api/branchapi/frontoffice/enquirytablelist
|
|
59
|
+
# ... (see .env.example for full list)
|
|
60
|
+
```
|
|
44
61
|
|
|
62
|
+
## 🛠️ Usage
|
|
45
63
|
|
|
64
|
+
### Basic Component Integration
|
|
46
65
|
|
|
47
|
-
- `AdmissionEnquiry`
|
|
48
66
|
```jsx
|
|
49
|
-
import
|
|
67
|
+
import React from 'react';
|
|
68
|
+
import { MenuSubmenu } from "ubk.erp.webpack";
|
|
50
69
|
|
|
51
70
|
const App = () => {
|
|
52
|
-
const token = "
|
|
71
|
+
const token = "YOUR_AUTH_TOKEN";
|
|
53
72
|
return (
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
73
|
+
<MenuSubmenu
|
|
74
|
+
token={token}
|
|
75
|
+
menu="FrontOffice"
|
|
76
|
+
/>
|
|
57
77
|
);
|
|
58
78
|
};
|
|
59
79
|
|
|
60
80
|
export default App;
|
|
61
81
|
```
|
|
62
|
-
`
|
|
63
82
|
|
|
64
|
-
|
|
83
|
+
### Using the Transport Module
|
|
84
|
+
|
|
65
85
|
```jsx
|
|
66
86
|
import { TransportRoutes } from "ubk.erp.webpack";
|
|
67
87
|
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
return (
|
|
71
|
-
<div>
|
|
72
|
-
<TransportRoutes token={token} />
|
|
73
|
-
</div>
|
|
74
|
-
);
|
|
88
|
+
const TransportPage = () => {
|
|
89
|
+
return <TransportRoutes token="YOUR_TOKEN" />;
|
|
75
90
|
};
|
|
76
|
-
|
|
77
|
-
export default App;
|
|
78
91
|
```
|
|
79
92
|
|
|
93
|
+
## 🧩 Available Components
|
|
94
|
+
|
|
95
|
+
| Component | Description |
|
|
96
|
+
| :--- | :--- |
|
|
97
|
+
| `ErpDashboard` | Main dashboard overview. |
|
|
98
|
+
| `MenuSubmenu` | Dynamic menu and navigation component. |
|
|
99
|
+
| `AdmissionEnquiry` | Front office admission enquiry management. |
|
|
100
|
+
| `TransportRoutes` | Manage transport routes and pricing. |
|
|
101
|
+
| `TransportVehicles` | Vehicle fleet management. |
|
|
102
|
+
| `AssignVehicles` | Assign vehicles to specific routes. |
|
|
103
|
+
| `AddDriver` | Driver information and document management. |
|
|
104
|
+
| `RouteTimeTable` | Schedule management for transport routes. |
|
|
105
|
+
| `Stoppage` | Manage route stops and timings. |
|
|
106
|
+
|
|
107
|
+
## 🛠️ Development
|
|
108
|
+
|
|
109
|
+
### Setup
|
|
110
|
+
1. Clone the repository
|
|
111
|
+
2. Install dependencies: `npm install`
|
|
112
|
+
3. Copy `.env.example` to `.env` and configure.
|
|
113
|
+
|
|
114
|
+
### Build
|
|
115
|
+
To build the library for production:
|
|
116
|
+
```bash
|
|
117
|
+
npm run build
|
|
118
|
+
```
|
|
119
|
+
This generates the `dist/` folder with ES and CommonJS formats.
|
|
80
120
|
|
|
81
|
-
|
|
121
|
+
## 📄 License
|
|
122
|
+
Internal UBK Project. All rights reserved.
|