@xelto.npm/xc-lib 1.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 +166 -0
- package/dist/index.cjs.js +35765 -0
- package/dist/index.esm.js +35706 -0
- package/package.json +110 -0
package/README.md
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Xelcode Library
|
|
2
|
+
|
|
3
|
+
A comprehensive React component library and utility toolkit for building enterprise applications with Material-UI integration.
|
|
4
|
+
|
|
5
|
+
## 📦 Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install xelcode-library
|
|
9
|
+
# or
|
|
10
|
+
yarn add xelcode-library
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 🔗 Development Setup
|
|
14
|
+
|
|
15
|
+
For development and testing, you can use **yarn link**:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# In the xelcode-library directory
|
|
19
|
+
yarn link
|
|
20
|
+
|
|
21
|
+
# In your project directory
|
|
22
|
+
yarn link xelcode-library
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 🏗️ Project Structure
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
src/
|
|
29
|
+
├── components/ # React components
|
|
30
|
+
├── store/ # Redux store with sagas
|
|
31
|
+
└── utils/ # Utility functions and helpers
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## 🧩 Components
|
|
35
|
+
|
|
36
|
+
### Core Components
|
|
37
|
+
|
|
38
|
+
- **`Button`**: Enhanced Material-UI Button with additional styling and icon support
|
|
39
|
+
- **`Dialog`**: Modal dialog component with built-in audio feedback and type-based styling
|
|
40
|
+
- **`TextField`**: Enhanced text input with scanning support and custom adornments
|
|
41
|
+
- **`List`** & **`SimpleList`**: Advanced list components with search, sorting, and swipe functionality
|
|
42
|
+
- **`DatePicker`**: Date selection component with Material-UI Pickers integration
|
|
43
|
+
- **`Select`** & **`SelectDialog`**: Dropdown selection components with keyboard navigation support
|
|
44
|
+
|
|
45
|
+
### Additional Components
|
|
46
|
+
|
|
47
|
+
- **`ButtonGroup`**: Arrange buttons in a grid layout
|
|
48
|
+
- **`ErrorBoundary`**: React error boundary with fallback UI
|
|
49
|
+
- **`HelperText`**: Information text with icons
|
|
50
|
+
- **`Label`** & **`LabelAligned`**: Text display components
|
|
51
|
+
- **`Loading`**: Loading overlay with timeout support
|
|
52
|
+
- **`RadioButtonGroup`**: Radio button selection group
|
|
53
|
+
- **`ScannerService`**: Barcode scanner integration service
|
|
54
|
+
|
|
55
|
+
## 🗄️ Store & State Management
|
|
56
|
+
|
|
57
|
+
The library includes a complete **Redux** store setup with **Redux-Saga** for side effects.
|
|
58
|
+
|
|
59
|
+
### Store Modules
|
|
60
|
+
|
|
61
|
+
- **`API`**: API request state management
|
|
62
|
+
- **`Common`**: Shared application state
|
|
63
|
+
- **`Scanner`**: Barcode scanner state
|
|
64
|
+
- **`User`**: User authentication and session management
|
|
65
|
+
|
|
66
|
+
### Usage
|
|
67
|
+
|
|
68
|
+
```jsx
|
|
69
|
+
import { libraryActions, librarySaga } from 'xelcode-library/store';
|
|
70
|
+
|
|
71
|
+
// Dispatch actions
|
|
72
|
+
dispatch(libraryActions.getConfig());
|
|
73
|
+
dispatch(libraryActions.getPrinters());
|
|
74
|
+
|
|
75
|
+
// Access selectors
|
|
76
|
+
import { selectCommon, selectUser } from 'xelcode-library/store';
|
|
77
|
+
const common = useSelector(selectCommon());
|
|
78
|
+
const user = useSelector(selectUser());
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## 🛠️ Utilities
|
|
82
|
+
|
|
83
|
+
### API Management
|
|
84
|
+
|
|
85
|
+
```jsx
|
|
86
|
+
import { ApiManager } from 'xelcode-library/utils';
|
|
87
|
+
|
|
88
|
+
// Initialize API manager
|
|
89
|
+
ApiManager.setStore(store);
|
|
90
|
+
ApiManager.setSession(sessionId);
|
|
91
|
+
|
|
92
|
+
// Make API calls
|
|
93
|
+
const result = await ApiManager.post('endpoint', data);
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### JDE Utilities
|
|
97
|
+
|
|
98
|
+
```jsx
|
|
99
|
+
import { JdeUtils, Config } from 'xelcode-library/utils';
|
|
100
|
+
|
|
101
|
+
// Format lot numbers
|
|
102
|
+
const formatted = JdeUtils.formatLotLots(item, lotn, lots, branch);
|
|
103
|
+
|
|
104
|
+
// Get configuration
|
|
105
|
+
const value = Config.get('key');
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
#### Available JdeUtils Functions
|
|
109
|
+
|
|
110
|
+
- **`consignmentFlag(branch)`**: Check if *branch* is consignment
|
|
111
|
+
- **`formatLotLots(item, lotn, lots, branch)`**: Format *item* with *lotn* and *lots* information
|
|
112
|
+
- **`trim(text, length)`**: Trim *text* to specified *length*
|
|
113
|
+
- **`getPrinter(processId, printers)`**: Get appropriate printer for *processId*
|
|
114
|
+
- **`isValidTime(time)`**: Validate *time* format
|
|
115
|
+
- **`parseOrderNumber(order, withCompany)`**: Parse *order* number into components
|
|
116
|
+
- **`toDouble(text, numberOfDigit)`**: Convert *text* to double with *numberOfDigit* decimal places
|
|
117
|
+
- **`toBool(text)`**: Convert *text* to boolean
|
|
118
|
+
- **`formatQuantity(quantity, um)`**: Format *quantity* with unit of measure *um*
|
|
119
|
+
- **`formatDate(date)`**: Format *date* to YYYYMMDD string
|
|
120
|
+
- **`formatOrder(...args)`**: Join *args* order arguments
|
|
121
|
+
- **`formatTime(hhmm)`**: Format *hhmm* time to HH:MM
|
|
122
|
+
- **`toPrimaryUM(item, quantity, fromUM)`**: Convert *quantity* from *fromUM* to primary unit
|
|
123
|
+
- **`convertUM(quantity, item, umCode)`**: Convert *quantity* between units using *umCode*
|
|
124
|
+
- **`getUMFactor(item, umCode)`**: Get unit of measure conversion factor for *umCode*
|
|
125
|
+
- **`convertToStruct(quantity, item, structId)`**: Convert *quantity* to structural unit *structId*
|
|
126
|
+
- **`convertFromStruct(quantity, item, structId)`**: Convert *quantity* from structural unit *structId*
|
|
127
|
+
- **`getUom1(item)`**: Get primary unit of measure from *item*
|
|
128
|
+
- **`getStructUM(item, structId)`**: Get structural unit of measure for *structId*
|
|
129
|
+
- **`compareItemsMask(item1, scan)`**: Compare *item1* with *scan* using mask
|
|
130
|
+
- **`compareItems(item1, scan)`**: Compare *item1* with *scan* for equality
|
|
131
|
+
- **`compareItem(item, itemCode)`**: Compare *item* with *itemCode*
|
|
132
|
+
- **`locationFormat(location, addRemainingSeparators)`**: Format *location* string
|
|
133
|
+
- **`locationDeformat(location)`**: Remove formatting from *location*
|
|
134
|
+
- **`filter(textfieldValue, value)`**: Filter *value* based on *textfieldValue* input
|
|
135
|
+
- **`parseToHHMM(time)`**: Parse *time* to HH:MM format
|
|
136
|
+
- **`parseMicrosoftDate(date)`**: Parse Microsoft *date* format
|
|
137
|
+
|
|
138
|
+
## 🔧 Configuration
|
|
139
|
+
|
|
140
|
+
### Environment Variables
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
API_BASE_URL=https://api.example.com
|
|
144
|
+
TIMEOUT=364000
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## 📋 Requirements
|
|
148
|
+
|
|
149
|
+
- **Node.js** >= 10
|
|
150
|
+
- **React** >= 17.0.2
|
|
151
|
+
- **React DOM** >= 17.0.2
|
|
152
|
+
- **Material-UI** >= 4.12.3
|
|
153
|
+
|
|
154
|
+
## 🚀 Development
|
|
155
|
+
|
|
156
|
+
### Build
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
npm run build
|
|
160
|
+
# or
|
|
161
|
+
yarn build
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
Built with ❤️ by the **Xelcode** team
|